Skip to content

Commit cd178b9

Browse files
committed
fix: ensure consistent manifest apply order
Fist, pull in a fix from go-kubernetes to show apply order in the exact order manifests were applied. Second, in the sync code, promote configmaps and secrets to the third (custom) stage, before other resources, but after other cluster-wide resources. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 19fac61 commit cd178b9

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ require (
142142
github.com/siderolabs/go-debug v0.6.2
143143
github.com/siderolabs/go-kmsg v0.1.6
144144
github.com/siderolabs/go-kubeconfig v0.1.2
145-
github.com/siderolabs/go-kubernetes v0.2.38
145+
github.com/siderolabs/go-kubernetes v0.2.39
146146
github.com/siderolabs/go-loadbalancer v0.5.0
147147
github.com/siderolabs/go-pcidb v0.3.3
148148
github.com/siderolabs/go-pointer v1.0.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ github.com/siderolabs/go-kmsg v0.1.6 h1:ZrJPExUnJubqiNA7T8RUi/ySvJsnIen+bdiY+pea
813813
github.com/siderolabs/go-kmsg v0.1.6/go.mod h1:fryspKc1f6nMIOK5YbUPutz2v2rdBTBeLqW/ci9BDfk=
814814
github.com/siderolabs/go-kubeconfig v0.1.2 h1:0D0v3lXUKon+A2qRFwOnc9m4qSB+e+5WDmvGjiJPH8Y=
815815
github.com/siderolabs/go-kubeconfig v0.1.2/go.mod h1:FMl17PHjjAJjdeUTMN+gBzGH0lhsCbj2IX9/HNMpMh0=
816-
github.com/siderolabs/go-kubernetes v0.2.38 h1:HzBHnSE0zA/7eXpqRnfDYS94F5KO9QMW6tOqIQ33O2Y=
817-
github.com/siderolabs/go-kubernetes v0.2.38/go.mod h1:4DBVXLASGnJIhbDRJNl9DayYohYLu3VhQ1cpY/Gj2nw=
816+
github.com/siderolabs/go-kubernetes v0.2.39 h1:NhCKsFwwXNDDYD7PPLycP7VVJwaZmXum8kEQoA65yDA=
817+
github.com/siderolabs/go-kubernetes v0.2.39/go.mod h1:4DBVXLASGnJIhbDRJNl9DayYohYLu3VhQ1cpY/Gj2nw=
818818
github.com/siderolabs/go-loadbalancer v0.5.0 h1:0v7E6GrxoONyqwcmHiA+J0vIDPWbkTmevHGCFb4tjdc=
819819
github.com/siderolabs/go-loadbalancer v0.5.0/go.mod h1:tRVouZ9i2R/TRbNUF9MqyBlV2wsjX0cxkYTjPXcI9P0=
820820
github.com/siderolabs/go-pcidb v0.3.3 h1:Cxng3j6gUrWCh1tHlt524A4cC+dyRU+3j1AWQM6ULPc=

pkg/cluster/kubernetes/talos_managed.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
v1 "k8s.io/api/core/v1"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
30+
"k8s.io/apimachinery/pkg/runtime/schema"
3031
"k8s.io/client-go/informers"
3132
"k8s.io/client-go/tools/cache"
3233

@@ -530,6 +531,13 @@ func syncManifestsSSA(ctx context.Context, objects []*unstructured.Unstructured,
530531
WaitTimeout: options.ReconcileTimeout,
531532
NoPrune: options.NoPrune,
532533
Force: options.ForceManifests,
534+
CustomStageKinds: map[schema.GroupKind]struct{}{
535+
// perform sync for configmaps/secrets before e.g. deployments/daemonsets,
536+
// as there is a common pattern of linking them via a label/annotation checksum,
537+
// to ensure that the dependent resources are reconciled after the configmap/secret is updated.
538+
schema.ParseGroupKind("ConfigMap"): {},
539+
schema.ParseGroupKind("Secret"): {},
540+
},
533541
})
534542
if err != nil {
535543
return fmt.Errorf("error applying manifests: %w", err)

0 commit comments

Comments
 (0)