From 53a1db07035cbdaa3d5d696f9b827ea56b44c8dc Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Fri, 20 Nov 2020 13:34:02 +0200 Subject: [PATCH] Adjustments to support new sa name in kustomize Supporting changes in fluxcd/kustomize-controller#180 Signed-off-by: Aurel Canciu --- cmd/flux/create_kustomization.go | 9 ++------- docs/cmd/flux_create_kustomization.md | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index 9bebc0e2..402a5812 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -81,7 +81,6 @@ var ( ksHealthCheck []string ksHealthTimeout time.Duration ksSAName string - ksSANamespace string ksDecryptionProvider flags.DecryptionProvider ksDecryptionSecret string ksTargetNamespace string @@ -96,7 +95,6 @@ func init() { createKsCmd.Flags().StringVar(&ksValidation, "validation", "", "validate the manifests before applying them on the cluster, can be 'client' or 'server'") createKsCmd.Flags().StringArrayVar(&ksDependsOn, "depends-on", nil, "Kustomization that must be ready before this Kustomization can be applied, supported formats '' and '/'") createKsCmd.Flags().StringVar(&ksSAName, "sa-name", "", "service account name") - createKsCmd.Flags().StringVar(&ksSANamespace, "sa-namespace", "", "service account namespace") createKsCmd.Flags().Var(&ksDecryptionProvider, "decryption-provider", ksDecryptionProvider.Description()) createKsCmd.Flags().StringVar(&ksDecryptionSecret, "decryption-secret", "", "set the Kubernetes secret name that contains the OpenPGP private keys used for sops decryption") createKsCmd.Flags().StringVar(&ksTargetNamespace, "target-namespace", "", "overrides the namespace of all Kustomization objects reconciled by this Kustomization") @@ -189,11 +187,8 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { } } - if ksSAName != "" && ksSANamespace != "" { - kustomization.Spec.ServiceAccount = &kustomizev1.ServiceAccount{ - Name: ksSAName, - Namespace: ksSANamespace, - } + if ksSAName != "" { + kustomization.Spec.ServiceAccountName = ksSAName } if ksDecryptionProvider != "" { diff --git a/docs/cmd/flux_create_kustomization.md b/docs/cmd/flux_create_kustomization.md index dfd25b2b..6652be25 100644 --- a/docs/cmd/flux_create_kustomization.md +++ b/docs/cmd/flux_create_kustomization.md @@ -53,7 +53,6 @@ flux create kustomization [name] [flags] --path string path to the directory containing the Kustomization file (default "./") --prune enable garbage collection --sa-name string service account name - --sa-namespace string service account namespace --source kustomizationSource source that contains the Kubernetes manifests in the format '[/]',where kind can be one of: (GitRepository, Bucket), if kind is not specified it defaults to GitRepository --target-namespace string overrides the namespace of all Kustomization objects reconciled by this Kustomization --validation string validate the manifests before applying them on the cluster, can be 'client' or 'server'