Skip to content

Commit e50fb4b

Browse files
authored
Merge pull request #1209 from gianlucam76/resourcesummary-agentless
(Bug Fix) Conflict Handover
2 parents a7d5207 + eebdf3e commit e50fb4b

5 files changed

Lines changed: 30 additions & 4 deletions

File tree

controllers/handlers_helm.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,32 @@ func undeployStaleReleases(ctx context.Context, c client.Client, clusterSummary
17971797
return nil, err
17981798
}
17991799

1800+
if clusterSummary.Spec.ClusterProfileSpec.SyncMode != configv1beta1.SyncModeDryRun {
1801+
// If another ClusterSummary is queued to manage this chart in this cluster, do not uninstall.
1802+
// Let the other ClusterSummary take it over.
1803+
1804+
currentChart := &configv1beta1.HelmChart{
1805+
ReleaseNamespace: managedHelmReleases[i].Namespace,
1806+
ReleaseName: managedHelmReleases[i].Name,
1807+
}
1808+
otherRegisteredClusterSummaries := chartManager.GetRegisteredClusterSummariesForChart(
1809+
clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName,
1810+
clusterSummary.Spec.ClusterType, currentChart)
1811+
if len(otherRegisteredClusterSummaries) > 1 {
1812+
// Immediately unregister so next inline ClusterSummary can take this over
1813+
chartManager.UnregisterClusterSummaryForChart(clusterSummary, currentChart)
1814+
err = requeueAllOtherClusterSummaries(ctx, c, clusterSummary.Spec.ClusterNamespace,
1815+
otherRegisteredClusterSummaries, logger)
1816+
if err != nil {
1817+
// TODO: Handle errors to prevent bad state. ClusterSummary no longer manage the chart,
1818+
// but no other ClusterSummary instance has been requeued.
1819+
return nil, err
1820+
}
1821+
1822+
continue
1823+
}
1824+
}
1825+
18001826
if err := uninstallRelease(ctx, clusterSummary, managedHelmReleases[i].Name,
18011827
managedHelmReleases[i].Namespace, kubeconfig, &registryClientOptions{}, nil,
18021828
logger); err != nil {

pkg/drift-detection/drift-detection-manager-in-mgmt-cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
- --version=main
4848
command:
4949
- /manager
50-
image: docker.io/projectsveltos/drift-detection-manager@sha256:17c2c10741ecf13fa7dceb495edb62dc905b8f9f76a645c6bacea087137f5fa3
50+
image: docker.io/projectsveltos/drift-detection-manager@sha256:34aebc52b3aeb98d31a14393ca11ae07eee0b2836e15d53c4a559186ee45957f
5151
livenessProbe:
5252
failureThreshold: 3
5353
httpGet:

pkg/drift-detection/drift-detection-manager-in-mgmt-cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
- --version=main
3030
command:
3131
- /manager
32-
image: docker.io/projectsveltos/drift-detection-manager@sha256:17c2c10741ecf13fa7dceb495edb62dc905b8f9f76a645c6bacea087137f5fa3
32+
image: docker.io/projectsveltos/drift-detection-manager@sha256:34aebc52b3aeb98d31a14393ca11ae07eee0b2836e15d53c4a559186ee45957f
3333
livenessProbe:
3434
failureThreshold: 3
3535
httpGet:

pkg/drift-detection/drift-detection-manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
- --version=main
142142
command:
143143
- /manager
144-
image: docker.io/projectsveltos/drift-detection-manager@sha256:17c2c10741ecf13fa7dceb495edb62dc905b8f9f76a645c6bacea087137f5fa3
144+
image: docker.io/projectsveltos/drift-detection-manager@sha256:34aebc52b3aeb98d31a14393ca11ae07eee0b2836e15d53c4a559186ee45957f
145145
livenessProbe:
146146
failureThreshold: 3
147147
httpGet:

pkg/drift-detection/drift-detection-manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ spec:
123123
- --version=main
124124
command:
125125
- /manager
126-
image: docker.io/projectsveltos/drift-detection-manager@sha256:17c2c10741ecf13fa7dceb495edb62dc905b8f9f76a645c6bacea087137f5fa3
126+
image: docker.io/projectsveltos/drift-detection-manager@sha256:34aebc52b3aeb98d31a14393ca11ae07eee0b2836e15d53c4a559186ee45957f
127127
livenessProbe:
128128
failureThreshold: 3
129129
httpGet:

0 commit comments

Comments
 (0)