Skip to content

Commit 03ec7f2

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 03ec7f2

11 files changed

+16753
-1
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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+
tests:
5+
onCreate:
6+
- name: Should be able to enable the Dynamic Configuration Manager
7+
initial: |
8+
apiVersion: operator.openshift.io/v1
9+
kind: IngressController
10+
metadata:
11+
name: default
12+
namespace: openshift-ingress-operator
13+
spec:
14+
tuningOptions:
15+
dynamicConfigManager: Enabled
16+
expected: |
17+
apiVersion: operator.openshift.io/v1
18+
kind: IngressController
19+
metadata:
20+
name: default
21+
namespace: openshift-ingress-operator
22+
spec:
23+
httpEmptyRequestsPolicy: Respond
24+
idleConnectionTerminationPolicy: Immediate
25+
closedClientConnectionPolicy: Continue
26+
tuningOptions:
27+
dynamicConfigManager: Enabled
28+
- name: Should be able to disable the Dynamic Configuration Manager
29+
initial: |
30+
apiVersion: operator.openshift.io/v1
31+
kind: IngressController
32+
metadata:
33+
name: default
34+
namespace: openshift-ingress-operator
35+
spec:
36+
tuningOptions:
37+
dynamicConfigManager: Disabled
38+
expected: |
39+
apiVersion: operator.openshift.io/v1
40+
kind: IngressController
41+
metadata:
42+
name: default
43+
namespace: openshift-ingress-operator
44+
spec:
45+
httpEmptyRequestsPolicy: Respond
46+
idleConnectionTerminationPolicy: Immediate
47+
closedClientConnectionPolicy: Continue
48+
tuningOptions:
49+
dynamicConfigManager: Disabled
50+
- name: Should be able to specify no preference for enabling DCM
51+
initial: |
52+
apiVersion: operator.openshift.io/v1
53+
kind: IngressController
54+
metadata:
55+
name: default
56+
namespace: openshift-ingress-operator
57+
spec:
58+
tuningOptions:
59+
dynamicConfigManager: ""
60+
expected: |
61+
apiVersion: operator.openshift.io/v1
62+
kind: IngressController
63+
metadata:
64+
name: default
65+
namespace: openshift-ingress-operator
66+
spec:
67+
httpEmptyRequestsPolicy: Respond
68+
idleConnectionTerminationPolicy: Immediate
69+
closedClientConnectionPolicy: Continue
70+
- name: Should not be able to specify a garbage value for DCM
71+
initial: |
72+
apiVersion: operator.openshift.io/v1
73+
kind: IngressController
74+
metadata:
75+
name: default
76+
namespace: openshift-ingress-operator
77+
spec:
78+
tuningOptions:
79+
dynamicConfigManager: garbage
80+
expectedError: 'IngressController.operator.openshift.io "default" is invalid: spec.tuningOptions.dynamicConfigManager: Unsupported value: "garbage": supported values: "Enabled", "Disabled", <nil>'
81+
onUpdate:
82+
- name: Should be able to enable DCM when currently no preference is specified
83+
initial: |
84+
apiVersion: operator.openshift.io/v1
85+
kind: IngressController
86+
metadata:
87+
name: default
88+
namespace: openshift-ingress-operator
89+
spec:
90+
httpEmptyRequestsPolicy: Respond
91+
idleConnectionTerminationPolicy: Immediate
92+
closedClientConnectionPolicy: Continue
93+
tuningOptions:
94+
dynamicConfigManager: ""
95+
updated: |
96+
apiVersion: operator.openshift.io/v1
97+
kind: IngressController
98+
metadata:
99+
name: default
100+
namespace: openshift-ingress-operator
101+
spec:
102+
httpEmptyRequestsPolicy: Respond
103+
idleConnectionTerminationPolicy: Immediate
104+
closedClientConnectionPolicy: Continue
105+
tuningOptions:
106+
dynamicConfigManager: Enabled
107+
expected: |
108+
apiVersion: operator.openshift.io/v1
109+
kind: IngressController
110+
metadata:
111+
name: default
112+
namespace: openshift-ingress-operator
113+
spec:
114+
httpEmptyRequestsPolicy: Respond
115+
idleConnectionTerminationPolicy: Immediate
116+
closedClientConnectionPolicy: Continue
117+
tuningOptions:
118+
dynamicConfigManager: Enabled
119+
- name: Should be able to turn DCM off when it is enabled
120+
initial: |
121+
apiVersion: operator.openshift.io/v1
122+
kind: IngressController
123+
metadata:
124+
name: default
125+
namespace: openshift-ingress-operator
126+
spec:
127+
httpEmptyRequestsPolicy: Respond
128+
idleConnectionTerminationPolicy: Immediate
129+
closedClientConnectionPolicy: Continue
130+
tuningOptions:
131+
dynamicConfigManager: Enabled
132+
updated: |
133+
apiVersion: operator.openshift.io/v1
134+
kind: IngressController
135+
metadata:
136+
name: default
137+
namespace: openshift-ingress-operator
138+
spec:
139+
httpEmptyRequestsPolicy: Respond
140+
idleConnectionTerminationPolicy: Immediate
141+
closedClientConnectionPolicy: Continue
142+
tuningOptions:
143+
dynamicConfigManager: Disabled
144+
expected: |
145+
apiVersion: operator.openshift.io/v1
146+
kind: IngressController
147+
metadata:
148+
name: default
149+
namespace: openshift-ingress-operator
150+
spec:
151+
httpEmptyRequestsPolicy: Respond
152+
idleConnectionTerminationPolicy: Immediate
153+
closedClientConnectionPolicy: Continue
154+
tuningOptions:
155+
dynamicConfigManager: Disabled

operator/v1/types_ingress.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,41 @@ 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+
DynamicConfigurationManager IngressControllerDynamicConfigurationManager `json:"dynamicConfigManager,omitempty"`
20712093
}
20722094

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

0 commit comments

Comments
 (0)