Skip to content

Commit

Permalink
Fix annotation format (#22)
Browse files Browse the repository at this point in the history
* use annotation mechanism to change controller behavior

* use registry.ethos.adobe.com/xxx annotation format

* remove history

Co-authored-by: Victor Varza <vvarza@adobe.com>
  • Loading branch information
victorvarza and Victor Varza authored Mar 30, 2022
1 parent ab55cdd commit fc3e234
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions docs/developer-guides/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Annotation keys and values can only be strings.

|Name | type |
|---------------------------|------|
|[clusters.registry.ethos.adobe.com/excluded-tags](#excluded-tags)|string|
|[clusters.registry.ethos.adobe.com/skip-ca-cert](#skip-ca-cert)|"true" or "false"|
|[registry.ethos.adobe.com/excluded-tags](#excluded-tags)|string|
|[registry.ethos.adobe.com/skip-ca-cert](#skip-ca-cert)|"true" or "false"|

## Excluded tags

The annotation `clusters.registry.ethos.adobe.com/excluded-tags` defines the behavior of the cluster-registry-client regarding to dynamic tags. If Alertmanager sends a signal for a specific tag, it will be ignored by Cluster Registry Client.
The annotation `registry.ethos.adobe.com/excluded-tags` defines the behavior of the cluster-registry-client regarding to dynamic tags. If Alertmanager sends a signal for a specific tag, it will be ignored by Cluster Registry Client.

Example:
`clusters.registry.ethos.adobe.com/excluded-tags: "onboarding,scaling"`
`registry.ethos.adobe.com/excluded-tags: "onboarding,scaling"`

## Skip CA Cert

The annotation `clusters.registry.ethos.adobe.com/skip-ca-cert` defines the behavior of the cluster-registry-client for setting the K8s API CA Certificate. If it's set to `true`, the `CertificateAuthorityData` will not be set.
The annotation `registry.ethos.adobe.com/skip-ca-cert` defines the behavior of the cluster-registry-client for setting the K8s API CA Certificate. If it's set to `true`, the `CertificateAuthorityData` will not be set.

Example:
`clusters.registry.ethos.adobe.com/skip-ca-cert: "true"`
`registry.ethos.adobe.com/skip-ca-cert: "true"`
2 changes: 1 addition & 1 deletion pkg/client/controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
return ctrl.Result{}, client.IgnoreNotFound(err)
}

skipCACert := instance.Annotations["clusters.registry.ethos.adobe.com/skip-ca-cert"]
skipCACert := instance.Annotations["registry.ethos.adobe.com/skip-ca-cert"]

// skipCACert is an exception rather than a rule
if skipCACert == "true" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var _ = Describe("Client Controller", func() {
err := k8sClient.Get(ctx, clusterLookupKey, cluster)
return err == nil
}, timeout, interval).Should(BeTrue())
cluster.Annotations = map[string]string{"clusters.registry.ethos.adobe.com/skip-ca-cert": "true"}
cluster.Annotations = map[string]string{"registry.ethos.adobe.com/skip-ca-cert": "true"}
Expect(k8sClient.Update(ctx, cluster)).Should(Succeed())

// give controller-runtime time to propagagte data into etcd
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *Server) process(alert Alert) error {
cluster.Spec.Tags = make(map[string]string)
}

excludedTagsAnnotation = cluster.Annotations["clusters.registry.ethos.adobe.com/excluded-tags"]
excludedTagsAnnotation = cluster.Annotations["registry.ethos.adobe.com/excluded-tags"]

if excludedTagsAnnotation != "" {
excludedTags = strings.Split(excludedTagsAnnotation, ",")
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ var _ = Describe("Webhook Server", func() {
err := k8sClient.Get(ctx, clusterLookupKey, cluster)
return err == nil
}, timeout, interval).Should(BeTrue())
cluster.Annotations = map[string]string{"clusters.registry.ethos.adobe.com/excluded-tags": "other-tag,my-tag"}
cluster.Annotations = map[string]string{"registry.ethos.adobe.com/excluded-tags": "other-tag,my-tag"}
Expect(k8sClient.Update(ctx, cluster)).Should(Succeed())

// give controller-runtime time to propagagte data into etcd
Expand Down

0 comments on commit fc3e234

Please sign in to comment.