Skip to content

Commit

Permalink
Merge pull request #701 from alexander-demicev/annotation
Browse files Browse the repository at this point in the history
Add turtles annotation to RKE2Config modified by webhook
  • Loading branch information
alexander-demicev committed Sep 2, 2024
2 parents 975f991 + 06e7856 commit a31b537
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions exp/etcdrestore/webhooks/rke2config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const (
defaultFileOwner = "root:root"
)

const (
SystemAgentAnnotation = "cluster-api.cattle.io/turtles-system-agent"
)

var (
//go:embed install.sh
installSh []byte
Expand Down Expand Up @@ -85,6 +89,12 @@ func (r *RKE2ConfigWebhook) Default(ctx context.Context, obj runtime.Object) err
return apierrors.NewBadRequest(fmt.Sprintf("expected a RKE2Config but got a %T", obj))
}

if rke2Config.Annotations == nil {
rke2Config.Annotations = map[string]string{}
}

rke2Config.Annotations[SystemAgentAnnotation] = ""

planSecretName := strings.Join([]string{rke2Config.Name, "rke2config", "plan"}, "-")

if err := r.createSecretPlanResources(ctx, planSecretName, rke2Config); err != nil {
Expand Down

0 comments on commit a31b537

Please sign in to comment.