|
1 | 1 | package operator2
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "crypto/sha512" |
| 5 | + "encoding/base64" |
4 | 6 | "strings"
|
5 | 7 |
|
6 | 8 | "github.com/golang/glog"
|
@@ -31,6 +33,9 @@ const (
|
31 | 33 | targetName = "openshift-authentication"
|
32 | 34 | globalConfigName = "cluster"
|
33 | 35 |
|
| 36 | + operatorNamespace = "openshift-authentication-operator" |
| 37 | + operatorDeploymentName = "openshift-authentication-operator" |
| 38 | + |
34 | 39 | machineConfigNamespace = "openshift-config-managed"
|
35 | 40 | userConfigNamespace = "openshift-config"
|
36 | 41 |
|
@@ -176,11 +181,12 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
|
176 | 181 | }
|
177 | 182 | resourceVersions = append(resourceVersions, route.GetResourceVersion())
|
178 | 183 |
|
179 |
| - serviceCA, err := c.handleServiceCA() |
| 184 | + serviceCA, servingCert, err := c.handleServiceCA() |
180 | 185 | if err != nil {
|
181 | 186 | return err
|
182 | 187 | }
|
183 | 188 | resourceVersions = append(resourceVersions, serviceCA.GetResourceVersion())
|
| 189 | + resourceVersions = append(resourceVersions, servingCert.GetResourceVersion()) |
184 | 190 |
|
185 | 191 | metadata, _, err := resourceapply.ApplyConfigMap(c.configMaps, c.recorder, getMetadataConfigMap(route))
|
186 | 192 | if err != nil {
|
@@ -231,9 +237,14 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
|
231 | 237 | }
|
232 | 238 | resourceVersions = append(resourceVersions, cliConfig.GetResourceVersion())
|
233 | 239 |
|
| 240 | + operatorPodTemplateHash, err := c.getOperatorDeploymentPodTemplateHash() |
| 241 | + if err != nil { |
| 242 | + return err |
| 243 | + } |
| 244 | + resourceVersions = append(resourceVersions, operatorPodTemplateHash) |
| 245 | + |
234 | 246 | // deployment, have RV of all resources
|
235 | 247 | // TODO use ExpectedDeploymentGeneration func
|
236 |
| - // TODO we also need the RV for the serving-cert secret (servingCertName) |
237 | 248 | expectedDeployment := defaultDeployment(
|
238 | 249 | operatorConfig,
|
239 | 250 | syncData,
|
@@ -280,3 +291,14 @@ func getPrefixFilter() controller.Filter {
|
280 | 291 | DeleteFunc: prefix,
|
281 | 292 | }
|
282 | 293 | }
|
| 294 | + |
| 295 | +func (c *authOperator) getOperatorDeploymentPodTemplateHash() (string, error) { |
| 296 | + deployments := c.deployments.Deployments(operatorNamespace) |
| 297 | + operator, err := deployments.Get(operatorDeploymentName, metav1.GetOptions{}) |
| 298 | + if err != nil { |
| 299 | + return "", err |
| 300 | + } |
| 301 | + |
| 302 | + templateHash := sha512.Sum512([]byte(operator.Spec.Template.String())) |
| 303 | + return base64.RawURLEncoding.EncodeToString(templateHash[:]), nil |
| 304 | +} |
0 commit comments