Skip to content

Commit

Permalink
Remove ManagedZone API (#793)
Browse files Browse the repository at this point in the history
* chore: Remove ManagedZone API

Signed-off-by: Michael Nairn <[email protected]>

Signed-off-by: craig <[email protected]>

* minor tweaks and change helm rf

Signed-off-by: craig <[email protected]>

* remote zone id from secrets. Add example policy

Signed-off-by: craig <[email protected]>

* update the policy reference doc

Signed-off-by: craig <[email protected]>

---------

Signed-off-by: craig <[email protected]>
Co-authored-by: craig <[email protected]>
  • Loading branch information
mikenairn and maleck13 authored Aug 20, 2024
1 parent 6835744 commit 12687cb
Show file tree
Hide file tree
Showing 34 changed files with 533 additions and 1,803 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ endif
LIMITADOR_OPERATOR_BUNDLE_IMG ?= quay.io/kuadrant/limitador-operator-bundle:$(LIMITADOR_OPERATOR_BUNDLE_IMG_TAG)

## dns
DNS_OPERATOR_VERSION ?= 0.4.1
DNS_OPERATOR_VERSION ?= main

kuadrantdns_bundle_is_semantic := $(call is_semantic_version,$(DNS_OPERATOR_VERSION))
ifeq (latest,$(DNS_OPERATOR_VERSION))
Expand Down
33 changes: 26 additions & 7 deletions api/v1alpha1/dnspolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ package v1alpha1
import (
"context"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

"github.com/kuadrant/dns-operator/api/v1alpha1"
dnsv1alpha1 "github.com/kuadrant/dns-operator/api/v1alpha1"

kuadrantgatewayapi "github.com/kuadrant/kuadrant-operator/pkg/library/gatewayapi"
"github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant"
Expand Down Expand Up @@ -58,13 +59,13 @@ const (
// DNSPolicySpec defines the desired state of DNSPolicy
// +kubebuilder:validation:XValidation:rule="!(self.routingStrategy == 'loadbalanced' && !has(self.loadBalancing))",message="spec.loadBalancing is a required field when spec.routingStrategy == 'loadbalanced'"
type DNSPolicySpec struct {
// TargetRef identifies an API object to apply policy to.
// targetRef identifies an API object to apply policy to.
// +kubebuilder:validation:XValidation:rule="self.group == 'gateway.networking.k8s.io'",message="Invalid targetRef.group. The only supported value is 'gateway.networking.k8s.io'"
// +kubebuilder:validation:XValidation:rule="self.kind == 'Gateway'",message="Invalid targetRef.kind. The only supported values are 'Gateway'"
TargetRef gatewayapiv1alpha2.LocalPolicyTargetReference `json:"targetRef"`

// +optional
HealthCheck *v1alpha1.HealthCheckSpec `json:"healthCheck,omitempty"`
HealthCheck *dnsv1alpha1.HealthCheckSpec `json:"healthCheck,omitempty"`

// +optional
LoadBalancing *LoadBalancingSpec `json:"loadBalancing,omitempty"`
Expand All @@ -73,6 +74,11 @@ type DNSPolicySpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="RoutingStrategy is immutable"
// +kubebuilder:default=loadbalanced
RoutingStrategy RoutingStrategy `json:"routingStrategy"`

// providerRefs is a list of references to provider secrets. Max is one but intention is to allow this to be more in the future
// +kubebuilder:validation:MaxItems=1
// +kubebuilder:validation:MinItems=1
ProviderRefs []dnsv1alpha1.ProviderRef `json:"providerRefs"`
}

type LoadBalancingSpec struct {
Expand Down Expand Up @@ -142,7 +148,7 @@ type DNSPolicyStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// +optional
HealthCheck *v1alpha1.HealthCheckStatus `json:"healthCheck,omitempty"`
HealthCheck *dnsv1alpha1.HealthCheckStatus `json:"healthCheck,omitempty"`

// +optional
RecordConditions map[string][]metav1.Condition `json:"recordConditions,omitempty"`
Expand Down Expand Up @@ -249,7 +255,7 @@ func (p *DNSPolicy) WithTargetRef(targetRef gatewayapiv1alpha2.LocalPolicyTarget
return p
}

func (p *DNSPolicy) WithHealthCheck(healthCheck v1alpha1.HealthCheckSpec) *DNSPolicy {
func (p *DNSPolicy) WithHealthCheck(healthCheck dnsv1alpha1.HealthCheckSpec) *DNSPolicy {
p.Spec.HealthCheck = &healthCheck
return p
}
Expand All @@ -264,6 +270,19 @@ func (p *DNSPolicy) WithRoutingStrategy(strategy RoutingStrategy) *DNSPolicy {
return p
}

func (p *DNSPolicy) WithProviderRef(providerRef dnsv1alpha1.ProviderRef) *DNSPolicy {
p.Spec.ProviderRefs = append(p.Spec.ProviderRefs, providerRef)
return p
}

//ProviderRef

func (p *DNSPolicy) WithProviderSecret(s corev1.Secret) *DNSPolicy {
return p.WithProviderRef(dnsv1alpha1.ProviderRef{
Name: s.Name,
})
}

//TargetRef

func (p *DNSPolicy) WithTargetGateway(gwName string) *DNSPolicy {
Expand All @@ -277,10 +296,10 @@ func (p *DNSPolicy) WithTargetGateway(gwName string) *DNSPolicy {
//HealthCheck

func (p *DNSPolicy) WithHealthCheckFor(endpoint string, port int, protocol string, failureThreshold int) *DNSPolicy {
return p.WithHealthCheck(v1alpha1.HealthCheckSpec{
return p.WithHealthCheck(dnsv1alpha1.HealthCheckSpec{
Endpoint: endpoint,
Port: &port,
Protocol: ptr.To(v1alpha1.HealthProtocol(protocol)),
Protocol: ptr.To(dnsv1alpha1.HealthProtocol(protocol)),
FailureThreshold: &failureThreshold,
})
}
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions bundle/manifests/kuadrant-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/kuadrant-operator:latest
createdAt: "2024-08-14T15:45:59Z"
createdAt: "2024-08-20T09:51:49Z"
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/Kuadrant/kuadrant-operator
Expand Down Expand Up @@ -432,14 +432,6 @@ spec:
- get
- patch
- update
- apiGroups:
- kuadrant.io
resources:
- managedzones
verbs:
- get
- list
- watch
- apiGroups:
- kuadrant.io
resources:
Expand Down
17 changes: 16 additions & 1 deletion bundle/manifests/kuadrant.io_dnspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ spec:
- geo
- weighted
type: object
providerRefs:
description: providerRefs is a list of references to provider secrets.
Max is one but intention is to allow this to be more in the future
items:
properties:
name:
minLength: 1
type: string
required:
- name
type: object
maxItems: 1
minItems: 1
type: array
routingStrategy:
default: loadbalanced
enum:
Expand All @@ -211,7 +225,7 @@ spec:
- message: RoutingStrategy is immutable
rule: self == oldSelf
targetRef:
description: TargetRef identifies an API object to apply policy to.
description: targetRef identifies an API object to apply policy to.
properties:
group:
description: Group is the group of the target resource.
Expand Down Expand Up @@ -240,6 +254,7 @@ spec:
- message: Invalid targetRef.kind. The only supported values are 'Gateway'
rule: self.kind == 'Gateway'
required:
- providerRefs
- routingStrategy
- targetRef
type: object
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dependencies:
- type: olm.package
value:
packageName: dns-operator
version: "0.4.1"
version: "0.0.0"
1 change: 0 additions & 1 deletion charts/kuadrant-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ keywords:
- limitador
- rate limiting
- dns
- managed zones
- kubernetes
sources:
- https://github.com/Kuadrant/kuadrant-operator/
Expand Down
Loading

0 comments on commit 12687cb

Please sign in to comment.