Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ManagedZone API #793

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
// 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 @@
// +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 @@
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 @@
return p
}

func (p *DNSPolicy) WithHealthCheck(healthCheck v1alpha1.HealthCheckSpec) *DNSPolicy {
func (p *DNSPolicy) WithHealthCheck(healthCheck dnsv1alpha1.HealthCheckSpec) *DNSPolicy {

Check warning on line 258 in api/v1alpha1/dnspolicy_types.go

View check run for this annotation

Codecov / codecov/patch

api/v1alpha1/dnspolicy_types.go#L258

Added line #L258 was not covered by tests
p.Spec.HealthCheck = &healthCheck
return p
}
Expand All @@ -264,6 +270,19 @@
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 @@
//HealthCheck

func (p *DNSPolicy) WithHealthCheckFor(endpoint string, port int, protocol string, failureThreshold int) *DNSPolicy {
return p.WithHealthCheck(v1alpha1.HealthCheckSpec{
return p.WithHealthCheck(dnsv1alpha1.HealthCheckSpec{

Check warning on line 299 in api/v1alpha1/dnspolicy_types.go

View check run for this annotation

Codecov / codecov/patch

api/v1alpha1/dnspolicy_types.go#L299

Added line #L299 was not covered by tests
Endpoint: endpoint,
Port: &port,
Protocol: ptr.To(v1alpha1.HealthProtocol(protocol)),
Protocol: ptr.To(dnsv1alpha1.HealthProtocol(protocol)),

Check warning on line 302 in api/v1alpha1/dnspolicy_types.go

View check run for this annotation

Codecov / codecov/patch

api/v1alpha1/dnspolicy_types.go#L302

Added line #L302 was not covered by tests
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
Loading