Skip to content

Commit 6a8c07c

Browse files
committed
operator/ingress: Add configurationManagement
This option can be used to enable OpenShift router's Dynamic Configuration Manager. This feature is currently experimental, and it is not enabled by default; the default may change in later release. This commit implements NE-2512. https://issues.redhat.com/browse/NE-2512 * operator/v1/types_ingress.go (IngressControllerTuningOptions): Add a new configurationManagement field with type IngressControllerConfigurationManagement. (IngressControllerConfigurationManagement): New type. (IngressControllerConfigurationManagementDynamic) (IngressControllerConfigurationManagementForkAndReload): New consts for the allowed values for the IngressControllerConfigurationManagement type. * operator/v1/tests/ingresscontrollers.operator.openshift.io/IngressControllerDynamicConfigurationManager.yaml: New file. Add tests for setting configurationManagement when creating a new ingresscontroller resource or changing or unsetting the field when updating an existing ingresscontroller resource. * openapi/generated_openapi/zz_generated.openapi.go: * operator/v1/zz_generated.crd-manifests/*: * operator/v1/zz_generated.featuregated-crd-manifests.yaml: * operator/v1/zz_generated.featuregated-crd-manifests/*: * operator/v1/zz_generated.swagger_doc_generated.go: Regenerate.
1 parent c9c9ac0 commit 6a8c07c

11 files changed

+16784
-1
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: IngressController
3+
crdName: ingresscontrollers.operator.openshift.io
4+
featureGates:
5+
- IngressControllerDynamicConfigurationManager
6+
tests:
7+
onCreate:
8+
- name: Should be able to enable the Dynamic Configuration Manager
9+
initial: |
10+
apiVersion: operator.openshift.io/v1
11+
kind: IngressController
12+
metadata:
13+
name: default
14+
namespace: openshift-ingress-operator
15+
spec:
16+
tuningOptions:
17+
configurationManagement: Dynamic
18+
expected: |
19+
apiVersion: operator.openshift.io/v1
20+
kind: IngressController
21+
metadata:
22+
name: default
23+
namespace: openshift-ingress-operator
24+
spec:
25+
httpEmptyRequestsPolicy: Respond
26+
idleConnectionTerminationPolicy: Immediate
27+
closedClientConnectionPolicy: Continue
28+
tuningOptions:
29+
configurationManagement: Dynamic
30+
- name: Should be able to disable the Dynamic Configuration Manager
31+
initial: |
32+
apiVersion: operator.openshift.io/v1
33+
kind: IngressController
34+
metadata:
35+
name: default
36+
namespace: openshift-ingress-operator
37+
spec:
38+
tuningOptions:
39+
configurationManagement: ForkAndReload
40+
expected: |
41+
apiVersion: operator.openshift.io/v1
42+
kind: IngressController
43+
metadata:
44+
name: default
45+
namespace: openshift-ingress-operator
46+
spec:
47+
httpEmptyRequestsPolicy: Respond
48+
idleConnectionTerminationPolicy: Immediate
49+
closedClientConnectionPolicy: Continue
50+
tuningOptions:
51+
configurationManagement: ForkAndReload
52+
- name: Should not be able to specify a garbage value for DCM
53+
initial: |
54+
apiVersion: operator.openshift.io/v1
55+
kind: IngressController
56+
metadata:
57+
name: default
58+
namespace: openshift-ingress-operator
59+
spec:
60+
tuningOptions:
61+
configurationManagement: garbage
62+
expectedError: 'Unsupported value: "garbage": supported values: "Dynamic", "ForkAndReload"'
63+
onUpdate:
64+
- name: Should be able to enable DCM when currently no preference is specified
65+
initial: |
66+
apiVersion: operator.openshift.io/v1
67+
kind: IngressController
68+
metadata:
69+
name: default
70+
namespace: openshift-ingress-operator
71+
spec:
72+
httpEmptyRequestsPolicy: Respond
73+
idleConnectionTerminationPolicy: Immediate
74+
closedClientConnectionPolicy: Continue
75+
updated: |
76+
apiVersion: operator.openshift.io/v1
77+
kind: IngressController
78+
metadata:
79+
name: default
80+
namespace: openshift-ingress-operator
81+
spec:
82+
httpEmptyRequestsPolicy: Respond
83+
idleConnectionTerminationPolicy: Immediate
84+
closedClientConnectionPolicy: Continue
85+
tuningOptions:
86+
configurationManagement: Dynamic
87+
expected: |
88+
apiVersion: operator.openshift.io/v1
89+
kind: IngressController
90+
metadata:
91+
name: default
92+
namespace: openshift-ingress-operator
93+
spec:
94+
httpEmptyRequestsPolicy: Respond
95+
idleConnectionTerminationPolicy: Immediate
96+
closedClientConnectionPolicy: Continue
97+
tuningOptions:
98+
configurationManagement: Dynamic
99+
- name: Should be able to turn DCM off when it is enabled
100+
initial: |
101+
apiVersion: operator.openshift.io/v1
102+
kind: IngressController
103+
metadata:
104+
name: default
105+
namespace: openshift-ingress-operator
106+
spec:
107+
httpEmptyRequestsPolicy: Respond
108+
idleConnectionTerminationPolicy: Immediate
109+
closedClientConnectionPolicy: Continue
110+
tuningOptions:
111+
configurationManagement: Dynamic
112+
updated: |
113+
apiVersion: operator.openshift.io/v1
114+
kind: IngressController
115+
metadata:
116+
name: default
117+
namespace: openshift-ingress-operator
118+
spec:
119+
httpEmptyRequestsPolicy: Respond
120+
idleConnectionTerminationPolicy: Immediate
121+
closedClientConnectionPolicy: Continue
122+
expected: |
123+
apiVersion: operator.openshift.io/v1
124+
kind: IngressController
125+
metadata:
126+
name: default
127+
namespace: openshift-ingress-operator
128+
spec:
129+
httpEmptyRequestsPolicy: Respond
130+
idleConnectionTerminationPolicy: Immediate
131+
closedClientConnectionPolicy: Continue
132+
- name: Should be able to set no preference when DCM is enabled
133+
initial: |
134+
apiVersion: operator.openshift.io/v1
135+
kind: IngressController
136+
metadata:
137+
name: default
138+
namespace: openshift-ingress-operator
139+
spec:
140+
httpEmptyRequestsPolicy: Respond
141+
idleConnectionTerminationPolicy: Immediate
142+
closedClientConnectionPolicy: Continue
143+
tuningOptions:
144+
configurationManagement: Dynamic
145+
updated: |
146+
apiVersion: operator.openshift.io/v1
147+
kind: IngressController
148+
metadata:
149+
name: default
150+
namespace: openshift-ingress-operator
151+
spec:
152+
httpEmptyRequestsPolicy: Respond
153+
idleConnectionTerminationPolicy: Immediate
154+
closedClientConnectionPolicy: Continue
155+
expected: |
156+
apiVersion: operator.openshift.io/v1
157+
kind: IngressController
158+
metadata:
159+
name: default
160+
namespace: openshift-ingress-operator
161+
spec:
162+
httpEmptyRequestsPolicy: Respond
163+
idleConnectionTerminationPolicy: Immediate
164+
closedClientConnectionPolicy: Continue
165+
- name: Should be able to set no preference when DCM is disabled
166+
initial: |
167+
apiVersion: operator.openshift.io/v1
168+
kind: IngressController
169+
metadata:
170+
name: default
171+
namespace: openshift-ingress-operator
172+
spec:
173+
httpEmptyRequestsPolicy: Respond
174+
idleConnectionTerminationPolicy: Immediate
175+
closedClientConnectionPolicy: Continue
176+
tuningOptions:
177+
configurationManagement: ForkAndReload
178+
updated: |
179+
apiVersion: operator.openshift.io/v1
180+
kind: IngressController
181+
metadata:
182+
name: default
183+
namespace: openshift-ingress-operator
184+
spec:
185+
httpEmptyRequestsPolicy: Respond
186+
idleConnectionTerminationPolicy: Immediate
187+
closedClientConnectionPolicy: Continue
188+
expected: |
189+
apiVersion: operator.openshift.io/v1
190+
kind: IngressController
191+
metadata:
192+
name: default
193+
namespace: openshift-ingress-operator
194+
spec:
195+
httpEmptyRequestsPolicy: Respond
196+
idleConnectionTerminationPolicy: Immediate
197+
closedClientConnectionPolicy: Continue

operator/v1/types_ingress.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,51 @@ type IngressControllerTuningOptions struct {
20682068
// +kubebuilder:validation:Type:=string
20692069
// +optional
20702070
ReloadInterval metav1.Duration `json:"reloadInterval,omitempty"`
2071+
2072+
// configurationManagement specifies how OpenShift router should update
2073+
// the HAProxy configuration. The following values are valid for this
2074+
// field:
2075+
//
2076+
// * "ForkAndReload".
2077+
// * "Dynamic".
2078+
//
2079+
// Omitting this field means that the user has no opinion and the
2080+
// platform may choose a reasonable default. This default is subject to
2081+
// change over time. The current default is "ForkAndReload".
2082+
//
2083+
// "ForkAndReload" means that OpenShift router should rewrite the
2084+
// HAProxy configuration file and instruct HAProxy to fork and reload.
2085+
// This is OpenShift router's traditional approach.
2086+
//
2087+
// "Dynamic" means that OpenShift router may use HAProxy's control
2088+
// socket for some configuration updates and fall back to fork and
2089+
// reload for other configuration updates. This is a newer approach,
2090+
// which may be less mature than ForkAndReload. This setting can
2091+
// improve load-balancing fairness and metrics accuracy and reduce CPU
2092+
// and memory usage if HAProxy has frequent configuration updates for
2093+
// route and endpoints updates.
2094+
//
2095+
// Note: The "Dynamic" option is currently experimental and should not
2096+
// be enabled on production clusters.
2097+
//
2098+
// +openshift:enable:FeatureGate=IngressControllerDynamicConfigurationManager
2099+
// +optional
2100+
ConfigurationManagement IngressControllerConfigurationManagement `json:"configurationManagement,omitempty"`
20712101
}
20722102

2103+
// IngressControllerConfigurationManagement specifies whether always to use
2104+
// fork-and-reload to update the HAProxy configuration or whether to use
2105+
// HAProxy's control socket for some configuration updates.
2106+
//
2107+
// +enum
2108+
// +kubebuilder:validation:Enum=Dynamic;ForkAndReload
2109+
type IngressControllerConfigurationManagement string
2110+
2111+
const (
2112+
IngressControllerConfigurationManagementDynamic IngressControllerConfigurationManagement = "Dynamic"
2113+
IngressControllerConfigurationManagementForkAndReload IngressControllerConfigurationManagement = "ForkAndReload"
2114+
)
2115+
20732116
// HTTPEmptyRequestsPolicy indicates how HTTP connections for which no request
20742117
// is received should be handled.
20752118
// +kubebuilder:validation:Enum=Respond;Ignore

0 commit comments

Comments
 (0)