1
0
mirror of synced 2026-03-01 11:16:56 +00:00

Compare commits

..

17 Commits

Author SHA1 Message Date
Stefan Prodan
c2c64a70c4 Merge pull request #2042 from fluxcd/ecdsa-default
Set ECDSA as the default algorithm for `flux create source git`
2021-11-02 17:42:49 +02:00
Stefan Prodan
4621576f40 Set ECDSA as the default algorithm for flux create source git
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-02 17:21:10 +02:00
Stefan Prodan
3b609e9b03 Merge pull request #2041 from fluxcd/bootstrap-ecdsa-default
bootstrap: Set ECDSA as the default SSH key algorithm
2021-11-02 17:15:57 +02:00
Stefan Prodan
4f2ebd78be Set ECDSA as the default algorithm for flux create secret git
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-02 16:49:17 +02:00
Stefan Prodan
88dacebc94 bootstrap: Set ECDSA as the default SSH key algorithm
Motivation: RSA SHA-1 SSH keys are no longer accepted by GitHub https://github.blog/2021-09-01-improving-git-protocol-security-github/.
Given this we are switching the default from RSA to ECDSA for `git`, `github` and `gitlab` variants of `flux bootstrap`.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-02 16:22:16 +02:00
Stefan Prodan
92e7d1ad1e Merge pull request #2036 from fluxcd/part-of-selector
Switch to `app.kubernetes.io/part-of` label selector
2021-11-01 18:37:03 +02:00
Stefan Prodan
d5d8c340c8 Switch to app.kubernetes.io/part-of label selector
Use `app.kubernetes.io/part-of: flux` label instead of `app.kubernetes.io/instance` to select the in-cluster objects used in flux version, check, logs and uninstall commands.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-01 18:02:49 +02:00
Stefan Prodan
b8a85b809a Merge pull request #2035 from fluxcd/source-fetch-timeout
Add fetch timeout arg to create source commands
2021-11-01 16:06:12 +02:00
Stefan Prodan
61be0775af Add fetch timeout arg to create source commands
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-01 15:37:58 +02:00
Stefan Prodan
404ffa5a91 Merge pull request #2034 from fluxcd/default-namespace-from-env
Set default ns with `FLUX_SYSTEM_NAMESPACE` env var
2021-11-01 14:56:47 +02:00
Stefan Prodan
f2de7e04b8 Set default ns with FLUX_SYSTEM_NAMESPACE env var
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-01 14:21:44 +02:00
Stefan Prodan
8b3e3b1dd7 Merge pull request #2033 from fluxcd/update-issue-template
Add flux version to issue template
2021-11-01 13:07:35 +02:00
Stefan Prodan
81e91ac3f5 Add flux version to issue template
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-01 12:46:52 +02:00
Stefan Prodan
b9bde94d08 Merge pull request #2032 from fluxcd/tree-completion
Enable completion for flux tree cmd
2021-11-01 12:40:36 +02:00
Stefan Prodan
37746023c1 Enable completion for flux tree cmd
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-01 12:19:06 +02:00
Stefan Prodan
d3e529b8a4 Merge pull request #2015 from SomtochiAma/test-export-cmd
Add unit tests for export
2021-11-01 12:18:55 +02:00
Somtochi Onyekwere
eb69083ef5 Add unit tests for export
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-11-01 10:46:07 +01:00
28 changed files with 484 additions and 19 deletions

View File

@@ -48,19 +48,18 @@ body:
required: true
attributes:
label: Flux version
description: Run `flux --version` to check. If not applicable, write `N/A`.
placeholder: e.g. 0.16.1
description: Run `flux version --client`. If not applicable, write `N/A`.
placeholder: e.g. v0.20.1
- type: textarea
validations:
required: true
attributes:
label: Flux check
description: Run `flux check` to check. If not applicable, write `N/A`.
description: Run `flux check`. If not applicable, write `N/A`.
placeholder: |
For example:
► checking prerequisites
kubectl 1.21.0 >=1.18.0-0
✔ Kubernetes 1.21.1 >=1.16.0-0
Kubernetes 1.21.1 >=1.19.0-0
► checking controllers
✔ all checks passed
- type: input

View File

@@ -140,7 +140,7 @@ func NewBootstrapFlags() bootstrapFlags {
return bootstrapFlags{
logLevel: flags.LogLevel(rootArgs.defaults.LogLevel),
requiredComponents: []string{"source-controller", "kustomize-controller"},
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.RSAPrivateKeyAlgorithm),
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.ECDSAPrivateKeyAlgorithm),
keyRSABits: 2048,
keyECDSACurve: flags.ECDSACurve{Curve: elliptic.P384()},
}

View File

@@ -30,6 +30,7 @@ import (
"github.com/fluxcd/pkg/version"
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/manifestgen"
"github.com/fluxcd/flux2/pkg/manifestgen/install"
"github.com/fluxcd/flux2/pkg/status"
)
@@ -191,7 +192,7 @@ func componentsCheck() bool {
}
ok := true
selector := client.MatchingLabels{"app.kubernetes.io/instance": rootArgs.namespace}
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
var list v1.DeploymentList
if err := kubeClient.List(ctx, &list, client.InNamespace(rootArgs.namespace), selector); err == nil {
for _, d := range list.Items {

View File

@@ -105,7 +105,7 @@ func init() {
func NewSecretGitFlags() secretGitFlags {
return secretGitFlags{
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.RSAPrivateKeyAlgorithm),
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.ECDSAPrivateKeyAlgorithm),
rsaBits: 2048,
ecdsaCurve: flags.ECDSACurve{Curve: elliptic.P384()},
}

View File

@@ -17,6 +17,8 @@ limitations under the License.
package main
import (
"time"
"github.com/spf13/cobra"
)
@@ -26,6 +28,14 @@ var createSourceCmd = &cobra.Command{
Long: "The create source sub-commands generate sources.",
}
type createSourceFlags struct {
fetchTimeout time.Duration
}
var createSourceArgs createSourceFlags
func init() {
createSourceCmd.PersistentFlags().DurationVar(&createSourceArgs.fetchTimeout, "fetch-timeout", createSourceArgs.fetchTimeout,
"set a timeout for fetch operations performed by source-controller (e.g. 'git clone' or 'helm repo update')")
createCmd.AddCommand(createSourceCmd)
}

View File

@@ -134,6 +134,11 @@ func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
},
},
}
if createSourceArgs.fetchTimeout > 0 {
bucket.Spec.Timeout = &metav1.Duration{Duration: createSourceArgs.fetchTimeout}
}
if sourceBucketArgs.secretRef != "" {
bucket.Spec.SecretRef = &meta.LocalObjectReference{
Name: sourceBucketArgs.secretRef,

View File

@@ -143,7 +143,7 @@ func init() {
func newSourceGitFlags() sourceGitFlags {
return sourceGitFlags{
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.RSAPrivateKeyAlgorithm),
keyAlgorithm: flags.PublicKeyAlgorithm(sourcesecret.ECDSAPrivateKeyAlgorithm),
keyRSABits: 2048,
keyECDSACurve: flags.ECDSACurve{Curve: elliptic.P384()},
}
@@ -206,6 +206,10 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
},
}
if createSourceArgs.fetchTimeout > 0 {
gitRepository.Spec.Timeout = &metav1.Duration{Duration: createSourceArgs.fetchTimeout}
}
if sourceGitArgs.gitImplementation != "" {
gitRepository.Spec.GitImplementation = sourceGitArgs.gitImplementation.String()
}

View File

@@ -129,6 +129,10 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
},
}
if createSourceArgs.fetchTimeout > 0 {
helmRepository.Spec.Timeout = &metav1.Duration{Duration: createSourceArgs.fetchTimeout}
}
if sourceHelmArgs.secretRef != "" {
helmRepository.Spec.SecretRef = &meta.LocalObjectReference{
Name: sourceHelmArgs.secretRef,

View File

@@ -113,8 +113,8 @@ func printExport(export interface{}) error {
if err != nil {
return err
}
fmt.Println("---")
fmt.Println(resourceToString(data))
rootCmd.Println("---")
rootCmd.Println(resourceToString(data))
return nil
}

88
cmd/flux/export_test.go Normal file
View File

@@ -0,0 +1,88 @@
// +build unit
package main
import (
"testing"
)
func TestExport(t *testing.T) {
cases := []struct {
name string
arg string
goldenFile string
}{
{
"alert-provider",
"export alert-provider slack",
"testdata/export/provider.yaml",
},
{
"alert",
"export alert flux-system",
"testdata/export/alert.yaml",
},
{
"image policy",
"export image policy flux-system",
"testdata/export/image-policy.yaml",
},
{
"image repository",
"export image repository flux-system",
"testdata/export/image-repo.yaml",
},
{
"image update",
"export image update flux-system",
"testdata/export/image-update.yaml",
},
{
"source git",
"export source git flux-system",
"testdata/export/git-repo.yaml",
},
{
"source helm",
"export source helm flux-system",
"testdata/export/helm-repo.yaml",
},
{
"receiver",
"export receiver flux-system",
"testdata/export/receiver.yaml",
},
{
"kustomization",
"export kustomization flux-system",
"testdata/export/ks.yaml",
},
{
"helmrelease",
"export helmrelease flux-system",
"testdata/export/helm-release.yaml",
},
{
"bucket",
"export source bucket flux-system",
"testdata/export/bucket.yaml",
},
}
objectFile := "testdata/export/objects.yaml"
tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"),
}
testEnv.CreateObjectFile(objectFile, tmpl, t)
for _, tt := range cases {
t.Run(tt.name, func(t *testing.T) {
cmd := cmdTestCase{
args: tt.arg + " -n=" + tmpl["fluxns"],
assert: assertGoldenTemplateFile(tt.goldenFile, tmpl),
}
cmd.runTestCmd(t)
})
}
}

View File

@@ -39,6 +39,7 @@ import (
"github.com/fluxcd/flux2/internal/flags"
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/manifestgen"
)
var logsCmd = &cobra.Command{
@@ -93,7 +94,7 @@ func init() {
}
func logsCmdRun(cmd *cobra.Command, args []string) error {
fluxSelector := fmt.Sprintf("app.kubernetes.io/instance=%s", logsArgs.fluxNamespace)
fluxSelector := fmt.Sprintf("%s=%s", manifestgen.PartOfLabelKey, manifestgen.PartOfLabelValue)
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()

View File

@@ -107,7 +107,8 @@ type rootFlags struct {
var rootArgs = NewRootFlags()
func init() {
rootCmd.PersistentFlags().StringVarP(&rootArgs.namespace, "namespace", "n", rootArgs.defaults.Namespace, "the namespace scope for this operation")
rootCmd.PersistentFlags().StringVarP(&rootArgs.namespace, "namespace", "n", rootArgs.defaults.Namespace,
"the namespace scope for this operation, can be set with FLUX_SYSTEM_NAMESPACE env var")
rootCmd.RegisterFlagCompletionFunc("namespace", resourceNamesCompletionFunc(corev1.SchemeGroupVersion.WithKind("Namespace")))
rootCmd.PersistentFlags().DurationVar(&rootArgs.timeout, "timeout", 5*time.Minute, "timeout for this operation")
@@ -134,6 +135,7 @@ func NewRootFlags() rootFlags {
func main() {
log.SetFlags(0)
configureKubeconfig()
configureDefaultNamespace()
if err := rootCmd.Execute(); err != nil {
logger.Failuref("%v", err)
os.Exit(1)
@@ -152,6 +154,13 @@ func configureKubeconfig() {
}
}
func configureDefaultNamespace() {
fromEnv := os.Getenv("FLUX_SYSTEM_NAMESPACE")
if fromEnv != "" && rootArgs.namespace == rootArgs.defaults.Namespace {
rootArgs.namespace = fromEnv
}
}
func homeDir() string {
if h := os.Getenv("HOME"); h != "" {
return h

17
cmd/flux/testdata/export/alert.yaml vendored Normal file
View File

@@ -0,0 +1,17 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
eventSeverity: info
eventSources:
- kind: GitRepository
name: '*'
- kind: Kustomization
name: '*'
providerRef:
name: slack
summary: Slacktest Notification

14
cmd/flux/testdata/export/bucket.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: Bucket
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
bucketName: podinfo
endpoint: s3.amazonaws.com
interval: 5m0s
provider: aws
region: us-east-1
timeout: 30s

16
cmd/flux/testdata/export/git-repo.yaml vendored Normal file
View File

@@ -0,0 +1,16 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
gitImplementation: go-git
interval: 5m0s
ref:
branch: main
secretRef:
name: flux-system
timeout: 20s
url: ssh://git@github.com/example/repo

View File

@@ -0,0 +1,18 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
chart:
spec:
chart: podinfo
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: flux-systen
namespace: {{ .fluxns }}
version: '*'
interval: 5m0s

11
cmd/flux/testdata/export/helm-repo.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m0s
timeout: 1m0s
url: https://stefanprodan.github.io/podinfo

View File

@@ -0,0 +1,13 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
imageRepositoryRef:
name: flux-system
policy:
semver:
range: 5.0.x

View File

@@ -0,0 +1,10 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
image: ghcr.io/test/podinfo
interval: 1m0s

View File

@@ -0,0 +1,20 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
git:
commit:
author:
email: fluxcdbot@users.noreply.github.com
name: fluxcdbot
interval: 1m0s
sourceRef:
kind: GitRepository
name: flux-system
update:
path: ./clusters/my-cluster
strategy: Setters

14
cmd/flux/testdata/export/ks.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m0s
path: ./infrastructure/
prune: true
sourceRef:
kind: GitRepository
name: flux-system

153
cmd/flux/testdata/export/objects.yaml vendored Normal file
View File

@@ -0,0 +1,153 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .fluxns }}
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: slack
namespace: {{ .fluxns }}
spec:
type: slack
channel: 'A channel with spacess'
address: https://hooks.slack.com/services/mock
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
summary: "Slacktest Notification"
providerRef:
name: slack
eventSeverity: info
eventSources:
- kind: "GitRepository"
name: "*"
- kind: "Kustomization"
name: "*"
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
image: ghcr.io/test/podinfo
interval: 1m0s
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
imageRepositoryRef:
name: flux-system
policy:
semver:
range: 5.0.x
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 1m0s
sourceRef:
kind: GitRepository
name: flux-system
git:
commit:
author:
email: fluxcdbot@users.noreply.github.com
name: fluxcdbot
messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
update:
path: ./clusters/my-cluster
strategy: Setters
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
ref:
branch: main
secretRef:
name: flux-system
interval: 5m
url: ssh://git@github.com/example/repo
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
path: ./infrastructure/
sourceRef:
kind: GitRepository
name: flux-system
interval: 5m
prune: true
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
type: github
events:
- "ping"
- "push"
secretRef:
name: webhook-token
resources:
- kind: GitRepository
name: flux-system
namespace: flux-system
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
timeout: 1m0s
url: https://stefanprodan.github.io/podinfo
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
chart:
spec:
chart: podinfo
sourceRef:
kind: HelmRepository
name: flux-systen
namespace: {{ .fluxns }}
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: Bucket
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
provider: aws
bucketName: podinfo
endpoint: s3.amazonaws.com
region: us-east-1
timeout: 30s

11
cmd/flux/testdata/export/provider.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: slack
namespace: {{ .fluxns }}
spec:
address: https://hooks.slack.com/services/mock
channel: A channel with spacess
type: slack

18
cmd/flux/testdata/export/receiver.yaml vendored Normal file
View File

@@ -0,0 +1,18 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
events:
- ping
- push
resources:
- kind: GitRepository
name: flux-system
namespace: flux-system
secretRef:
name: webhook-token
type: github

View File

@@ -50,7 +50,8 @@ var treeKsCmd = &cobra.Command{
# Print the Flux resources managed by the root Kustomization
flux tree kustomization flux-system --compact`,
RunE: treeKsCmdRun,
RunE: treeKsCmdRun,
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
}
type TreeKsFlags struct {

View File

@@ -31,6 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/manifestgen"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
@@ -93,7 +94,7 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
uninstallFinalizers(ctx, kubeClient, uninstallArgs.dryRun)
logger.Actionf("deleting toolkit.fluxcd.io custom resource definitions")
uninstallCustomResourceDefinitions(ctx, kubeClient, rootArgs.namespace, uninstallArgs.dryRun)
uninstallCustomResourceDefinitions(ctx, kubeClient, uninstallArgs.dryRun)
if !uninstallArgs.keepNamespace {
uninstallNamespace(ctx, kubeClient, rootArgs.namespace, uninstallArgs.dryRun)
@@ -105,7 +106,7 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
func uninstallComponents(ctx context.Context, kubeClient client.Client, namespace string, dryRun bool) {
opts, dryRunStr := getDeleteOptions(dryRun)
selector := client.MatchingLabels{"app.kubernetes.io/instance": namespace}
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
{
var list appsv1.DeploymentList
if err := kubeClient.List(ctx, &list, client.InNamespace(namespace), selector); err == nil {
@@ -262,9 +263,9 @@ func uninstallFinalizers(ctx context.Context, kubeClient client.Client, dryRun b
}
}
func uninstallCustomResourceDefinitions(ctx context.Context, kubeClient client.Client, namespace string, dryRun bool) {
func uninstallCustomResourceDefinitions(ctx context.Context, kubeClient client.Client, dryRun bool) {
opts, dryRunStr := getDeleteOptions(dryRun)
selector := client.MatchingLabels{"app.kubernetes.io/instance": namespace}
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
{
var list apiextensionsv1.CustomResourceDefinitionList
if err := kubeClient.List(ctx, &list, selector); err == nil {

View File

@@ -28,6 +28,7 @@ import (
"sigs.k8s.io/yaml"
"github.com/fluxcd/flux2/internal/utils"
"github.com/fluxcd/flux2/pkg/manifestgen"
)
var versionCmd = &cobra.Command{
@@ -78,7 +79,7 @@ func versionCmdRun(cmd *cobra.Command, args []string) error {
return err
}
selector := client.MatchingLabels{"app.kubernetes.io/instance": rootArgs.namespace}
selector := client.MatchingLabels{manifestgen.PartOfLabelKey: manifestgen.PartOfLabelValue}
var list v1.DeploymentList
if err := kubeClient.List(ctx, &list, client.InNamespace(rootArgs.namespace), selector); err != nil {
return err

26
pkg/manifestgen/labels.go Normal file
View File

@@ -0,0 +1,26 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package manifestgen
// These labels can be used to track down the namespace, custom resource definitions, deployments,
// services, network policies, service accounts, cluster roles and cluster role bindings belonging to Flux.
const (
PartOfLabelKey = "app.kubernetes.io/part-of"
PartOfLabelValue = "flux"
InstanceLabelKey = "app.kubernetes.io/instance"
VersionLabelKey = "app.kubernetes.io/version"
)