Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change label for vintage/capi detection #100

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Change the label used to detect whether the Cluster is Vintage or CAPI based.

## [0.10.0] - 2024-04-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (r *ClusterReconciler) reconcile(ctx context.Context, cluster *capi.Cluster
if deletionTimeReached(cluster) {
if !r.DryRun {
// if it's a vintage cluster, we just try to remove the Cluster CR
if _, ok := cluster.Labels[vintageReleaseVersion]; ok {
if _, ok := cluster.Labels[clusterOperatorVersion]; ok {
err := deleteVintageCluster(ctx, log, r.Client, cluster)
if err != nil {
return ctrl.Result{}, err
Expand Down
10 changes: 5 additions & 5 deletions controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestClusterController(t *testing.T) {
Time: time.Now().Add(-defaultTTL),
},
Labels: map[string]string{
"release.giantswarm.io/version": "18.2.1",
"cluster-operator.giantswarm.io/version": "5.1.1",
},
Annotations: map[string]string{},
Finalizers: []string{
Expand Down Expand Up @@ -187,8 +187,8 @@ func TestClusterController(t *testing.T) {
},
Annotations: map[string]string{},
Labels: map[string]string{
keepUntil: "2020-12-08",
"release.giantswarm.io/version": "18.2.1",
keepUntil: "2020-12-08",
"cluster-operator.giantswarm.io/version": "5.1.1",
},
Finalizers: []string{
"operatorkit.giantswarm.io/cluster-operator-cluster-controller",
Expand All @@ -214,7 +214,7 @@ func TestClusterController(t *testing.T) {
"kustomize.toolkit.fluxcd.io/name": "flux",
},
Labels: map[string]string{
"release.giantswarm.io/version": "18.2.1",
"cluster-operator.giantswarm.io/version": "5.1.1",
},
Finalizers: []string{
"operatorkit.giantswarm.io/cluster-operator-cluster-controller",
Expand Down Expand Up @@ -402,7 +402,7 @@ func TestClusterAppDeletion(t *testing.T) {
Time: time.Now().Add(-defaultTTL),
},
Labels: map[string]string{
"release.giantswarm.io/version": "18.2.1",
"cluster-operator.giantswarm.io/version": "5.1.1",
},
Annotations: map[string]string{
helmReleaseNameAnnotation: "test",
Expand Down
2 changes: 1 addition & 1 deletion controllers/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
// fluxLabel is the label for checking if the cluster is created via git-ops
fluxLabel = "kustomize.toolkit.fluxcd.io/name"

vintageReleaseVersion = "release.giantswarm.io/version"
clusterOperatorVersion = "cluster-operator.giantswarm.io/version"
)

func requeue() reconcile.Result {
Expand Down