From 4840fb966b347b7d86e754582e307003b4fae1e8 Mon Sep 17 00:00:00 2001 From: Omer Date: Fri, 14 Feb 2025 12:44:42 +0100 Subject: [PATCH] Add NsRecords API fields under designate CRD So far we were using ns_records configmap to configure the pools ns records. This patch adds the NsRecords API field as in the near future we plan to switch to those instead of configmaps. --- .../designate.openstack.org_designates.yaml | 20 +++++++++++++++++++ api/v1beta1/designate_types.go | 18 +++++++++++++++++ api/v1beta1/zz_generated.deepcopy.go | 20 +++++++++++++++++++ .../designate.openstack.org_designates.yaml | 20 +++++++++++++++++++ 4 files changed, 78 insertions(+) diff --git a/api/bases/designate.openstack.org_designates.yaml b/api/bases/designate.openstack.org_designates.yaml index e262fcf9..0cbbde54 100644 --- a/api/bases/designate.openstack.org_designates.yaml +++ b/api/bases/designate.openstack.org_designates.yaml @@ -1587,6 +1587,26 @@ spec: description: NodeSelector to target subset of worker nodes running this service type: object + nsRecords: + description: NSRecords contains the list of nameserver records for + the Designate pool + items: + description: DesignateNSRecord defines a DNS nameserver record + properties: + hostname: + description: Hostname of the nameserver + minLength: 1 + type: string + priority: + description: Priority of the nameserver + minimum: 1 + type: integer + required: + - hostname + - priority + type: object + type: array + x-kubernetes-list-type: atomic passwordSelectors: default: service: DesignatePassword diff --git a/api/v1beta1/designate_types.go b/api/v1beta1/designate_types.go index c6cbb4df..e2fb35eb 100644 --- a/api/v1beta1/designate_types.go +++ b/api/v1beta1/designate_types.go @@ -105,6 +105,19 @@ type DesignateSpec struct { DesignateUnbound DesignateUnboundSpec `json:"designateUnbound"` } +// DesignateNSRecord defines a DNS nameserver record +type DesignateNSRecord struct { + // Hostname of the nameserver + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinLength=1 + Hostname string `json:"hostname"` + + // Priority of the nameserver + // +kubebuilder:validation:Required + // +kubebuilder:validation:Minimum=1 + Priority int `json:"priority"` +} + // DesignateSpecBase - type DesignateSpecBase struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster @@ -204,6 +217,11 @@ type DesignateSpecBase struct { // TopologyRef to apply the Topology defined by the associated CR referenced // by name TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"` + + // +kubebuilder:validation:Optional + // +listType=atomic + // NSRecords contains the list of nameserver records for the Designate pool + NSRecords []DesignateNSRecord `json:"nsRecords,omitempty"` } // DesignateStatus defines the observed state of Designate diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index dc4a79da..873ba379 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -830,6 +830,21 @@ func (in *DesignateMdnsStatus) DeepCopy() *DesignateMdnsStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DesignateNSRecord) DeepCopyInto(out *DesignateNSRecord) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DesignateNSRecord. +func (in *DesignateNSRecord) DeepCopy() *DesignateNSRecord { + if in == nil { + return nil + } + out := new(DesignateNSRecord) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DesignateProducer) DeepCopyInto(out *DesignateProducer) { *out = *in @@ -1111,6 +1126,11 @@ func (in *DesignateSpecBase) DeepCopyInto(out *DesignateSpecBase) { *out = new(topologyv1beta1.TopoRef) **out = **in } + if in.NSRecords != nil { + in, out := &in.NSRecords, &out.NSRecords + *out = make([]DesignateNSRecord, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DesignateSpecBase. diff --git a/config/crd/bases/designate.openstack.org_designates.yaml b/config/crd/bases/designate.openstack.org_designates.yaml index e262fcf9..0cbbde54 100644 --- a/config/crd/bases/designate.openstack.org_designates.yaml +++ b/config/crd/bases/designate.openstack.org_designates.yaml @@ -1587,6 +1587,26 @@ spec: description: NodeSelector to target subset of worker nodes running this service type: object + nsRecords: + description: NSRecords contains the list of nameserver records for + the Designate pool + items: + description: DesignateNSRecord defines a DNS nameserver record + properties: + hostname: + description: Hostname of the nameserver + minLength: 1 + type: string + priority: + description: Priority of the nameserver + minimum: 1 + type: integer + required: + - hostname + - priority + type: object + type: array + x-kubernetes-list-type: atomic passwordSelectors: default: service: DesignatePassword