Skip to content

Commit eca30f6

Browse files
committed
Support custom list of services to be added to /etc/hosts in cluster DNS operator - RFE-4145
1 parent c7fbd08 commit eca30f6

File tree

7 files changed

+255
-1
lines changed

7 files changed

+255
-1
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 55 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28801,6 +28801,26 @@
2880128801
}
2880228802
}
2880328803
},
28804+
"com.github.openshift.api.operator.v1.DNSNodeService": {
28805+
"description": "DNSNodeService represents a Kubernetes service by name and namespace for node services.",
28806+
"type": "object",
28807+
"required": [
28808+
"name",
28809+
"namespace"
28810+
],
28811+
"properties": {
28812+
"name": {
28813+
"description": "name is the name of the service. The name should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens, and should start with an alphabetic character and end with an alphanumeric character.",
28814+
"type": "string",
28815+
"default": ""
28816+
},
28817+
"namespace": {
28818+
"description": "namespace is the namespace of the service. The namespace should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens, and should start and end with an alphanumeric character.",
28819+
"type": "string",
28820+
"default": ""
28821+
}
28822+
}
28823+
},
2880428824
"com.github.openshift.api.operator.v1.DNSOverTLSConfig": {
2880528825
"description": "DNSOverTLSConfig describes optional DNSTransportConfig fields that should be captured.",
2880628826
"type": "object",
@@ -28842,6 +28862,19 @@
2884228862
"default": {},
2884328863
"$ref": "#/definitions/com.github.openshift.api.operator.v1.DNSNodePlacement"
2884428864
},
28865+
"nodeServices": {
28866+
"description": "nodeServices specifies a list of service objects for which host level resolvable entries should be added. Services in this list will be added to /etc/hosts on each node in the cluster by the node resolver. When not specified, only the default image registry service is resolvable. Services in this list will be added in addition to the default \"image-registry.openshift-image-registry.svc\" service. The default image registry service cannot be removed. For each service reference, entries will be created using the format \"<name>.<namespace>.svc\" and an alias with the CLUSTER_DOMAIN suffix of cluster.local will also be added.",
28867+
"type": "array",
28868+
"items": {
28869+
"default": {},
28870+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.DNSNodeService"
28871+
},
28872+
"x-kubernetes-list-map-keys": [
28873+
"name",
28874+
"namespace"
28875+
],
28876+
"x-kubernetes-list-type": "map"
28877+
},
2884528878
"operatorLogLevel": {
2884628879
"description": "operatorLogLevel controls the logging level of the DNS Operator. Valid values are: \"Normal\", \"Debug\", \"Trace\". Defaults to \"Normal\". setting operatorLogLevel: Trace will produce extremely verbose logs.",
2884728880
"type": "string"

operator/v1/types_dns.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ type DNSSpec struct {
9595
// +kubebuilder:default=Normal
9696
OperatorLogLevel DNSLogLevel `json:"operatorLogLevel,omitempty"`
9797

98+
// nodeServices specifies a list of service objects for which host level resolvable entries should be added.
99+
// Services in this list will be added to /etc/hosts on each node in the cluster by the node resolver.
100+
// When not specified, only the default image registry service is resolvable.
101+
// Services in this list will be added in addition to the default "image-registry.openshift-image-registry.svc" service.
102+
// The default image registry service cannot be removed.
103+
// For each service reference, entries will be created using the format "<name>.<namespace>.svc"
104+
// and an alias with the CLUSTER_DOMAIN suffix of cluster.local will also be added.
105+
//
106+
// +optional
107+
// +kubebuilder:validation:MaxItems=20
108+
// +kubebuilder:validation:MinItems=1
109+
// +listType=map
110+
// +listMapKey=name
111+
// +listMapKey=namespace
112+
NodeServices []DNSNodeService `json:"nodeServices,omitempty"`
113+
98114
// logLevel describes the desired logging verbosity for CoreDNS.
99115
// Any one of the following values may be specified:
100116
// * Normal logs errors from upstream resolvers.
@@ -163,6 +179,27 @@ var (
163179
DNSLogLevelTrace DNSLogLevel = "Trace"
164180
)
165181

182+
// DNSNodeService represents a Kubernetes service by name and namespace for node services.
183+
type DNSNodeService struct {
184+
// name is the name of the service.
185+
// The name should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
186+
// and should start with an alphabetic character and end with an alphanumeric character.
187+
// +required
188+
// +kubebuilder:validation:MinLength=1
189+
// +kubebuilder:validation:MaxLength=63
190+
// +kubebuilder:validation:XValidation:rule=`!format.dns1035Label().validate(self).hasValue()`,message="a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character"
191+
Name string `json:"name"`
192+
193+
// namespace is the namespace of the service.
194+
// The namespace should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
195+
// and should start and end with an alphanumeric character.
196+
// +required
197+
// +kubebuilder:validation:MinLength=1
198+
// +kubebuilder:validation:MaxLength=63
199+
// +kubebuilder:validation:XValidation:rule=`!format.dns1123Label().validate(self).hasValue()`,message="the value must consist of only lowercase alphanumeric characters and hyphens"
200+
Namespace string `json:"namespace"`
201+
}
202+
166203
// Server defines the schema for a server that runs per instance of CoreDNS.
167204
type Server struct {
168205
// name is required and specifies a unique name for the server. Name must comply

operator/v1/zz_generated.crd-manifests/0000_70_dns_00_dnses.crd.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,55 @@ spec:
191191
type: object
192192
type: array
193193
type: object
194+
nodeServices:
195+
description: |-
196+
nodeServices specifies a list of service objects for which host level resolvable entries should be added.
197+
Services in this list will be added to /etc/hosts on each node in the cluster by the node resolver.
198+
When not specified, only the default image registry service is resolvable.
199+
Services in this list will be added in addition to the default "image-registry.openshift-image-registry.svc" service.
200+
The default image registry service cannot be removed.
201+
For each service reference, entries will be created using the format "<name>.<namespace>.svc"
202+
and an alias with the CLUSTER_DOMAIN suffix of cluster.local will also be added.
203+
items:
204+
description: DNSNodeService represents a Kubernetes service by name
205+
and namespace for node services.
206+
properties:
207+
name:
208+
description: |-
209+
name is the name of the service.
210+
The name should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
211+
and should start with an alphabetic character and end with an alphanumeric character.
212+
maxLength: 63
213+
minLength: 1
214+
type: string
215+
x-kubernetes-validations:
216+
- message: a DNS-1035 label must consist of lower case alphanumeric
217+
characters or '-', start with an alphabetic character, and
218+
end with an alphanumeric character
219+
rule: '!format.dns1035Label().validate(self).hasValue()'
220+
namespace:
221+
description: |-
222+
namespace is the namespace of the service.
223+
The namespace should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
224+
and should start and end with an alphanumeric character.
225+
maxLength: 63
226+
minLength: 1
227+
type: string
228+
x-kubernetes-validations:
229+
- message: the value must consist of only lowercase alphanumeric
230+
characters and hyphens
231+
rule: '!format.dns1123Label().validate(self).hasValue()'
232+
required:
233+
- name
234+
- namespace
235+
type: object
236+
maxItems: 20
237+
minItems: 1
238+
type: array
239+
x-kubernetes-list-map-keys:
240+
- name
241+
- namespace
242+
x-kubernetes-list-type: map
194243
operatorLogLevel:
195244
default: Normal
196245
description: |-

operator/v1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/v1/zz_generated.featuregated-crd-manifests/dnses.operator.openshift.io/AAA_ungated.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,55 @@ spec:
192192
type: object
193193
type: array
194194
type: object
195+
nodeServices:
196+
description: |-
197+
nodeServices specifies a list of service objects for which host level resolvable entries should be added.
198+
Services in this list will be added to /etc/hosts on each node in the cluster by the node resolver.
199+
When not specified, only the default image registry service is resolvable.
200+
Services in this list will be added in addition to the default "image-registry.openshift-image-registry.svc" service.
201+
The default image registry service cannot be removed.
202+
For each service reference, entries will be created using the format "<name>.<namespace>.svc"
203+
and an alias with the CLUSTER_DOMAIN suffix of cluster.local will also be added.
204+
items:
205+
description: DNSNodeService represents a Kubernetes service by name
206+
and namespace for node services.
207+
properties:
208+
name:
209+
description: |-
210+
name is the name of the service.
211+
The name should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
212+
and should start with an alphabetic character and end with an alphanumeric character.
213+
maxLength: 63
214+
minLength: 1
215+
type: string
216+
x-kubernetes-validations:
217+
- message: a DNS-1035 label must consist of lower case alphanumeric
218+
characters or '-', start with an alphabetic character, and
219+
end with an alphanumeric character
220+
rule: '!format.dns1035Label().validate(self).hasValue()'
221+
namespace:
222+
description: |-
223+
namespace is the namespace of the service.
224+
The namespace should consist of at most 63 characters, and of only lowercase alphanumeric characters and hyphens,
225+
and should start and end with an alphanumeric character.
226+
maxLength: 63
227+
minLength: 1
228+
type: string
229+
x-kubernetes-validations:
230+
- message: the value must consist of only lowercase alphanumeric
231+
characters and hyphens
232+
rule: '!format.dns1123Label().validate(self).hasValue()'
233+
required:
234+
- name
235+
- namespace
236+
type: object
237+
maxItems: 20
238+
minItems: 1
239+
type: array
240+
x-kubernetes-list-map-keys:
241+
- name
242+
- namespace
243+
x-kubernetes-list-type: map
195244
operatorLogLevel:
196245
default: Normal
197246
description: |-

0 commit comments

Comments
 (0)