From a4fdab9f257df7a881580a9d429ec2e96c2a35a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Wed, 6 Nov 2024 12:13:12 +0100 Subject: [PATCH 1/2] fix: optionally allow non-standard namespace annotating resources with release namespace for traceability improving test --- pkg/cmd/helmfile/move/move.go | 51 ++++++-- pkg/cmd/helmfile/move/move_test.go | 121 ++++++++++++------ .../keda-operator-auth-reader-rb.yaml | 21 +++ 3 files changed, 144 insertions(+), 49 deletions(-) create mode 100644 pkg/cmd/helmfile/move/testdata/dirIncludesReleaseName/selenium-grid/selenium/keda/templates/keda-operator-auth-reader-rb.yaml diff --git a/pkg/cmd/helmfile/move/move.go b/pkg/cmd/helmfile/move/move.go index ae285f0d2..351fbd80c 100644 --- a/pkg/cmd/helmfile/move/move.go +++ b/pkg/cmd/helmfile/move/move.go @@ -26,21 +26,26 @@ import ( const ( // HelmReleaseNameAnnotation the annotation added by helm to denote a release name - HelmReleaseNameAnnotation = "meta.helm.sh/release-name" + HelmReleaseNameAnnotation = "meta.helm.sh/release-name" + HelmReleaseNameSpaceAnnotation = "meta.helm.sh/release-namespace" pathSeparator = string(os.PathSeparator) ) var ( namespaceLong = templates.LongDesc(` - Moves the generated template files from 'helmfile template' into the right gitops directory + Moves the generated template files from 'helmfile template' into the right gitops directory. -The output of 'helmfile template' ignores the namespace specified in the 'helmfile.yaml' and there is a dummy top level directory. + The output of 'helmfile template' ignores the namespace specified in the 'helmfile.yaml' and there is a dummy top level directory. -So this command applies the namespace to all the generated resources and then moves the namespaced resources into the config-root/namespaces/$ns/$releaseName directory -and then moves any CRDs or cluster level resources into 'config-root/cluster/$releaseName' + So by default this command applies the namespace to all the generated resources -If supplied with --dir-includes-release-name then by default we will annotate the resources with the annotation 'meta.helm.sh/release-name' to preserve the helm release name + Then it moves the namespaced resources into the config-root/namespaces/$ns/$releaseName directory + and any CRDs or cluster level resources into 'config-root/cluster/$releaseName'. + + If supplied with --dir-includes-release-name then by default we will annotate the resources with the annotations "app.kubernetes.io/instance" to preserve the helm release name. + + The annotation "meta.helm.sh/release-namespace" will be added by default and contain the namespace specified in the release. `) namespaceExample = templates.Examples(` @@ -59,9 +64,10 @@ type Options struct { ClusterResourcesDir string CustomResourceDefinitionsDir string NamespacesDir string - SingleNamespace string DirIncludesReleaseName bool + OverrideNamespace bool AnnotateReleaseNames bool + AnnotateReleaseNameSpace bool HelmState *state.HelmState NamespacedKind map[string]bool ResourcesToMove []ResourceToMove @@ -86,6 +92,8 @@ func NewCmdHelmfileMove() (*cobra.Command, *Options) { cmd.Flags().StringVarP(&o.OutputDir, "output-dir", "o", "config-root", "the output directory") cmd.Flags().BoolVarP(&o.DirIncludesReleaseName, "dir-includes-release-name", "", false, "the directory containing the generated resources has a path segment that is the release name") cmd.Flags().BoolVarP(&o.AnnotateReleaseNames, "annotate-release-name", "", true, "if using --dir-includes-release-name layout then lets add the 'meta.helm.sh/release-name' annotation to record the helm release name") + cmd.Flags().BoolVarP(&o.AnnotateReleaseNameSpace, "annotate-release-namespace", "", true, "add the 'meta.helm.sh/release-namespace' annotation to record the helm release namespace") + cmd.Flags().BoolVarP(&o.OverrideNamespace, "override-namespace", "", true, "applies the namespace specified in helmfile to all the generated resources") o.Filter.AddFlags(cmd) return cmd, o @@ -195,10 +203,21 @@ noKube: outDir := filepath.Join(o.ClusterResourcesDir, res.namespace, res.pathname) if isNamespaced { - err := res.node.PipeE(yaml.LookupCreate(yaml.ScalarNode, "metadata", "namespace"), yaml.FieldSetter{StringValue: res.namespace}) - if err != nil { - return errors.Wrapf(err, "failed to set metadata.namespace to %s for path %s", res.namespace, res.path) + setNS := true + namespaceLookup := yaml.LookupCreate(yaml.ScalarNode, "metadata", "namespace") + if !o.OverrideNamespace { + nsNode, _ := res.node.Pipe(namespaceLookup) + nsNodeText, _ := nsNode.String() + setNS = nsNodeText == "" + } + if setNS { + err = res.node.PipeE(namespaceLookup, yaml.FieldSetter{StringValue: res.namespace}) + + if err != nil { + return errors.Wrapf(err, "failed to set metadata.namespace to %s for path %s", res.namespace, res.path) + } } + outDir = filepath.Join(o.NamespacesDir, res.namespace, res.pathname) } else { err := res.node.PipeE(yaml.Lookup("metadata"), yaml.FieldClearer{Name: "namespace"}) @@ -320,16 +339,22 @@ func (o *Options) moveFilesToClusterOrNamespacesFolder(dir, ns, releaseName, cha pathName = fmt.Sprintf("%s-%s", chartName, releaseName) } + setAnnotations := make(map[string]string) if o.AnnotateReleaseNames { - k := HelmReleaseNameAnnotation + setAnnotations[HelmReleaseNameAnnotation] = releaseName + } + if o.AnnotateReleaseNameSpace { + setAnnotations[HelmReleaseNameSpaceAnnotation] = ns + } + for k, newValue := range setAnnotations { v, err := node.Pipe(yaml.GetAnnotation(k)) if err != nil { return errors.Wrapf(err, "failed to get annotation %s for path %s", k, path) } if v == nil { - err = node.PipeE(yaml.SetAnnotation(k, releaseName)) + err = node.PipeE(yaml.SetAnnotation(k, newValue)) if err != nil { - return errors.Wrapf(err, "failed to set annotation %s to %s for path %s", k, releaseName, path) + return errors.Wrapf(err, "failed to set annotation %s to %s for path %s", k, newValue, path) } } } diff --git a/pkg/cmd/helmfile/move/move_test.go b/pkg/cmd/helmfile/move/move_test.go index 2fec002ec..301a1ca37 100644 --- a/pkg/cmd/helmfile/move/move_test.go +++ b/pkg/cmd/helmfile/move/move_test.go @@ -12,13 +12,17 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) +type test struct { + folder string + hasReleaseName bool + expectedFiles []string + expectedHelmReleaseAnnotations map[string]string + expectedNamespace map[string]string + nonStandardNamespace map[string]string +} + func TestUpdateNamespaceInYamlFiles(t *testing.T) { - tests := []struct { - folder string - hasReleaseName bool - expectedFiles []string - expectedHelmAnnotations map[string]string - }{ + tests := []test{ { folder: "output", hasReleaseName: false, @@ -27,6 +31,11 @@ func TestUpdateNamespaceInYamlFiles(t *testing.T) { "cluster/resources/nginx/nginx-ingress/nginx-ingress-clusterrole.yaml", "namespaces/jx/lighthouse/lighthouse-foghorn-deploy.yaml", }, + expectedNamespace: map[string]string{ + "customresourcedefinitions/jx/lighthouse/lighthousejobs.lighthouse.jenkins.io-crd.yaml": "jx", + "cluster/resources/nginx/nginx-ingress/nginx-ingress-clusterrole.yaml": "nginx", + "namespaces/jx/lighthouse/lighthouse-foghorn-deploy.yaml": "jx", + }, }, { folder: "dirIncludesReleaseName", @@ -39,48 +48,88 @@ func TestUpdateNamespaceInYamlFiles(t *testing.T) { "cluster/resources/nginx/nginx-ingress-2/nginx-ingress-clusterrole.yaml", "namespaces/jx/lighthouse-2/lighthouse-foghorn-deploy.yaml", "namespaces/jx/chart-release/example.yaml", + "namespaces/selenium-grid/keda-selenium/keda-operator-auth-reader-rb.yaml", }, - - expectedHelmAnnotations: map[string]string{ - "namespaces/jx/lighthouse-2/lighthouse-foghorn-deploy.yaml": "lighthouse-2", - "cluster/resources/nginx/nginx-ingress/nginx-ingress-clusterrole.yaml": "my-release-name", + expectedHelmReleaseAnnotations: map[string]string{ + "namespaces/jx/lighthouse-2/lighthouse-foghorn-deploy.yaml": "lighthouse-2", + "cluster/resources/nginx/nginx-ingress/nginx-ingress-clusterrole.yaml": "my-release-name", + "namespaces/selenium-grid/keda-selenium/keda-operator-auth-reader-rb.yaml": "selenium", + }, + expectedNamespace: map[string]string{ + "namespaces/jx/lighthouse-2/lighthouse-foghorn-deploy.yaml": "jx", + "cluster/resources/nginx/nginx-ingress/nginx-ingress-clusterrole.yaml": "nginx", + "customresourcedefinitions/jx/lighthouse/lighthousejobs.lighthouse.jenkins.io-crd.yaml": "jx", + "namespaces/jx/lighthouse/lighthouse-foghorn-deploy.yaml": "jx", + "customresourcedefinitions/jx/lighthouse-2/lighthousejobs.lighthouse.jenkins.io-crd.yaml": "jx", + "cluster/resources/nginx/nginx-ingress-2/nginx-ingress-clusterrole.yaml": "nginx", + "namespaces/jx/chart-release/example.yaml": "jx", + "namespaces/selenium-grid/keda-selenium/keda-operator-auth-reader-rb.yaml": "selenium-grid", + }, + nonStandardNamespace: map[string]string{ + "namespaces/selenium-grid/keda-selenium/keda-operator-auth-reader-rb.yaml": "kube-system", }, }, } for _, test := range tests { + testMove(t, test, true) + testMove(t, test, false) + } +} - tmpDir := t.TempDir() - - _, o := move.NewCmdHelmfileMove() +func testMove(t *testing.T, test test, overrideNamespace bool) { + _, o := move.NewCmdHelmfileMove() - t.Logf("generating output to %s\n", tmpDir) + o.Dir = filepath.Join("testdata", test.folder) + o.DirIncludesReleaseName = test.hasReleaseName - o.Dir = filepath.Join("testdata", test.folder) - o.OutputDir = tmpDir - o.DirIncludesReleaseName = test.hasReleaseName - o.AnnotateReleaseNames = true + tmpDir := t.TempDir() + t.Logf("generating output to namespace %s, override namespace: %t\n", tmpDir, overrideNamespace) + o.OutputDir = tmpDir + o.OverrideNamespace = overrideNamespace - err := o.Run() - require.NoError(t, err, "failed to run helmfile move") + err := o.Run() + require.NoError(t, err, "failed to run helmfile move") - for _, efn := range test.expectedFiles { - ef := filepath.Join(append([]string{tmpDir}, strings.Split(efn, "/")...)...) - assert.FileExists(t, ef) - t.Logf("generated expected file %s\n", ef) + for _, efn := range test.expectedFiles { + ef := filepath.Join(append([]string{tmpDir}, strings.Split(efn, "/")...)...) + assert.FileExists(t, ef) + t.Logf("generated expected file %s\n", ef) - if test.expectedHelmAnnotations != nil { - expectedAnnotation := test.expectedHelmAnnotations[efn] - if expectedAnnotation != "" { - u := &unstructured.Unstructured{} - err = yamls.LoadFile(ef, u) - require.NoError(t, err, "failed to load %s", ef) - ann := u.GetAnnotations() - require.NotNil(t, ann, "should have annotations for file %s", ef) - annotation := move.HelmReleaseNameAnnotation - value := ann[annotation] - assert.Equal(t, expectedAnnotation, value, "for annotation %s in file %s", annotation, ef) - t.Logf("expected helm annotation is %s\n", value) + if test.expectedHelmReleaseAnnotations != nil { + expectedAnnotation := test.expectedHelmReleaseAnnotations[efn] + if expectedAnnotation != "" { + u := &unstructured.Unstructured{} + err = yamls.LoadFile(ef, u) + require.NoError(t, err, "failed to load %s", ef) + ann := u.GetAnnotations() + require.NotNil(t, ann, "should have annotations for file %s", ef) + annotation := move.HelmReleaseNameAnnotation + value := ann[annotation] + assert.Equal(t, expectedAnnotation, value, "for annotation %s in file %s", annotation, ef) + t.Logf("expected helm annotation is %s\n", value) + } + } + if test.expectedNamespace != nil { + expectedNS := test.expectedNamespace[efn] + if expectedNS != "" { + u := &unstructured.Unstructured{} + err = yamls.LoadFile(ef, u) + require.NoError(t, err, "failed to load %s", ef) + ann := u.GetAnnotations() + require.NotNil(t, ann, "should have annotations for file %s", ef) + annotation := move.HelmReleaseNameSpaceAnnotation + value := ann[annotation] + assert.Equal(t, expectedNS, value, "for annotation %s in file %s", annotation, ef) + t.Logf("expected namespace annotation is %s\n", value) + nonStandardNS, hasNonStandardNS := test.nonStandardNamespace[efn] + ns := u.GetNamespace() + if overrideNamespace || !hasNonStandardNS { + if ns != "" { + assert.Equal(t, expectedNS, ns, "for namespace %s in file %s", annotation, ef) + } + } else { + assert.Equal(t, nonStandardNS, ns, "for namespace %s in file %s", annotation, ef) } } } diff --git a/pkg/cmd/helmfile/move/testdata/dirIncludesReleaseName/selenium-grid/selenium/keda/templates/keda-operator-auth-reader-rb.yaml b/pkg/cmd/helmfile/move/testdata/dirIncludesReleaseName/selenium-grid/selenium/keda/templates/keda-operator-auth-reader-rb.yaml new file mode 100644 index 000000000..de3344cfc --- /dev/null +++ b/pkg/cmd/helmfile/move/testdata/dirIncludesReleaseName/selenium-grid/selenium/keda/templates/keda-operator-auth-reader-rb.yaml @@ -0,0 +1,21 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/name: keda-operator-auth-reader + helm.sh/chart: keda-2.15.2 + app.kubernetes.io/component: operator + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/part-of: keda-operator + app.kubernetes.io/version: 2.15.1 + app.kubernetes.io/instance: selenium + name: keda-operator-auth-reader + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: extension-apiserver-authentication-reader +subjects: + - kind: ServiceAccount + name: keda-metrics-server + namespace: selenium-grid From f0d2c68192b446d0819248d79ef766abfb1107e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Wed, 6 Nov 2024 12:25:57 +0100 Subject: [PATCH 2/2] docs: regenerating --- Makefile | 1 + docs/cmd/jx-gitops_helm.md | 4 +-- docs/cmd/jx-gitops_helm_mirror.md | 14 ++++++---- docs/cmd/jx-gitops_helmfile_move.md | 36 ++++++++++++++----------- docs/man/man1/jx-gitops-helm-mirror.1 | 18 ++++++++++--- docs/man/man1/jx-gitops-helmfile-move.1 | 20 +++++++++++--- 6 files changed, 64 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 6fa05d07c..5728594d6 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,7 @@ lint: ## Lint the code all: fmt build test lint generate-refdocs install-refdocs: + $(GO) get github.com/jenkins-x/gen-crd-api-reference-docs $(GO) install github.com/jenkins-x/gen-crd-api-reference-docs generate-refdocs: install-refdocs diff --git a/docs/cmd/jx-gitops_helm.md b/docs/cmd/jx-gitops_helm.md index d5374f4bb..f94fcb90a 100644 --- a/docs/cmd/jx-gitops_helm.md +++ b/docs/cmd/jx-gitops_helm.md @@ -23,8 +23,8 @@ Commands for working with helm charts * [jx-gitops](jx-gitops.md) - commands for working with GitOps based git repositories * [jx-gitops helm build](jx-gitops_helm_build.md) - Builds and lints any helm charts * [jx-gitops helm escape](jx-gitops_helm_escape.md) - Escapes any {{ or }} characters in the YAML files so they can be included in a helm chart -* [jx-gitops helm mirror](jx-gitops_helm_mirror.md) - Creates a helm mirror +* [jx-gitops helm mirror](jx-gitops_helm_mirror.md) - Mirror a helm repository * [jx-gitops helm release](jx-gitops_helm_release.md) - Performs a release of all the charts in the charts folder * [jx-gitops helm template](jx-gitops_helm_template.md) - Generate the kubernetes resources from a helm chart -###### Auto generated by spf13/cobra on 5-Oct-2022 +###### Auto generated by spf13/cobra on 6-Nov-2024 diff --git a/docs/cmd/jx-gitops_helm_mirror.md b/docs/cmd/jx-gitops_helm_mirror.md index c9c22ed1f..64488aba7 100644 --- a/docs/cmd/jx-gitops_helm_mirror.md +++ b/docs/cmd/jx-gitops_helm_mirror.md @@ -1,6 +1,6 @@ ## jx-gitops helm mirror -Creates a helm mirror +Mirror a helm repository ### Usage @@ -10,12 +10,15 @@ jx-gitops helm mirror ### Synopsis -Escapes any {{ or }} characters in the YAML files so they can be included in a helm chart +Mirrors a set of remote Helm repositories specified locally in charts/repositories.yml to a remote git repository ### Examples - # escapes any yaml files so they can be included in a helm chart - jx-gitops helm escape --dir myyaml + # Mirror all Helm repositories defined in charts/repositories.yml to a default github pages branch + jx-gitops mirror --url=https://github.com/example/charts.git --no-push=false + + # Run the mirror command, ignoring unused repositories + %!s(MISSING) mirror --url=https://github.com/example/charts.git --no-push=false --exclude=bitnami ### Options @@ -29,6 +32,7 @@ Escapes any {{ or }} characters in the YAML files so they can be included in a h --git-username string the git username used to operate on the git repository. If not specified it's loaded from the git credentials file -h, --help help for mirror -m, --message string the commit message (default "chore: upgrade mirrored charts") + --no-push disables pushing changes back to the git repository (default true) -u, --url string the git URL of the repository to mirror the charts into ``` @@ -36,4 +40,4 @@ Escapes any {{ or }} characters in the YAML files so they can be included in a h * [jx-gitops helm](jx-gitops_helm.md) - Commands for working with helm charts -###### Auto generated by spf13/cobra on 5-Oct-2022 +###### Auto generated by spf13/cobra on 6-Nov-2024 diff --git a/docs/cmd/jx-gitops_helmfile_move.md b/docs/cmd/jx-gitops_helmfile_move.md index 4ef9d8294..250fec1cd 100644 --- a/docs/cmd/jx-gitops_helmfile_move.md +++ b/docs/cmd/jx-gitops_helmfile_move.md @@ -12,13 +12,17 @@ jx-gitops helmfile move ### Synopsis -Moves the generated template files from 'helmfile template' into the right gitops directory - +Moves the generated template files from 'helmfile template' into the right gitops directory. + The output of 'helmfile template' ignores the namespace specified in the 'helmfile.yaml' and there is a dummy top level directory. -So this command applies the namespace to all the generated resources and then moves the namespaced resources into the config-root/namespaces/$ns/$releaseName directory and then moves any CRDs or cluster level resources into 'config-root/cluster/$releaseName' +So by default this command applies the namespace to all the generated resources + +Then it moves the namespaced resources into the config-root/namespaces/$ns/$releaseName directory and any CRDs or cluster level resources into 'config-root/cluster/$releaseName'. + +If supplied with --dir-includes-release-name then by default we will annotate the resources with the annotations "app.kubernetes.io/instance" to preserve the helm release name. -If supplied with --dir-includes-release-name then by default we will annotate the resources with the annotation 'meta.helm.sh/release-name' to preserve the helm release name +The annotation "meta.helm.sh/release-namespace" will be added by default and contain the namespace specified in the release. ### Examples @@ -28,20 +32,22 @@ If supplied with --dir-includes-release-name then by default we will annotate th ### Options ``` - --annotate-release-name if using --dir-includes-release-name layout then lets add the 'meta.helm.sh/release-name' annotation to record the helm release name (default true) - --dir string the directory containing the generated resources - --dir-includes-release-name the directory containing the generated resources has a path segment that is the release name - -h, --help help for move - --invert-selector inverts the effect of selector to exclude resources matched by selector - -k, --kind stringArray adds Kubernetes resource kinds to filter on. For kind expressions see: https://github.com/jenkins-x/jx-helpers/tree/master/docs/kind_filters.md - --kind-ignore stringArray adds Kubernetes resource kinds to exclude. For kind expressions see: https://github.com/jenkins-x/jx-helpers/tree/master/docs/kind_filters.md - -o, --output-dir string the output directory (default "config-root") - --selector stringToString adds Kubernetes label selector to filter on, e.g. --selector app=pusher-wave,heritage=Helm (default []) - --selector-target string sets which path in the Kubernetes resources to select on instead of metadata.labels. + --annotate-release-name if using --dir-includes-release-name layout then lets add the 'meta.helm.sh/release-name' annotation to record the helm release name (default true) + --annotate-release-namespace add the 'meta.helm.sh/release-namespace' annotation to record the helm release namespace (default true) + --dir string the directory containing the generated resources + --dir-includes-release-name the directory containing the generated resources has a path segment that is the release name + -h, --help help for move + --invert-selector inverts the effect of selector to exclude resources matched by selector + -k, --kind stringArray adds Kubernetes resource kinds to filter on. For kind expressions see: https://github.com/jenkins-x/jx-helpers/tree/master/docs/kind_filters.md + --kind-ignore stringArray adds Kubernetes resource kinds to exclude. For kind expressions see: https://github.com/jenkins-x/jx-helpers/tree/master/docs/kind_filters.md + -o, --output-dir string the output directory (default "config-root") + --override-namespace applies the namespace specified in helmfile to all the generated resources (default true) + --selector stringToString adds Kubernetes label selector to filter on, e.g. --selector app=pusher-wave,heritage=Helm (default []) + --selector-target string sets which path in the Kubernetes resources to select on instead of metadata.labels. ``` ### SEE ALSO * [jx-gitops helmfile](jx-gitops_helmfile.md) - Commands for working with helmfile -###### Auto generated by spf13/cobra on 7-Oct-2024 +###### Auto generated by spf13/cobra on 6-Nov-2024 diff --git a/docs/man/man1/jx-gitops-helm-mirror.1 b/docs/man/man1/jx-gitops-helm-mirror.1 index cd7f8c5b5..addd550a0 100644 --- a/docs/man/man1/jx-gitops-helm-mirror.1 +++ b/docs/man/man1/jx-gitops-helm-mirror.1 @@ -5,7 +5,7 @@ .SH NAME .PP -jx\-gitops\-helm\-mirror \- Creates a helm mirror +jx\-gitops\-helm\-mirror \- Mirror a helm repository .SH SYNOPSIS @@ -15,7 +15,7 @@ jx\-gitops\-helm\-mirror \- Creates a helm mirror .SH DESCRIPTION .PP -Escapes any {{ or }} characters in the YAML files so they can be included in a helm chart +Mirrors a set of remote Helm repositories specified locally in charts/repositories.yml to a remote git repository .SH OPTIONS @@ -55,6 +55,10 @@ Escapes any {{ or }} characters in the YAML files so they can be included in a h \fB\-m\fP, \fB\-\-message\fP="chore: upgrade mirrored charts" the commit message +.PP +\fB\-\-no\-push\fP[=true] + disables pushing changes back to the git repository + .PP \fB\-u\fP, \fB\-\-url\fP="" the git URL of the repository to mirror the charts into @@ -62,8 +66,14 @@ Escapes any {{ or }} characters in the YAML files so they can be included in a h .SH EXAMPLE .PP -# escapes any yaml files so they can be included in a helm chart - jx\-gitops helm escape \-\-dir myyaml +# Mirror all Helm repositories defined in charts/repositories.yml to a default github pages branch + jx\-gitops mirror \-\-url= +\[la]https://github.com/example/charts.git\[ra] \-\-no\-push=false + +.PP +# Run the mirror command, ignoring unused repositories + %!s(MISSING) mirror \-\-url= +\[la]https://github.com/example/charts.git\[ra] \-\-no\-push=false \-\-exclude=bitnami .SH SEE ALSO diff --git a/docs/man/man1/jx-gitops-helmfile-move.1 b/docs/man/man1/jx-gitops-helmfile-move.1 index 0a958fa68..cbb037c9f 100644 --- a/docs/man/man1/jx-gitops-helmfile-move.1 +++ b/docs/man/man1/jx-gitops-helmfile-move.1 @@ -15,16 +15,22 @@ jx\-gitops\-helmfile\-move \- Moves the generated template files from 'helmfile .SH DESCRIPTION .PP -Moves the generated template files from 'helmfile template' into the right gitops directory +Moves the generated template files from 'helmfile template' into the right gitops directory. .PP The output of 'helmfile template' ignores the namespace specified in the 'helmfile.yaml' and there is a dummy top level directory. .PP -So this command applies the namespace to all the generated resources and then moves the namespaced resources into the config\-root/namespaces/$ns/$releaseName directory and then moves any CRDs or cluster level resources into 'config\-root/cluster/$releaseName' +So by default this command applies the namespace to all the generated resources .PP -If supplied with \-\-dir\-includes\-release\-name then by default we will annotate the resources with the annotation 'meta.helm.sh/release\-name' to preserve the helm release name +Then it moves the namespaced resources into the config\-root/namespaces/$ns/$releaseName directory and any CRDs or cluster level resources into 'config\-root/cluster/$releaseName'. + +.PP +If supplied with \-\-dir\-includes\-release\-name then by default we will annotate the resources with the annotations "app.kubernetes.io/instance" to preserve the helm release name. + +.PP +The annotation "meta.helm.sh/release\-namespace" will be added by default and contain the namespace specified in the release. .SH OPTIONS @@ -32,6 +38,10 @@ If supplied with \-\-dir\-includes\-release\-name then by default we will annota \fB\-\-annotate\-release\-name\fP[=true] if using \-\-dir\-includes\-release\-name layout then lets add the 'meta.helm.sh/release\-name' annotation to record the helm release name +.PP +\fB\-\-annotate\-release\-namespace\fP[=true] + add the 'meta.helm.sh/release\-namespace' annotation to record the helm release namespace + .PP \fB\-\-dir\fP="" the directory containing the generated resources @@ -62,6 +72,10 @@ If supplied with \-\-dir\-includes\-release\-name then by default we will annota \fB\-o\fP, \fB\-\-output\-dir\fP="config\-root" the output directory +.PP +\fB\-\-override\-namespace\fP[=true] + applies the namespace specified in helmfile to all the generated resources + .PP \fB\-\-selector\fP=[] adds Kubernetes label selector to filter on, e.g. \-\-selector app=pusher\-wave,heritage=Helm