@@ -45,7 +45,7 @@ components that make up the project, but exceptions are allowed when necessary.
45
45
46
46
The conventions are intended to help with consistency across the project. Users
47
47
of the platform expect consistency in the experience and operation of the cluster.
48
- Developers of the platform expect consistency in the code to quickly identify issuses
48
+ Developers of the platform expect consistency in the code to quickly identify issues
49
49
across codebases. Consistency enables shared understanding, simplifies explanations,
50
50
and reduces accidental complexity.
51
51
@@ -85,3 +85,86 @@ metal3-io](https://github.com/metal3-io/metal3-docs/blob/master/design/bare-meta
85
85
### API
86
86
87
87
OpenShift APIs follow the [ Kubernetes API conventions] ( https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md ) .
88
+
89
+ ### Operators
90
+
91
+ The OpenShift project is an early adopter of, and makes extensive use of, [ the
92
+ operator pattern] ( https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ ) ,
93
+ and so it is incumbent on us to establish some conventions around operators.
94
+
95
+ #### Taints and Tolerations
96
+
97
+ An operator deployed by the CVO should run on master nodes and therefore should
98
+ tolerate the following taint:
99
+
100
+ * ` node-role.kubernetes.io/master `
101
+
102
+ For example:
103
+
104
+ ``` yaml
105
+ spec :
106
+ template :
107
+ spec :
108
+ tolerations :
109
+ - key : node-role.kubernetes.io/master
110
+ operator : Exists
111
+ effect : NoSchedule
112
+ ` ` `
113
+
114
+ Tolerating this taint should suffice for the vast majority of core OpenShift
115
+ operators. In exceptional cases, an operator may tolerate one or more of the
116
+ following taints if doing so is necessary to form a functional Kubernetes node:
117
+
118
+ * ` node.kubernetes.io/disk-pressure`
119
+ * `node.kubernetes.io/memory-pressure`
120
+ * `node.kubernetes.io/network-unavailable`
121
+ * `node.kubernetes.io/not-ready`
122
+ * `node.kubernetes.io/pid-pressure`
123
+ * `node.kubernetes.io/unreachable`
124
+
125
+ Operators should not specify tolerations in their manifests for any of the taints in
126
+ the above list without an explicit and credible justification.
127
+
128
+ When an operator configures its operand, the operator likewise may specify
129
+ tolerations for the aforementioned taints but should do so only as necessary and only
130
+ with explicit justification.
131
+
132
+ Note that the DefaultTolerationSeconds and PodTolerationRestriction admission plugins
133
+ may add time-bound tolerations to an operator or operand in addition to the
134
+ tolerations that the operator has specified.
135
+
136
+ If appropriate, a CRD that corresponds to an operand may provide an API to allow
137
+ users to specify a custom list of tolerations for that operand. For examples, see
138
+ the
139
+ [imagepruners.imageregistry.operator.openshift.io/v1](https://github.com/openshift/api/blob/34f54f12813aaed8822bb5bc56e97cbbfa92171d/imageregistry/v1/types_imagepruner.go#L67-L69),
140
+ [configs.imageregistry.operator.openshift.io/v1](https://github.com/openshift/api/blob/34f54f12813aaed8822bb5bc56e97cbbfa92171d/imageregistry/v1/types.go#L82-L84),
141
+ [builds.config.openshift.io/v1](https://github.com/openshift/api/blob/34f54f12813aaed8822bb5bc56e97cbbfa92171d/config/v1/types_build.go#L96-L99),
142
+ and
143
+ [ingresscontrollers.operator.openshift.io/v1](https://github.com/openshift/api/blob/34f54f12813aaed8822bb5bc56e97cbbfa92171d/operator/v1/types_ingress.go#L183-L191)
144
+ APIs.
145
+
146
+ In exceptional cases, an operand may tolerate all taints :
147
+
148
+ * if the operand is required to form a functional Kubernetes node, or
149
+ * if the operand is required to support workloads sourced from an internal or external registry that core components depend upon,
150
+
151
+ then the operand should tolerate all taints :
152
+
153
+ ` ` ` yaml
154
+ spec:
155
+ template:
156
+ spec:
157
+ tolerations:
158
+ - operator: Exists
159
+ ` ` `
160
+
161
+ An example of an operand that matches the first case is kube-proxy, which is required
162
+ for services to work. An example of an operand that matches the second case is the
163
+ DNS node resolver, which adds an entry to the `/etc/hosts` file on all node hosts so
164
+ that the container runtime is able to resolve the name of the cluster image registry;
165
+ absent this entry in `/etc/hosts`, upgrades could fail to pull images of core
166
+ components.
167
+
168
+ If an operand meets neither of the two conditions listed above, it must not tolerate
169
+ all taints. This constraint is enforced by [a CI test
170
+ job](https://github.com/openshift/origin/blob/7d07adcf518a846b898cd0958b85f2daf624476a/test/extended/operators/tolerations.go).
0 commit comments