Skip to content

Commit

Permalink
chore: Remove ManagedZone API
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Nairn <[email protected]>

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

remove need for aws zone id

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

remove specific branch

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

Signed-off-by: craig <[email protected]>
  • Loading branch information
mikenairn authored and maleck13 committed Aug 19, 2024
1 parent 29fee5e commit e5a7b6f
Show file tree
Hide file tree
Showing 31 changed files with 477 additions and 1,800 deletions.
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:MinItems=1
// +kubebuilder:validation:MaxItems=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 @@ -432,14 +432,6 @@ spec:
- get
- patch
- update
- apiGroups:
- kuadrant.io
resources:
- managedzones
verbs:
- get
- list
- watch
- apiGroups:
- kuadrant.io
resources:
Expand Down Expand Up @@ -600,7 +592,7 @@ spec:
env:
- name: RELATED_IMAGE_WASMSHIM
value: oci://quay.io/kuadrant/wasm-shim:latest
image: quay.io/kuadrant/kuadrant-operator:latest
image: quay.io/kuadrant/kuadrant-operator:remove_managed_zone_api
livenessProbe:
httpGet:
path: /healthz
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
3 changes: 1 addition & 2 deletions 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 All @@ -30,7 +29,7 @@ dependencies:
version: 0.0.0
repository: https://kuadrant.io/helm-charts/
- name: dns-operator
version: 0.0.0
version: remove_managed_zone_api
repository: https://kuadrant.io/helm-charts/
maintainers:
- email: [email protected]
Expand Down
Loading

0 comments on commit e5a7b6f

Please sign in to comment.