Skip to content

Commit 3ccef73

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 (IngressControllerTuningOptions): 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.swagger_doc_generated.go: Regenerate.
1 parent c9c9ac0 commit 3ccef73

11 files changed

Lines changed: 16717 additions & 1 deletion

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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,42 @@ type IngressControllerTuningOptions struct {
20682068
// +kubebuilder:validation:Type:=string
20692069
// +optional
20702070
ReloadInterval metav1.Duration `json:"reloadInterval,omitempty"`
2071+
2072+
// dynamicConfigManager specifies whether OpenShift router should update
2073+
// HAProxy using its control socket for some configuration updates,
2074+
// instead of rewriting the HAProxy configuration file and instructing
2075+
// HAProxy to fork and reload. Enabling this option can improve
2076+
// load-balancing fairness and metrics accuracy and reduce CPU and
2077+
// memory usage if HAProxy has frequent configuration updates for route
2078+
// and endpoints updates.
2079+
//
2080+
// Note: This feature is currently experimental and should not be
2081+
// enabled on production clusters.
2082+
//
2083+
// The following values are valid for this field:
2084+
//
2085+
// * The empty string.
2086+
// * "Enabled".
2087+
// * "Disabled".
2088+
//
2089+
// The empty string specifies the default, which is "Disabled". Note
2090+
// that the default is subject to change.
2091+
// +openshift:enable:FeatureGate=IngressControllerDynamicConfigurationManager
2092+
// +optional
2093+
DynamicConfigurationManager IngressControllerDynamicConfigurationManager `json:"dynamicConfigManager,omitzero"`
20712094
}
20722095

2096+
// IngressControllerDynamicConfigurationManager specifies whether the Dynamic
2097+
// Configuration Manager is enabled or not.
2098+
// +kubebuilder:validation:Enum="";Enabled;Disabled
2099+
type IngressControllerDynamicConfigurationManager string
2100+
2101+
const (
2102+
IngressControllerDynamicConfigurationManagerDefault IngressControllerDynamicConfigurationManager = ""
2103+
IngressControllerDynamicConfigurationManagerEnabled IngressControllerDynamicConfigurationManager = "Enabled"
2104+
IngressControllerDynamicConfigurationManagerDisabled IngressControllerDynamicConfigurationManager = "Disabled"
2105+
)
2106+
20732107
// HTTPEmptyRequestsPolicy indicates how HTTP connections for which no request
20742108
// is received should be handled.
20752109
// +kubebuilder:validation:Enum=Respond;Ignore

0 commit comments

Comments
 (0)