mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Merge pull request #1408 from fluxcd/helm-drift
Disable Flux helm drift detection for managed resources
This commit is contained in:
@@ -393,7 +393,7 @@ func TestServiceRouter_InitializeMetadata(t *testing.T) {
|
||||
|
||||
primarySvc, err := mocks.kubeClient.CoreV1().Services("default").Get(context.TODO(), "podinfo-primary", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(primarySvc.Annotations))
|
||||
assert.Equal(t, 2, len(primarySvc.Annotations))
|
||||
assert.Equal(t, "podinfo-primary", primarySvc.Labels["app"])
|
||||
}
|
||||
|
||||
@@ -425,12 +425,12 @@ func TestServiceRouter_ReconcileMetadata(t *testing.T) {
|
||||
|
||||
canarySvc, err := mocks.kubeClient.CoreV1().Services("default").Get(context.TODO(), "podinfo-canary", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(canarySvc.Annotations))
|
||||
assert.Equal(t, 2, len(canarySvc.Annotations))
|
||||
assert.Equal(t, "podinfo-canary", canarySvc.Labels["app"])
|
||||
|
||||
primarySvc, err := mocks.kubeClient.CoreV1().Services("default").Get(context.TODO(), "podinfo-primary", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(primarySvc.Annotations))
|
||||
assert.Equal(t, 2, len(primarySvc.Annotations))
|
||||
assert.Equal(t, "podinfo-primary", primarySvc.Labels["app"])
|
||||
|
||||
mocks.canary.Spec.Service.Apex = &flaggerv1.CustomMetadata{
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
const (
|
||||
toolkitMarker = "toolkit.fluxcd.io"
|
||||
toolkitReconcileKey = "kustomize.toolkit.fluxcd.io/reconcile"
|
||||
helmDriftDetectionKey = "helm.toolkit.fluxcd.io/driftDetection"
|
||||
toolkitReconcileValue = "disabled"
|
||||
)
|
||||
|
||||
@@ -30,5 +31,6 @@ func includeLabelsByPrefix(labels map[string]string, includeLabelPrefixes []stri
|
||||
func filterMetadata(meta map[string]string) map[string]string {
|
||||
// prevent Flux from overriding Flagger managed objects
|
||||
meta[toolkitReconcileKey] = toolkitReconcileValue
|
||||
meta[helmDriftDetectionKey] = toolkitReconcileValue
|
||||
return meta
|
||||
}
|
||||
|
||||
@@ -93,6 +93,13 @@ if [ -z "$passed" ]; then
|
||||
kubectl -n test get svc/podinfo-svc -oyaml
|
||||
exit 1
|
||||
fi
|
||||
passed=$(kubectl -n test get svc/podinfo-svc -oyaml 2>&1 | { grep 'helm.toolkit.fluxcd.io/driftDetection' || true; })
|
||||
if [ -z "$passed" ]; then
|
||||
echo -e '\u2716 helm drift detection annotation test failed'
|
||||
kubectl -n test get svc/podinfo-svc -oyaml
|
||||
exit 1
|
||||
fi
|
||||
|
||||
passed=$(kubectl -n test get deploy/podinfo-primary -oyaml 2>&1 | { grep test-label-prefix || true; })
|
||||
if [ -z "$passed" ]; then
|
||||
echo -e '\u2716 primary copy labels by prefix test failed'
|
||||
|
||||
Reference in New Issue
Block a user