Skip to content

Commit 8f0a9c9

Browse files
author
YuChen
committed
udpated annotation
Signed-off-by: YuChen <[email protected]>
1 parent 9b5f85d commit 8f0a9c9

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

controllers/operandrequest/reconcile_operand.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -948,24 +948,6 @@ func (r *Reconciler) createK8sResource(ctx context.Context, k8sResTemplate unstr
948948
name := k8sResTemplate.GetName()
949949
namespace := k8sResTemplate.GetNamespace()
950950

951-
if kind == "Route" {
952-
host, _, err := unstructured.NestedString(k8sResTemplate.Object, "spec", "host")
953-
klog.Info("11111 host %v: ", host)
954-
955-
if err != nil {
956-
klog.Errorf("failed to get spec.host for Route: %v", err)
957-
return err
958-
}
959-
960-
// Calculate and set hash for spec.host
961-
hostHash := util.CalculateHash(host)
962-
if newAnnotations == nil {
963-
newAnnotations = make(map[string]string)
964-
}
965-
newAnnotations["openshift.io/keycloak-host.hashedData"] = hostHash
966-
// klog.Infof("22222 Set host hash annotation: %s", hostHash)
967-
}
968-
969951
if k8sResConfig != nil {
970952
k8sResConfigDecoded := make(map[string]interface{})
971953
k8sResConfigUnmarshalErr := json.Unmarshal(k8sResConfig.Raw, &k8sResConfigDecoded)
@@ -984,10 +966,10 @@ func (r *Reconciler) createK8sResource(ctx context.Context, k8sResTemplate unstr
984966
if newAnnotations == nil {
985967
newAnnotations = make(map[string]string)
986968
}
987-
newAnnotations["openshift.io/keycloak-host.hashedData"] = hostHash
969+
newAnnotations["operator.ibm.com/odlm.route.hashedData"] = hostHash
988970
klog.Infof(" 2222 Route spec.host: %s, calculated host-hash: %s", host, hostHash)
989971
} else {
990-
klog.Warningf("spec.host not found in k8sResConfig for Route")
972+
klog.Warningf("spec.host not found in Route %s/%s", namespace, name)
991973
}
992974
}
993975
}
@@ -1073,7 +1055,7 @@ func (r *Reconciler) updateK8sResource(ctx context.Context, existingK8sRes unstr
10731055

10741056
if kind == "Route" {
10751057
existingAnnos := existingK8sRes.GetAnnotations()
1076-
existingHostHash := existingAnnos["openshift.io/keycloak-host.hashedData"]
1058+
existingHostHash := existingAnnos["operator.ibm.com/odlm.route.hashedData"]
10771059
klog.Infof("111--11 existing host hash: %s", existingHostHash)
10781060

10791061
if k8sResConfig != nil {
@@ -1114,7 +1096,7 @@ func (r *Reconciler) updateK8sResource(ctx context.Context, existingK8sRes unstr
11141096
if existingHostHash != newHostHash {
11151097
klog.Infof("5555 Custom host changed, updating Route with new host hash")
11161098

1117-
existingAnnos["openshift.io/keycloak-host.hashedData"] = newHostHash
1099+
existingAnnos["operator.ibm.com/odlm.route.hashedData"] = newHostHash
11181100
r.EnsureAnnotation(existingK8sRes, existingAnnos)
11191101
}
11201102
// Update resource in the cluster

0 commit comments

Comments
 (0)