mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-22 07:50:04 -05:00
constants: rename components annotation key
This commit is contained in:
parent
703f73a761
commit
8c5e41b865
@ -174,7 +174,7 @@ func (k *KubeWrapper) InitCluster(
|
||||
|
||||
// Annotate Node with the hash of the installed components
|
||||
if err := k.client.AnnotateNode(ctx, nodeName,
|
||||
constants.NodeKubernetesComponentsHashAnnotationKey, k8sComponentsConfigMap,
|
||||
constants.NodeKubernetesComponentsAnnotationKey, k8sComponentsConfigMap,
|
||||
); err != nil {
|
||||
return nil, fmt.Errorf("annotating node with Kubernetes components hash: %w", err)
|
||||
}
|
||||
|
@ -118,8 +118,8 @@ const (
|
||||
// ComponentsListKey is the name of the key holding the list of components in the components configMap.
|
||||
ComponentsListKey = "components"
|
||||
|
||||
// NodeKubernetesComponentsHashAnnotationKey is the name of the annotation holding the reference to the ConfigMap listing all K8s components.
|
||||
NodeKubernetesComponentsHashAnnotationKey = "constellation.edgeless.systems/kubernetes-components"
|
||||
// NodeKubernetesComponentsAnnotationKey is the name of the annotation holding the reference to the ConfigMap listing all K8s components.
|
||||
NodeKubernetesComponentsAnnotationKey = "constellation.edgeless.systems/kubernetes-components"
|
||||
|
||||
// JoiningNodesConfigMapName is the name of the configMap holding the joining nodes with the components hashes the node-operator should annotate the nodes with.
|
||||
JoiningNodesConfigMapName = "joining-nodes"
|
||||
|
@ -74,7 +74,7 @@ func (r *JoiningNodesReconciler) Reconcile(ctx context.Context, req ctrl.Request
|
||||
if node.Annotations == nil {
|
||||
node.Annotations = map[string]string{}
|
||||
}
|
||||
node.Annotations[mainconstants.NodeKubernetesComponentsHashAnnotationKey] = joiningNode.Spec.ComponentsReference
|
||||
node.Annotations[mainconstants.NodeKubernetesComponentsAnnotationKey] = joiningNode.Spec.ComponentsReference
|
||||
return r.Update(ctx, &node)
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -81,7 +81,7 @@ var _ = Describe("JoiningNode controller", func() {
|
||||
By("annotating the node")
|
||||
Eventually(func() string {
|
||||
_ = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName1}, createdNode)
|
||||
return createdNode.Annotations[mainconstants.NodeKubernetesComponentsHashAnnotationKey]
|
||||
return createdNode.Annotations[mainconstants.NodeKubernetesComponentsAnnotationKey]
|
||||
}, timeout, interval).Should(Equal(ComponentsReference1))
|
||||
|
||||
By("deleting the joining node resource")
|
||||
@ -135,7 +135,7 @@ var _ = Describe("JoiningNode controller", func() {
|
||||
By("annotating the node")
|
||||
Eventually(func() string {
|
||||
_ = k8sClient.Get(ctx, types.NamespacedName{Name: createdNode.Name}, createdNode)
|
||||
return createdNode.Annotations[mainconstants.NodeKubernetesComponentsHashAnnotationKey]
|
||||
return createdNode.Annotations[mainconstants.NodeKubernetesComponentsAnnotationKey]
|
||||
}, timeout, interval).Should(Equal(ComponentsReference2))
|
||||
|
||||
By("deleting the joining node resource")
|
||||
|
@ -777,7 +777,7 @@ func groupNodes(nodes []corev1.Node, pendingNodes []updatev1alpha1.PendingNode,
|
||||
continue
|
||||
}
|
||||
if !strings.EqualFold(node.Annotations[nodeImageAnnotation], latestImageReference) ||
|
||||
!strings.EqualFold(node.Annotations[mainconstants.NodeKubernetesComponentsHashAnnotationKey], latestK8sComponentsReference) {
|
||||
!strings.EqualFold(node.Annotations[mainconstants.NodeKubernetesComponentsAnnotationKey], latestK8sComponentsReference) {
|
||||
if heir := node.Annotations[heirAnnotation]; heir != "" {
|
||||
groups.Donors = append(groups.Donors, node)
|
||||
} else {
|
||||
|
@ -609,9 +609,9 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "outdated",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
nodeImageAnnotation: "old-image",
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
nodeImageAnnotation: "old-image",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -619,9 +619,9 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "outdated",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: "old-ref",
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: "old-ref",
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -631,9 +631,9 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "uptodate",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -643,10 +643,10 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "donor",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: "old-image",
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
heirAnnotation: "heir",
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: "old-image",
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
heirAnnotation: "heir",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -654,10 +654,10 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "donor",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: "old-ref",
|
||||
heirAnnotation: "heir",
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: "old-ref",
|
||||
heirAnnotation: "heir",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -667,10 +667,10 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "heir",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
donorAnnotation: "donor",
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
donorAnnotation: "donor",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -680,10 +680,10 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "obsolete",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
obsoleteAnnotation: "true",
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
obsoleteAnnotation: "true",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -694,9 +694,9 @@ func TestGroupNodes(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "mint",
|
||||
Annotations: map[string]string{
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsHashAnnotationKey: latestK8sComponentsReference,
|
||||
scalingGroupAnnotation: scalingGroup,
|
||||
nodeImageAnnotation: latestImageReference,
|
||||
mainconstants.NodeKubernetesComponentsAnnotationKey: latestK8sComponentsReference,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user