|
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"
|
@@ -176,11 +178,12 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
|
176 | 178 | }
|
177 | 179 | resourceVersions = append(resourceVersions, route.GetResourceVersion())
|
178 | 180 |
|
179 |
| - serviceCA, err := c.handleServiceCA() |
| 181 | + serviceCA, servingCert, err := c.handleServiceCA() |
180 | 182 | if err != nil {
|
181 | 183 | return err
|
182 | 184 | }
|
183 | 185 | resourceVersions = append(resourceVersions, serviceCA.GetResourceVersion())
|
| 186 | + resourceVersions = append(resourceVersions, servingCert.GetResourceVersion()) |
184 | 187 |
|
185 | 188 | metadata, _, err := resourceapply.ApplyConfigMap(c.configMaps, c.recorder, getMetadataConfigMap(route))
|
186 | 189 | if err != nil {
|
@@ -231,9 +234,14 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
|
231 | 234 | }
|
232 | 235 | resourceVersions = append(resourceVersions, cliConfig.GetResourceVersion())
|
233 | 236 |
|
| 237 | + operatorPodTemplateHash, err := c.getOperatorDeploymentPodTemplateHash() |
| 238 | + if err != nil { |
| 239 | + return err |
| 240 | + } |
| 241 | + resourceVersions = append(resourceVersions, operatorPodTemplateHash) |
| 242 | + |
234 | 243 | // deployment, have RV of all resources
|
235 | 244 | // TODO use ExpectedDeploymentGeneration func
|
236 |
| - // TODO we also need the RV for the serving-cert secret (servingCertName) |
237 | 245 | expectedDeployment := defaultDeployment(
|
238 | 246 | operatorConfig,
|
239 | 247 | syncData,
|
@@ -280,3 +288,14 @@ func getPrefixFilter() controller.Filter {
|
280 | 288 | DeleteFunc: prefix,
|
281 | 289 | }
|
282 | 290 | }
|
| 291 | + |
| 292 | +func (c *authOperator) getOperatorDeploymentPodTemplateHash() (string, error) { |
| 293 | + deployments := c.deployments.Deployments(operatorNamespace) |
| 294 | + operator, err := deployments.Get("openshift-authentication-operator", metav1.GetOptions{}) |
| 295 | + if err != nil { |
| 296 | + return "", err |
| 297 | + } |
| 298 | + |
| 299 | + templateHash := sha512.Sum512([]byte(operator.Spec.Template.String())) |
| 300 | + return base64.RawURLEncoding.EncodeToString(templateHash[:]), nil |
| 301 | +} |
0 commit comments