Skip to content

Commit 8f6702d

Browse files
committed
feat(argocd): apply only out of sync resources
Rather than always applying all resources which causes anything that is setup to be deleted and recreated, like the OpenStack Helm jobs for db sync and keystone user/endpoint manipulation, from always being applied just apply those objects that are out of sync which should make updates a bit more smoother. At the same time document in better detail what all the options do and why we have them set.
1 parent 1da76f4 commit 8f6702d

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

apps/appsets/appset-understack-global.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,20 @@ spec:
7575
automated:
7676
selfHeal: true
7777
syncOptions:
78+
# Create the namespace we are using if it doesn't already exist.
7879
- CreateNamespace=true
80+
# Use the server side apply behavior of kubernetes for resources, we've got the
81+
# compare option set above to support this.
7982
- ServerSideApply=true
83+
# Resources might have mutated fields and we want to allow those to be set without
84+
# ArgoCD coming back and smacking them back. The ignoreDifferences templatePatch
85+
# uses this feature.
8086
- RespectIgnoreDifferences=true
87+
# Enable selective sync so that resources that have a difference are applied
88+
# instead of always applying all resources. This prevents us from always
89+
# running jobs.
90+
# https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync
91+
- ApplyOutOfSyncOnly=true
8192
managedNamespaceMetadata:
8293
annotations:
8394
# ArgoCD can create our namespace but let's not delete it

apps/appsets/appset-understack-infra.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,20 @@ spec:
7676
automated:
7777
selfHeal: true
7878
syncOptions:
79+
# Create the namespace we are using if it doesn't already exist.
7980
- CreateNamespace=true
81+
# Use the server side apply behavior of kubernetes for resources, we've got the
82+
# compare option set above to support this.
8083
- ServerSideApply=true
84+
# Resources might have mutated fields and we want to allow those to be set without
85+
# ArgoCD coming back and smacking them back. The ignoreDifferences templatePatch
86+
# uses this feature.
8187
- RespectIgnoreDifferences=true
88+
# Enable selective sync so that resources that have a difference are applied
89+
# instead of always applying all resources. This prevents us from always
90+
# running jobs.
91+
# https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync
92+
- ApplyOutOfSyncOnly=true
8293
managedNamespaceMetadata:
8394
annotations:
8495
# ArgoCD can create our namespace but let's not delete it

apps/appsets/appset-understack-openstack.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ spec:
104104
automated:
105105
selfHeal: true
106106
syncOptions:
107+
# Use the server side apply behavior of kubernetes for resources, we've got the
108+
# compare option set above to support this.
107109
- ServerSideApply=true
110+
# Resources might have mutated fields and we want to allow those to be set without
111+
# ArgoCD coming back and smacking them back. The ignoreDifferences templatePatch
112+
# uses this feature.
108113
- RespectIgnoreDifferences=true
114+
# Enable selective sync so that resources that have a difference are applied
115+
# instead of always applying all resources. This prevents us from always
116+
# running DB migrations and messing with keystone users and endpoints.
117+
# https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync
118+
- ApplyOutOfSyncOnly=true
109119
templatePatch: |
110120
spec:
111121
ignoreDifferences: {{ dig "ignoreDifferences" list . | toJson }}

apps/appsets/appset-understack-operators.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,20 @@ spec:
7676
automated:
7777
selfHeal: true
7878
syncOptions:
79+
# Create the namespace we are using if it doesn't already exist.
7980
- CreateNamespace=true
81+
# Use the server side apply behavior of kubernetes for resources, we've got the
82+
# compare option set above to support this.
8083
- ServerSideApply=true
84+
# Resources might have mutated fields and we want to allow those to be set without
85+
# ArgoCD coming back and smacking them back. The ignoreDifferences templatePatch
86+
# uses this feature.
8187
- RespectIgnoreDifferences=true
88+
# Enable selective sync so that resources that have a difference are applied
89+
# instead of always applying all resources. This prevents us from always
90+
# running jobs.
91+
# https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync
92+
- ApplyOutOfSyncOnly=true
8293
managedNamespaceMetadata:
8394
annotations:
8495
# ArgoCD can create our namespace but let's not delete it

apps/appsets/appset-understack-site.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,20 @@ spec:
7575
automated:
7676
selfHeal: true
7777
syncOptions:
78+
# Create the namespace we are using if it doesn't already exist.
7879
- CreateNamespace=true
80+
# Use the server side apply behavior of kubernetes for resources, we've got the
81+
# compare option set above to support this.
7982
- ServerSideApply=true
83+
# Resources might have mutated fields and we want to allow those to be set without
84+
# ArgoCD coming back and smacking them back. The ignoreDifferences templatePatch
85+
# uses this feature.
8086
- RespectIgnoreDifferences=true
87+
# Enable selective sync so that resources that have a difference are applied
88+
# instead of always applying all resources. This prevents us from always
89+
# running jobs.
90+
# https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#selective-sync
91+
- ApplyOutOfSyncOnly=true
8192
managedNamespaceMetadata:
8293
annotations:
8394
# ArgoCD can create our namespace but let's not delete it

0 commit comments

Comments
 (0)