Skip to content

Commit 4863cfa

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

File tree

7 files changed

+193
-1
lines changed

7 files changed

+193
-1
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 46 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: 28 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.",
28814+
"type": "string",
28815+
"default": ""
28816+
},
28817+
"namespace": {
28818+
"description": "namespace is the namespace of the service.",
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,14 @@
2884228862
"default": {},
2884328863
"$ref": "#/definitions/com.github.openshift.api.operator.v1.DNSNodePlacement"
2884428864
},
28865+
"nodeServices": {
28866+
"description": "nodeServices specifies K8s services for which entries should be added to /etc/hosts by the node resolver. These services will be added in addition to the default \"image-registry.openshift-image-registry.svc\" service. For each service reference, entries will be created using the format \"<name>.<namespace>.svc\" and an alias with the CLUSTER_DOMAIN suffix will also be added.",
28867+
"type": "array",
28868+
"items": {
28869+
"default": {},
28870+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.DNSNodeService"
28871+
}
28872+
},
2884528873
"operatorLogLevel": {
2884628874
"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.",
2884728875
"type": "string"

operator/v1/types_dns.go

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

98+
// nodeServices specifies K8s services for which entries should be added
99+
// to /etc/hosts by the node resolver. These services will be added in addition to
100+
// the default "image-registry.openshift-image-registry.svc" service.
101+
// For each service reference, entries will be created using the format "<name>.<namespace>.svc"
102+
// and an alias with the CLUSTER_DOMAIN suffix will also be added.
103+
//
104+
// +optional
105+
// +kubebuilder:validation:MaxItems=20
106+
NodeServices []DNSNodeService `json:"nodeServices,omitempty"`
107+
98108
// logLevel describes the desired logging verbosity for CoreDNS.
99109
// Any one of the following values may be specified:
100110
// * Normal logs errors from upstream resolvers.
@@ -163,6 +173,25 @@ var (
163173
DNSLogLevelTrace DNSLogLevel = "Trace"
164174
)
165175

176+
// DNSNodeService represents a Kubernetes service by name and namespace for node services.
177+
type DNSNodeService struct {
178+
// name is the name of the service.
179+
// +required
180+
// +kubebuilder:validation:Required
181+
// +kubebuilder:validation:MinLength=1
182+
// +kubebuilder:validation:MaxLength=63
183+
// +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
184+
Name string `json:"name"`
185+
186+
// namespace is the namespace of the service.
187+
// +required
188+
// +kubebuilder:validation:Required
189+
// +kubebuilder:validation:MinLength=1
190+
// +kubebuilder:validation:MaxLength=63
191+
// +kubebuilder:validation:Pattern=`^[a-z]([-a-z0-9]*[a-z0-9])?$`
192+
Namespace string `json:"namespace"`
193+
}
194+
166195
// Server defines the schema for a server that runs per instance of CoreDNS.
167196
type Server struct {
168197
// 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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,35 @@ spec:
191191
type: object
192192
type: array
193193
type: object
194+
nodeServices:
195+
description: |-
196+
nodeServices specifies K8s services for which entries should be added
197+
to /etc/hosts by the node resolver. These services will be added in addition to
198+
the default "image-registry.openshift-image-registry.svc" service.
199+
For each service reference, entries will be created using the format "<name>.<namespace>.svc"
200+
and an alias with the CLUSTER_DOMAIN suffix will also be added.
201+
items:
202+
description: DNSNodeService represents a Kubernetes service by name
203+
and namespace for node services.
204+
properties:
205+
name:
206+
description: name is the name of the service.
207+
maxLength: 63
208+
minLength: 1
209+
pattern: ^[a-z]([-a-z0-9]*[a-z0-9])?$
210+
type: string
211+
namespace:
212+
description: namespace is the namespace of the service.
213+
maxLength: 63
214+
minLength: 1
215+
pattern: ^[a-z]([-a-z0-9]*[a-z0-9])?$
216+
type: string
217+
required:
218+
- name
219+
- namespace
220+
type: object
221+
maxItems: 20
222+
type: array
194223
operatorLogLevel:
195224
default: Normal
196225
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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,35 @@ spec:
192192
type: object
193193
type: array
194194
type: object
195+
nodeServices:
196+
description: |-
197+
nodeServices specifies K8s services for which entries should be added
198+
to /etc/hosts by the node resolver. These services will be added in addition to
199+
the default "image-registry.openshift-image-registry.svc" service.
200+
For each service reference, entries will be created using the format "<name>.<namespace>.svc"
201+
and an alias with the CLUSTER_DOMAIN suffix will also be added.
202+
items:
203+
description: DNSNodeService represents a Kubernetes service by name
204+
and namespace for node services.
205+
properties:
206+
name:
207+
description: name is the name of the service.
208+
maxLength: 63
209+
minLength: 1
210+
pattern: ^[a-z]([-a-z0-9]*[a-z0-9])?$
211+
type: string
212+
namespace:
213+
description: namespace is the namespace of the service.
214+
maxLength: 63
215+
minLength: 1
216+
pattern: ^[a-z]([-a-z0-9]*[a-z0-9])?$
217+
type: string
218+
required:
219+
- name
220+
- namespace
221+
type: object
222+
maxItems: 20
223+
type: array
195224
operatorLogLevel:
196225
default: Normal
197226
description: |-

operator/v1/zz_generated.swagger_doc_generated.go

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

0 commit comments

Comments
 (0)