Skip to content

Commit 21dcb63

Browse files
committed
operator/ingress: Add dynamicConfigManager option
This option enables OpenShift router's Dynamic Configuration Manager. This option 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 (IngressControllerSpec): Add omitzero to the tuningOptions field to avoid 'Invalid value: "null"' errors in integration tests. (IngressControllerTuningOptions): Add MinProperties=1 so that integration tests pass. Add a new dynamicConfigManager field with type IngressControllerDynamicConfigurationManager. (IngressControllerDynamicConfigurationManager): New type. (IngressControllerDynamicConfigurationManagerDefault) (IngressControllerDynamicConfigurationManagerEnabled) (IngressControllerDynamicConfigurationManagerDisabled): New consts for the allowed values for the IngressControllerDynamicConfigurationManager type. * operator/v1/tests/ingresscontrollers.operator.openshift.io/IngressControllerDynamicConfigurationManager.yaml: New file. Add tests for setting dynamicConfigManager to Enabled or Disabled on a new or updated 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 21dcb63

12 files changed

Lines changed: 16730 additions & 2 deletions

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: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "Ingress"
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+
dynamicConfigManager: Enabled
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+
dynamicConfigManager: Enabled
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+
dynamicConfigManager: Disabled
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+
dynamicConfigManager: Disabled
52+
- name: Should be able to specify no preference for enabling 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+
dynamicConfigManager: ""
62+
expected: |
63+
apiVersion: operator.openshift.io/v1
64+
kind: IngressController
65+
metadata:
66+
name: default
67+
namespace: openshift-ingress-operator
68+
spec:
69+
httpEmptyRequestsPolicy: Respond
70+
idleConnectionTerminationPolicy: Immediate
71+
closedClientConnectionPolicy: Continue
72+
tuningOptions:
73+
dynamicConfigManager: ""
74+
- name: Should not be able to specify a garbage value for DCM
75+
initial: |
76+
apiVersion: operator.openshift.io/v1
77+
kind: IngressController
78+
metadata:
79+
name: default
80+
namespace: openshift-ingress-operator
81+
spec:
82+
tuningOptions:
83+
dynamicConfigManager: garbage
84+
expectedError: 'IngressController.operator.openshift.io "default" is invalid: spec.tuningOptions.dynamicConfigManager: Unsupported value: "garbage": supported values: "", "Enabled", "Disabled", <nil>'
85+
onUpdate:
86+
- name: Should be able to enable DCM when currently no preference is specified
87+
initial: |
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+
dynamicConfigManager: ""
99+
updated: |
100+
apiVersion: operator.openshift.io/v1
101+
kind: IngressController
102+
metadata:
103+
name: default
104+
namespace: openshift-ingress-operator
105+
spec:
106+
httpEmptyRequestsPolicy: Respond
107+
idleConnectionTerminationPolicy: Immediate
108+
closedClientConnectionPolicy: Continue
109+
tuningOptions:
110+
dynamicConfigManager: Enabled
111+
expected: |
112+
apiVersion: operator.openshift.io/v1
113+
kind: IngressController
114+
metadata:
115+
name: default
116+
namespace: openshift-ingress-operator
117+
spec:
118+
httpEmptyRequestsPolicy: Respond
119+
idleConnectionTerminationPolicy: Immediate
120+
closedClientConnectionPolicy: Continue
121+
tuningOptions:
122+
dynamicConfigManager: Enabled
123+
- name: Should be able to turn DCM off when it is enabled
124+
initial: |
125+
apiVersion: operator.openshift.io/v1
126+
kind: IngressController
127+
metadata:
128+
name: default
129+
namespace: openshift-ingress-operator
130+
spec:
131+
httpEmptyRequestsPolicy: Respond
132+
idleConnectionTerminationPolicy: Immediate
133+
closedClientConnectionPolicy: Continue
134+
tuningOptions:
135+
dynamicConfigManager: Enabled
136+
updated: |
137+
apiVersion: operator.openshift.io/v1
138+
kind: IngressController
139+
metadata:
140+
name: default
141+
namespace: openshift-ingress-operator
142+
spec:
143+
httpEmptyRequestsPolicy: Respond
144+
idleConnectionTerminationPolicy: Immediate
145+
closedClientConnectionPolicy: Continue
146+
tuningOptions:
147+
dynamicConfigManager: Disabled
148+
expected: |
149+
apiVersion: operator.openshift.io/v1
150+
kind: IngressController
151+
metadata:
152+
name: default
153+
namespace: openshift-ingress-operator
154+
spec:
155+
httpEmptyRequestsPolicy: Respond
156+
idleConnectionTerminationPolicy: Immediate
157+
closedClientConnectionPolicy: Continue
158+
tuningOptions:
159+
dynamicConfigManager: Disabled

operator/v1/types_ingress.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ type IngressControllerSpec struct {
260260
// default values are suitable for most configurations.
261261
//
262262
// +optional
263-
TuningOptions IngressControllerTuningOptions `json:"tuningOptions,omitempty"`
263+
TuningOptions IngressControllerTuningOptions `json:"tuningOptions,omitempty,omitzero"`
264264

265265
// unsupportedConfigOverrides allows specifying unsupported
266266
// configuration options. Its use is unsupported.
@@ -1813,6 +1813,8 @@ type IngressControllerSetHTTPHeader struct {
18131813

18141814
// IngressControllerTuningOptions specifies options for tuning the performance
18151815
// of ingress controller pods
1816+
//
1817+
// +kubebuilder:validation:MinProperties=1
18161818
type IngressControllerTuningOptions struct {
18171819
// headerBufferBytes describes how much memory should be reserved
18181820
// (in bytes) for IngressController connection sessions.
@@ -2068,8 +2070,45 @@ type IngressControllerTuningOptions struct {
20682070
// +kubebuilder:validation:Type:=string
20692071
// +optional
20702072
ReloadInterval metav1.Duration `json:"reloadInterval,omitempty"`
2073+
2074+
// dynamicConfigManager specifies whether OpenShift router should update
2075+
// HAProxy using its control socket for some configuration updates,
2076+
// instead of rewriting the HAProxy configuration file and instructing
2077+
// HAProxy to fork and reload. Enabling this option can improve
2078+
// load-balancing fairness and metrics accuracy and reduce CPU and
2079+
// memory usage if HAProxy has frequent configuration updates for route
2080+
// and endpoints updates.
2081+
//
2082+
// Note: This feature is currently experimental and should not be
2083+
// enabled on production clusters.
2084+
//
2085+
// The following values are valid for this field:
2086+
//
2087+
// * The empty string.
2088+
// * "Enabled".
2089+
// * "Disabled".
2090+
//
2091+
// The empty string specifies the default, which is "Disabled". Note
2092+
// that the default is subject to change.
2093+
//
2094+
// +openshift:enable:FeatureGate=IngressControllerDynamicConfigurationManager
2095+
// +optional
2096+
DynamicConfigurationManager IngressControllerDynamicConfigurationManager `json:"dynamicConfigManager,omitempty"`
20712097
}
20722098

2099+
// IngressControllerDynamicConfigurationManager specifies whether the Dynamic
2100+
// Configuration Manager is enabled or not.
2101+
//
2102+
// +enum
2103+
// +kubebuilder:validation:Enum="";Enabled;Disabled
2104+
type IngressControllerDynamicConfigurationManager string
2105+
2106+
const (
2107+
IngressControllerDynamicConfigurationManagerDefault IngressControllerDynamicConfigurationManager = ""
2108+
IngressControllerDynamicConfigurationManagerEnabled IngressControllerDynamicConfigurationManager = "Enabled"
2109+
IngressControllerDynamicConfigurationManagerDisabled IngressControllerDynamicConfigurationManager = "Disabled"
2110+
)
2111+
20732112
// HTTPEmptyRequestsPolicy indicates how HTTP connections for which no request
20742113
// is received should be handled.
20752114
// +kubebuilder:validation:Enum=Respond;Ignore

0 commit comments

Comments
 (0)