Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2eb004ed | ||
|
|
c3e5b18b8c |
@@ -96,25 +96,6 @@ Then you can run the end-to-end tests with:
|
|||||||
make e2e
|
make e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
When the output of the Flux CLI changes, to automatically update the golden
|
|
||||||
files used in the test, pass `-update` flag to the test as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make e2e TEST_ARGS="-update"
|
|
||||||
```
|
|
||||||
|
|
||||||
Since not all packages use golden files for testing, `-update` argument must be
|
|
||||||
passed only for the packages that use golden files. Use the variables
|
|
||||||
`TEST_PKG_PATH` for unit tests and `E2E_TEST_PKG_PATH` for e2e tests, to set the
|
|
||||||
path of the target test package:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Unit test
|
|
||||||
make test TEST_PKG_PATH="./cmd/flux" TEST_ARGS="-update"
|
|
||||||
# e2e test
|
|
||||||
make e2e E2E_TEST_PKG_PATH="./cmd/flux" TEST_ARGS="-update"
|
|
||||||
```
|
|
||||||
|
|
||||||
Teardown the e2e environment with:
|
Teardown the e2e environment with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
10
Makefile
10
Makefile
@@ -16,8 +16,8 @@ rwildcard=$(foreach d,$(wildcard $(addsuffix *,$(1))),$(call rwildcard,$(d)/,$(2
|
|||||||
all: test build
|
all: test build
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
go mod tidy -compat=1.17
|
go mod tidy
|
||||||
cd tests/azure && go mod tidy -compat=1.17
|
cd tests/azure && go mod tidy
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
go fmt ./...
|
go fmt ./...
|
||||||
@@ -35,13 +35,11 @@ cleanup-kind:
|
|||||||
rm $(TEST_KUBECONFIG)
|
rm $(TEST_KUBECONFIG)
|
||||||
|
|
||||||
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
|
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
|
||||||
TEST_PKG_PATH="./..."
|
|
||||||
test: $(EMBEDDED_MANIFESTS_TARGET) tidy fmt vet install-envtest
|
test: $(EMBEDDED_MANIFESTS_TARGET) tidy fmt vet install-envtest
|
||||||
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test $(TEST_PKG_PATH) -coverprofile cover.out --tags=unit $(TEST_ARGS)
|
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test ./... -coverprofile cover.out --tags=unit
|
||||||
|
|
||||||
E2E_TEST_PKG_PATH="./cmd/flux/..."
|
|
||||||
e2e: $(EMBEDDED_MANIFESTS_TARGET) tidy fmt vet
|
e2e: $(EMBEDDED_MANIFESTS_TARGET) tidy fmt vet
|
||||||
TEST_KUBECONFIG=$(TEST_KUBECONFIG) go test $(E2E_TEST_PKG_PATH) -coverprofile e2e.cover.out --tags=e2e -v -failfast $(TEST_ARGS)
|
TEST_KUBECONFIG=$(TEST_KUBECONFIG) go test ./cmd/flux/... -coverprofile e2e.cover.out --tags=e2e -v -failfast
|
||||||
|
|
||||||
test-with-kind: install-envtest
|
test-with-kind: install-envtest
|
||||||
make setup-kind
|
make setup-kind
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import (
|
|||||||
// notificationv1.Alert
|
// notificationv1.Alert
|
||||||
|
|
||||||
var alertType = apiType{
|
var alertType = apiType{
|
||||||
kind: notificationv1.AlertKind,
|
kind: notificationv1.AlertKind,
|
||||||
humanKind: "alert",
|
humanKind: "alert",
|
||||||
groupVersion: notificationv1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type alertAdapter struct {
|
type alertAdapter struct {
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import (
|
|||||||
// notificationv1.Provider
|
// notificationv1.Provider
|
||||||
|
|
||||||
var alertProviderType = apiType{
|
var alertProviderType = apiType{
|
||||||
kind: notificationv1.ProviderKind,
|
kind: notificationv1.ProviderKind,
|
||||||
humanKind: "alert provider",
|
humanKind: "alert provider",
|
||||||
groupVersion: notificationv1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type alertProviderAdapter struct {
|
type alertProviderAdapter struct {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ func init() {
|
|||||||
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapArgs.defaultComponents, "components", rootArgs.defaults.Components,
|
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapArgs.defaultComponents, "components", rootArgs.defaults.Components,
|
||||||
"list of components, accepts comma-separated values")
|
"list of components, accepts comma-separated values")
|
||||||
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapArgs.extraComponents, "components-extra", nil,
|
bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapArgs.extraComponents, "components-extra", nil,
|
||||||
"list of components in addition to those supplied or defaulted, accepts values such as 'image-reflector-controller,image-automation-controller'")
|
"list of components in addition to those supplied or defaulted, accepts comma-separated values")
|
||||||
|
|
||||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.registry, "registry", "ghcr.io/fluxcd",
|
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.registry, "registry", "ghcr.io/fluxcd",
|
||||||
"container registry where the toolkit images are published")
|
"container registry where the toolkit images are published")
|
||||||
|
|||||||
@@ -254,7 +254,6 @@ func bootstrapBServerCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
bootstrap.WithKubeconfig(kubeconfigArgs),
|
bootstrap.WithKubeconfig(kubeconfigArgs),
|
||||||
bootstrap.WithLogger(logger),
|
bootstrap.WithLogger(logger),
|
||||||
bootstrap.WithCABundle(caBundle),
|
bootstrap.WithCABundle(caBundle),
|
||||||
bootstrap.WithGitCommitSigning(bootstrapArgs.gpgKeyRingPath, bootstrapArgs.gpgPassphrase, bootstrapArgs.gpgKeyID),
|
|
||||||
}
|
}
|
||||||
if bootstrapArgs.sshHostname != "" {
|
if bootstrapArgs.sshHostname != "" {
|
||||||
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
||||||
|
|||||||
@@ -243,7 +243,6 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
bootstrap.WithKubeconfig(kubeconfigArgs),
|
bootstrap.WithKubeconfig(kubeconfigArgs),
|
||||||
bootstrap.WithLogger(logger),
|
bootstrap.WithLogger(logger),
|
||||||
bootstrap.WithCABundle(caBundle),
|
bootstrap.WithCABundle(caBundle),
|
||||||
bootstrap.WithGitCommitSigning(bootstrapArgs.gpgKeyRingPath, bootstrapArgs.gpgPassphrase, bootstrapArgs.gpgKeyID),
|
|
||||||
}
|
}
|
||||||
if bootstrapArgs.sshHostname != "" {
|
if bootstrapArgs.sshHostname != "" {
|
||||||
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
||||||
|
|||||||
@@ -257,7 +257,6 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
bootstrap.WithKubeconfig(kubeconfigArgs),
|
bootstrap.WithKubeconfig(kubeconfigArgs),
|
||||||
bootstrap.WithLogger(logger),
|
bootstrap.WithLogger(logger),
|
||||||
bootstrap.WithCABundle(caBundle),
|
bootstrap.WithCABundle(caBundle),
|
||||||
bootstrap.WithGitCommitSigning(bootstrapArgs.gpgKeyRingPath, bootstrapArgs.gpgPassphrase, bootstrapArgs.gpgKeyID),
|
|
||||||
}
|
}
|
||||||
if bootstrapArgs.sshHostname != "" {
|
if bootstrapArgs.sshHostname != "" {
|
||||||
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
bootstrapOpts = append(bootstrapOpts, bootstrap.WithSSHHostname(bootstrapArgs.sshHostname))
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -52,18 +51,6 @@ func init() {
|
|||||||
createCmd.PersistentFlags().BoolVar(&createArgs.export, "export", false, "export in YAML format to stdout")
|
createCmd.PersistentFlags().BoolVar(&createArgs.export, "export", false, "export in YAML format to stdout")
|
||||||
createCmd.PersistentFlags().StringSliceVar(&createArgs.labels, "label", nil,
|
createCmd.PersistentFlags().StringSliceVar(&createArgs.labels, "label", nil,
|
||||||
"set labels on the resource (can specify multiple labels with commas: label1=value1,label2=value2)")
|
"set labels on the resource (can specify multiple labels with commas: label1=value1,label2=value2)")
|
||||||
createCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
|
|
||||||
if len(args) < 1 {
|
|
||||||
return fmt.Errorf("name is required")
|
|
||||||
}
|
|
||||||
|
|
||||||
name := args[0]
|
|
||||||
if !validateObjectName(name) {
|
|
||||||
return fmt.Errorf("name '%s' is invalid, it should adhere to standard defined in RFC 1123, the name can only contain alphanumeric characters or '-'", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
rootCmd.AddCommand(createCmd)
|
rootCmd.AddCommand(createCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,8 +150,3 @@ func parseLabels() (map[string]string, error) {
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateObjectName(name string) bool {
|
|
||||||
r := regexp.MustCompile("^[a-z0-9]([a-z0-9\\-]){0,61}[a-z0-9]$")
|
|
||||||
return r.MatchString(name)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createAlertCmdRun(cmd *cobra.Command, args []string) error {
|
func createAlertCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("Alert name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if alertArgs.providerRef == "" {
|
if alertArgs.providerRef == "" {
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
|
func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("Provider name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if alertProviderArgs.alertType == "" {
|
if alertProviderArgs.alertType == "" {
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("HelmRelease name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if helmReleaseArgs.chart == "" {
|
if helmReleaseArgs.chart == "" {
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ func (obj imagePolicyAdapter) getObservedGeneration() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createImagePolicyRun(cmd *cobra.Command, args []string) error {
|
func createImagePolicyRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("ImagePolicy name is required")
|
||||||
|
}
|
||||||
objectName := args[0]
|
objectName := args[0]
|
||||||
|
|
||||||
if imagePolicyArgs.imageRef == "" {
|
if imagePolicyArgs.imageRef == "" {
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createImageRepositoryRun(cmd *cobra.Command, args []string) error {
|
func createImageRepositoryRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("ImageRepository name is required")
|
||||||
|
}
|
||||||
objectName := args[0]
|
objectName := args[0]
|
||||||
|
|
||||||
if imageRepoArgs.image == "" {
|
if imageRepoArgs.image == "" {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
|
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var createImageUpdateCmd = &cobra.Command{
|
var createImageUpdateCmd = &cobra.Command{
|
||||||
@@ -49,40 +49,25 @@ mentioned in YAMLs in a git repository.`,
|
|||||||
--push-branch=image-updates \
|
--push-branch=image-updates \
|
||||||
--author-name=flux \
|
--author-name=flux \
|
||||||
--author-email=flux@example.com \
|
--author-email=flux@example.com \
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"`,
|
||||||
|
|
||||||
# Configure image updates for a Git repository in a different namespace
|
|
||||||
flux create image update apps \
|
|
||||||
--namespace=apps \
|
|
||||||
--git-repo-ref=flux-system \
|
|
||||||
--git-repo-namespace=flux-system \
|
|
||||||
--git-repo-path="./clusters/my-cluster" \
|
|
||||||
--checkout-branch=main \
|
|
||||||
--push-branch=image-updates \
|
|
||||||
--author-name=flux \
|
|
||||||
--author-email=flux@example.com \
|
|
||||||
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}"
|
|
||||||
`,
|
|
||||||
RunE: createImageUpdateRun,
|
RunE: createImageUpdateRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
type imageUpdateFlags struct {
|
type imageUpdateFlags struct {
|
||||||
gitRepoName string
|
gitRepoRef string
|
||||||
gitRepoNamespace string
|
gitRepoPath string
|
||||||
gitRepoPath string
|
checkoutBranch string
|
||||||
checkoutBranch string
|
pushBranch string
|
||||||
pushBranch string
|
commitTemplate string
|
||||||
commitTemplate string
|
authorName string
|
||||||
authorName string
|
authorEmail string
|
||||||
authorEmail string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageUpdateArgs = imageUpdateFlags{}
|
var imageUpdateArgs = imageUpdateFlags{}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flags := createImageUpdateCmd.Flags()
|
flags := createImageUpdateCmd.Flags()
|
||||||
flags.StringVar(&imageUpdateArgs.gitRepoName, "git-repo-ref", "", "the name of a GitRepository resource with details of the upstream Git repository")
|
flags.StringVar(&imageUpdateArgs.gitRepoRef, "git-repo-ref", "", "the name of a GitRepository resource with details of the upstream Git repository")
|
||||||
flags.StringVar(&imageUpdateArgs.gitRepoNamespace, "git-repo-namespace", "", "the namespace of the GitRepository resource, defaults to the ImageUpdateAutomation namespace")
|
|
||||||
flags.StringVar(&imageUpdateArgs.gitRepoPath, "git-repo-path", "", "path to the directory containing the manifests to be updated, defaults to the repository root")
|
flags.StringVar(&imageUpdateArgs.gitRepoPath, "git-repo-path", "", "path to the directory containing the manifests to be updated, defaults to the repository root")
|
||||||
flags.StringVar(&imageUpdateArgs.checkoutBranch, "checkout-branch", "", "the branch to checkout")
|
flags.StringVar(&imageUpdateArgs.checkoutBranch, "checkout-branch", "", "the branch to checkout")
|
||||||
flags.StringVar(&imageUpdateArgs.pushBranch, "push-branch", "", "the branch to push commits to, defaults to the checkout branch if not specified")
|
flags.StringVar(&imageUpdateArgs.pushBranch, "push-branch", "", "the branch to push commits to, defaults to the checkout branch if not specified")
|
||||||
@@ -94,9 +79,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createImageUpdateRun(cmd *cobra.Command, args []string) error {
|
func createImageUpdateRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("ImageUpdateAutomation name is required")
|
||||||
|
}
|
||||||
objectName := args[0]
|
objectName := args[0]
|
||||||
|
|
||||||
if imageUpdateArgs.gitRepoName == "" {
|
if imageUpdateArgs.gitRepoRef == "" {
|
||||||
return fmt.Errorf("a reference to a GitRepository is required (--git-repo-ref)")
|
return fmt.Errorf("a reference to a GitRepository is required (--git-repo-ref)")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +113,8 @@ func createImageUpdateRun(cmd *cobra.Command, args []string) error {
|
|||||||
},
|
},
|
||||||
Spec: autov1.ImageUpdateAutomationSpec{
|
Spec: autov1.ImageUpdateAutomationSpec{
|
||||||
SourceRef: autov1.CrossNamespaceSourceReference{
|
SourceRef: autov1.CrossNamespaceSourceReference{
|
||||||
Kind: sourcev1.GitRepositoryKind,
|
Kind: sourcev1.GitRepositoryKind,
|
||||||
Name: imageUpdateArgs.gitRepoName,
|
Name: imageUpdateArgs.gitRepoRef,
|
||||||
Namespace: imageUpdateArgs.gitRepoNamespace,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
GitSpec: &autov1.GitSpec{
|
GitSpec: &autov1.GitSpec{
|
||||||
|
|||||||
@@ -119,6 +119,9 @@ func NewKustomizationFlags() kustomizationFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("Kustomization name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if kustomizationArgs.path == "" {
|
if kustomizationArgs.path == "" {
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createReceiverCmdRun(cmd *cobra.Command, args []string) error {
|
func createReceiverCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("Receiver name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if receiverArgs.receiverType == "" {
|
if receiverArgs.receiverType == "" {
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ func NewSecretGitFlags() secretGitFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
|
func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("secret name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
if secretGitArgs.url == "" {
|
if secretGitArgs.url == "" {
|
||||||
return fmt.Errorf("url is required")
|
return fmt.Errorf("url is required")
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func TestCreateGitSecret(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "no args",
|
name: "no args",
|
||||||
args: "create secret git",
|
args: "create secret git",
|
||||||
assert: assertError("name is required"),
|
assert: assertError("secret name is required"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "basic secret",
|
name: "basic secret",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
@@ -67,6 +68,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error {
|
func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("secret name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
labels, err := parseLabels()
|
labels, err := parseLabels()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestCreateHelmSecret(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
args: "create secret helm",
|
args: "create secret helm",
|
||||||
assert: assertError("name is required"),
|
assert: assertError("secret name is required"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
args: "create secret helm helm-secret --username=my-username --password=my-password --namespace=my-namespace --export",
|
args: "create secret helm helm-secret --username=my-username --password=my-password --namespace=my-namespace --export",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
@@ -66,6 +67,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
|
func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("secret name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
labels, err := parseLabels()
|
labels, err := parseLabels()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestCreateTlsSecretNoArgs(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
args: "create secret tls",
|
args: "create secret tls",
|
||||||
assert: assertError("name is required"),
|
assert: assertError("secret name is required"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
args: "create secret tls certs --namespace=my-namespace --cert-file=./testdata/create_secret/tls/test-cert.pem --key-file=./testdata/create_secret/tls/test-key.pem --export",
|
args: "create secret tls certs --namespace=my-namespace --cert-file=./testdata/create_secret/tls/test-cert.pem --key-file=./testdata/create_secret/tls/test-key.pem --export",
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
"github.com/fluxcd/pkg/runtime/conditions"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
@@ -95,6 +93,9 @@ func NewSourceBucketFlags() sourceBucketFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
|
func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("Bucket source name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if sourceBucketArgs.name == "" {
|
if sourceBucketArgs.name == "" {
|
||||||
@@ -237,30 +238,3 @@ func upsertBucket(ctx context.Context, kubeClient client.Client,
|
|||||||
logger.Successf("Bucket source updated")
|
logger.Successf("Bucket source updated")
|
||||||
return namespacedName, nil
|
return namespacedName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isBucketReady(ctx context.Context, kubeClient client.Client,
|
|
||||||
namespacedName types.NamespacedName, bucket *sourcev1.Bucket) wait.ConditionFunc {
|
|
||||||
return func() (bool, error) {
|
|
||||||
err := kubeClient.Get(ctx, namespacedName, bucket)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if c := conditions.Get(bucket, meta.ReadyCondition); c != nil {
|
|
||||||
// Confirm the Ready condition we are observing is for the
|
|
||||||
// current generation
|
|
||||||
if c.ObservedGeneration != bucket.GetGeneration() {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Further check the Status
|
|
||||||
switch c.Status {
|
|
||||||
case metav1.ConditionTrue:
|
|
||||||
return true, nil
|
|
||||||
case metav1.ConditionFalse:
|
|
||||||
return false, fmt.Errorf(c.Message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -23,21 +23,19 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
"github.com/manifoldco/promptui"
|
"github.com/manifoldco/promptui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
|
||||||
"github.com/fluxcd/pkg/runtime/conditions"
|
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/flags"
|
"github.com/fluxcd/flux2/internal/flags"
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
@@ -152,6 +150,9 @@ func newSourceGitFlags() sourceGitFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("GitRepository source name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if sourceGitArgs.url == "" {
|
if sourceGitArgs.url == "" {
|
||||||
@@ -171,7 +172,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sourceGitArgs.caFile != "" && u.Scheme == "ssh" {
|
if sourceGitArgs.caFile != "" && u.Scheme == "ssh" {
|
||||||
return fmt.Errorf("specifying a CA file is not supported for Git over SSH")
|
return fmt.Errorf("specifing a CA file is not supported for Git over SSH")
|
||||||
}
|
}
|
||||||
|
|
||||||
if sourceGitArgs.recurseSubmodules && sourceGitArgs.gitImplementation == sourcev1.LibGit2Implementation {
|
if sourceGitArgs.recurseSubmodules && sourceGitArgs.gitImplementation == sourcev1.LibGit2Implementation {
|
||||||
@@ -357,14 +358,7 @@ func isGitRepositoryReady(ctx context.Context, kubeClient client.Client,
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c := conditions.Get(gitRepository, meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(gitRepository.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
// Confirm the Ready condition we are observing is for the
|
|
||||||
// current generation
|
|
||||||
if c.ObservedGeneration != gitRepository.GetGeneration() {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Further check the Status
|
|
||||||
switch c.Status {
|
switch c.Status {
|
||||||
case metav1.ConditionTrue:
|
case metav1.ConditionTrue:
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -21,17 +21,15 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pollInterval = 50 * time.Millisecond
|
var pollInterval = 50 * time.Millisecond
|
||||||
@@ -98,21 +96,14 @@ func TestCreateSourceGit(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"NoArgs",
|
"NoArgs",
|
||||||
"create source git",
|
"create source git",
|
||||||
assertError("name is required"),
|
assertError("GitRepository source name is required"),
|
||||||
nil,
|
nil,
|
||||||
}, {
|
}, {
|
||||||
"Succeeded",
|
"Succeeded",
|
||||||
command,
|
command,
|
||||||
assertGoldenFile("testdata/create_source_git/success.golden"),
|
assertGoldenFile("testdata/create_source_git/success.golden"),
|
||||||
func(repo *sourcev1.GitRepository) {
|
func(repo *sourcev1.GitRepository) {
|
||||||
newCondition := metav1.Condition{
|
meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionTrue, sourcev1.GitOperationSucceedReason, "succeeded message")
|
||||||
Type: meta.ReadyCondition,
|
|
||||||
Status: metav1.ConditionTrue,
|
|
||||||
Reason: sourcev1.GitOperationSucceedReason,
|
|
||||||
Message: "succeeded message",
|
|
||||||
ObservedGeneration: repo.GetGeneration(),
|
|
||||||
}
|
|
||||||
apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition)
|
|
||||||
repo.Status.Artifact = &sourcev1.Artifact{
|
repo.Status.Artifact = &sourcev1.Artifact{
|
||||||
Path: "some-path",
|
Path: "some-path",
|
||||||
Revision: "v1",
|
Revision: "v1",
|
||||||
@@ -123,14 +114,7 @@ func TestCreateSourceGit(t *testing.T) {
|
|||||||
command,
|
command,
|
||||||
assertError("failed message"),
|
assertError("failed message"),
|
||||||
func(repo *sourcev1.GitRepository) {
|
func(repo *sourcev1.GitRepository) {
|
||||||
newCondition := metav1.Condition{
|
meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionFalse, sourcev1.URLInvalidReason, "failed message")
|
||||||
Type: meta.ReadyCondition,
|
|
||||||
Status: metav1.ConditionFalse,
|
|
||||||
Reason: sourcev1.URLInvalidReason,
|
|
||||||
Message: "failed message",
|
|
||||||
ObservedGeneration: repo.GetGeneration(),
|
|
||||||
}
|
|
||||||
apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition)
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
"NoArtifact",
|
"NoArtifact",
|
||||||
@@ -138,14 +122,7 @@ func TestCreateSourceGit(t *testing.T) {
|
|||||||
assertError("GitRepository source reconciliation completed but no artifact was found"),
|
assertError("GitRepository source reconciliation completed but no artifact was found"),
|
||||||
func(repo *sourcev1.GitRepository) {
|
func(repo *sourcev1.GitRepository) {
|
||||||
// Updated with no artifact
|
// Updated with no artifact
|
||||||
newCondition := metav1.Condition{
|
meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionTrue, sourcev1.GitOperationSucceedReason, "succeeded message")
|
||||||
Type: meta.ReadyCondition,
|
|
||||||
Status: metav1.ConditionTrue,
|
|
||||||
Reason: sourcev1.GitOperationSucceedReason,
|
|
||||||
Message: "succeeded message",
|
|
||||||
ObservedGeneration: repo.GetGeneration(),
|
|
||||||
}
|
|
||||||
apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,17 +23,17 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
"github.com/fluxcd/pkg/runtime/conditions"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
"github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret"
|
||||||
@@ -91,6 +91,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("HelmRepository source name is required")
|
||||||
|
}
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if sourceHelmArgs.url == "" {
|
if sourceHelmArgs.url == "" {
|
||||||
@@ -242,14 +245,12 @@ func isHelmRepositoryReady(ctx context.Context, kubeClient client.Client,
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c := conditions.Get(helmRepository, meta.ReadyCondition); c != nil {
|
// Confirm the state we are observing is for the current generation
|
||||||
// Confirm the Ready condition we are observing is for the
|
if helmRepository.Generation != helmRepository.Status.ObservedGeneration {
|
||||||
// current generation
|
return false, nil
|
||||||
if c.ObservedGeneration != helmRepository.GetGeneration() {
|
}
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Further check the Status
|
if c := apimeta.FindStatusCondition(helmRepository.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
switch c.Status {
|
switch c.Status {
|
||||||
case metav1.ConditionTrue:
|
case metav1.ConditionTrue:
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createTenantCmdRun(cmd *cobra.Command, args []string) error {
|
func createTenantCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(args) < 1 {
|
||||||
|
return fmt.Errorf("tenant name is required")
|
||||||
|
}
|
||||||
tenant := args[0]
|
tenant := args[0]
|
||||||
if err := validation.IsQualifiedName(tenant); len(err) > 0 {
|
if err := validation.IsQualifiedName(tenant); len(err) > 0 {
|
||||||
return fmt.Errorf("invalid tenant name '%s': %v", tenant, err)
|
return fmt.Errorf("invalid tenant name '%s': %v", tenant, err)
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/rand"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Test_validateObjectName(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
valid bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "flux-system",
|
|
||||||
valid: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "-flux-system",
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "-flux-system-",
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "third.first",
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "THirdfirst",
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "THirdfirst",
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: rand.String(63),
|
|
||||||
valid: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: rand.String(64),
|
|
||||||
valid: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
valid := validateObjectName(tt.name)
|
|
||||||
if valid != tt.valid {
|
|
||||||
t.Errorf("expected name %q to return %t for validateObjectName func but got %t",
|
|
||||||
tt.name, tt.valid, valid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteSourceBucketCmd = &cobra.Command{
|
var deleteSourceBucketCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteSourceGitCmd = &cobra.Command{
|
var deleteSourceGitCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteSourceHelmCmd = &cobra.Command{
|
var deleteSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
var diffCmd = &cobra.Command{
|
var diffCmd = &cobra.Command{
|
||||||
Use: "diff",
|
Use: "diff",
|
||||||
Short: "Diff a flux resource",
|
Short: "Diff a flux resource",
|
||||||
Long: "The diff command is used to do a server-side dry-run on flux resources, then prints the diff.",
|
Long: "The diff command is used to do a server-side dry-run on flux resources, then output the diff.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -31,24 +31,21 @@ var diffKsCmd = &cobra.Command{
|
|||||||
Use: "kustomization",
|
Use: "kustomization",
|
||||||
Aliases: []string{"ks"},
|
Aliases: []string{"ks"},
|
||||||
Short: "Diff Kustomization",
|
Short: "Diff Kustomization",
|
||||||
Long: `The diff command does a build, then it performs a server-side dry-run and prints the diff.
|
Long: `The diff command does a build, then it performs a server-side dry-run and output the diff.`,
|
||||||
Exit status: 0 No differences were found. 1 Differences were found. >1 diff failed with an error.`,
|
Example: `# Preview changes local changes as they were applied on the cluster
|
||||||
Example: `# Preview local changes as they were applied on the cluster
|
|
||||||
flux diff kustomization my-app --path ./path/to/local/manifests`,
|
flux diff kustomization my-app --path ./path/to/local/manifests`,
|
||||||
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
ValidArgsFunction: resourceNamesCompletionFunc(kustomizev1.GroupVersion.WithKind(kustomizev1.KustomizationKind)),
|
||||||
RunE: diffKsCmdRun,
|
RunE: diffKsCmdRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
type diffKsFlags struct {
|
type diffKsFlags struct {
|
||||||
path string
|
path string
|
||||||
progressBar bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var diffKsArgs diffKsFlags
|
var diffKsArgs diffKsFlags
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
diffKsCmd.Flags().StringVar(&diffKsArgs.path, "path", "", "Path to a local directory that matches the specified Kustomization.spec.path.)")
|
diffKsCmd.Flags().StringVar(&diffKsArgs.path, "path", "", "Path to a local directory that matches the specified Kustomization.spec.path.)")
|
||||||
diffKsCmd.Flags().BoolVar(&diffKsArgs.progressBar, "progress-bar", true, "Boolean to set the progress bar. The default value is true.")
|
|
||||||
diffCmd.AddCommand(diffKsCmd)
|
diffCmd.AddCommand(diffKsCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,23 +56,16 @@ func diffKsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
if diffKsArgs.path == "" {
|
if diffKsArgs.path == "" {
|
||||||
return &RequestError{StatusCode: 2, Err: fmt.Errorf("invalid resource path %q", diffKsArgs.path)}
|
return fmt.Errorf("invalid resource path %q", diffKsArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs, err := os.Stat(diffKsArgs.path); err != nil || !fs.IsDir() {
|
if fs, err := os.Stat(diffKsArgs.path); err != nil || !fs.IsDir() {
|
||||||
return &RequestError{StatusCode: 2, Err: fmt.Errorf("invalid resource path %q", diffKsArgs.path)}
|
return fmt.Errorf("invalid resource path %q", diffKsArgs.path)
|
||||||
}
|
|
||||||
|
|
||||||
var builder *build.Builder
|
|
||||||
var err error
|
|
||||||
if diffKsArgs.progressBar {
|
|
||||||
builder, err = build.NewBuilder(kubeconfigArgs, name, diffKsArgs.path, build.WithTimeout(rootArgs.timeout), build.WithProgressBar())
|
|
||||||
} else {
|
|
||||||
builder, err = build.NewBuilder(kubeconfigArgs, name, diffKsArgs.path, build.WithTimeout(rootArgs.timeout))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder, err := build.NewBuilder(kubeconfigArgs, name, diffKsArgs.path, build.WithTimeout(rootArgs.timeout))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &RequestError{StatusCode: 2, Err: err}
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a signal channel
|
// create a signal channel
|
||||||
@@ -84,18 +74,13 @@ func diffKsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
output, hasChanged, err := builder.Diff()
|
output, err := builder.Diff()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- &RequestError{StatusCode: 2, Err: err}
|
errChan <- err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Print(output)
|
cmd.Print(output)
|
||||||
|
errChan <- nil
|
||||||
if hasChanged {
|
|
||||||
errChan <- &RequestError{StatusCode: 1, Err: fmt.Errorf("identified at least one change, exiting with non-zero exit code")}
|
|
||||||
} else {
|
|
||||||
errChan <- nil
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -45,52 +45,40 @@ func TestDiffKustomization(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff nothing deployed",
|
name: "diff nothing deployed",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "",
|
objectFile: "",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/nothing-is-deployed.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/nothing-is-deployed.golden"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff with a deployment object",
|
name: "diff with a deployment object",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "./testdata/diff-kustomization/deployment.yaml",
|
objectFile: "./testdata/diff-kustomization/deployment.yaml",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-deployment.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-deployment.golden"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff with a drifted service object",
|
name: "diff with a drifted service object",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "./testdata/diff-kustomization/service.yaml",
|
objectFile: "./testdata/diff-kustomization/service.yaml",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-service.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-service.golden"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff with a drifted secret object",
|
name: "diff with a drifted secret object",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "./testdata/diff-kustomization/secret.yaml",
|
objectFile: "./testdata/diff-kustomization/secret.yaml",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-secret.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-secret.golden"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff with a drifted key in sops secret object",
|
name: "diff with a drifted key in sops secret object",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "./testdata/diff-kustomization/key-sops-secret.yaml",
|
objectFile: "./testdata/diff-kustomization/key-sops-secret.yaml",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-key-sops-secret.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-key-sops-secret.golden"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "diff with a drifted value in sops secret object",
|
name: "diff with a drifted value in sops secret object",
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo",
|
||||||
objectFile: "./testdata/diff-kustomization/value-sops-secret.yaml",
|
objectFile: "./testdata/diff-kustomization/value-sops-secret.yaml",
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-value-sops-secret.golden"),
|
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-value-sops-secret.golden"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "diff with a sops dockerconfigjson secret object",
|
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
|
||||||
objectFile: "./testdata/diff-kustomization/dockerconfigjson-sops-secret.yaml",
|
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-dockerconfigjson-sops-secret.golden"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "diff with a sops stringdata secret object",
|
|
||||||
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false",
|
|
||||||
objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml",
|
|
||||||
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl := map[string]string{
|
tmpl := map[string]string{
|
||||||
@@ -137,9 +125,5 @@ func createObjectFromFile(objectFile string, templateValues map[string]string, t
|
|||||||
t.Fatalf("Error decoding yaml file '%s': %v", objectFile, err)
|
t.Fatalf("Error decoding yaml file '%s': %v", objectFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ssa.SetNativeKindsDefaults(clientObjects); err != nil {
|
|
||||||
t.Fatalf("Error setting native kinds defaults for '%s': %v", objectFile, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return clientObjects
|
return clientObjects
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportSourceBucketCmd = &cobra.Command{
|
var exportSourceBucketCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportSourceGitCmd = &cobra.Command{
|
var exportSourceGitCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportSourceHelmCmd = &cobra.Command{
|
var exportSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import (
|
|||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/flux2/pkg/printers"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type deriveType func(runtime.Object) (summarisable, error)
|
type deriveType func(runtime.Object) (summarisable, error)
|
||||||
@@ -178,10 +177,7 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = printers.TablePrinter(header).Print(cmd.OutOrStdout(), rows)
|
utils.PrintTable(cmd.OutOrStdout(), header, rows)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if getAll {
|
if getAll {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
@@ -246,16 +242,10 @@ func watchUntil(ctx context.Context, w watch.Interface, get *getCommand) (bool,
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if firstIteration {
|
if firstIteration {
|
||||||
err = printers.TablePrinter(header).Print(os.Stdout, rows)
|
utils.PrintTable(os.Stdout, header, rows)
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
firstIteration = false
|
firstIteration = false
|
||||||
} else {
|
} else {
|
||||||
err = printers.TablePrinter([]string{}).Print(os.Stdout, rows)
|
utils.PrintTable(os.Stdout, []string{}, rows)
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ func init() {
|
|||||||
func (s alertListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
func (s alertListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind), strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s alertListAdapter) headers(includeNamespace bool) []string {
|
func (s alertListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
return append(namespaceHeader, headers...)
|
return append(namespaceHeader, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,11 +75,11 @@ func (a helmReleaseListAdapter) summariseItem(i int, includeNamespace bool, incl
|
|||||||
revision := item.Status.LastAppliedRevision
|
revision := item.Status.LastAppliedRevision
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a helmReleaseListAdapter) headers(includeNamespace bool) []string {
|
func (a helmReleaseListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ func init() {
|
|||||||
func (s imagePolicyListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
func (s imagePolicyListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind), item.Status.LatestImage, status, msg)
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, item.Status.LatestImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imagePolicyListAdapter) headers(includeNamespace bool) []string {
|
func (s imagePolicyListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Latest image", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Latest image"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
return append(namespaceHeader, headers...)
|
return append(namespaceHeader, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ func (s imageRepositoryListAdapter) summariseItem(i int, includeNamespace bool,
|
|||||||
lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339)
|
lastScan = item.Status.LastScanResult.ScanTime.Time.Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
lastScan, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, lastScan, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imageRepositoryListAdapter) headers(includeNamespace bool) []string {
|
func (s imageRepositoryListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Last scan", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Last scan", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
return append(namespaceHeader, headers...)
|
return append(namespaceHeader, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ func (s imageUpdateAutomationListAdapter) summariseItem(i int, includeNamespace
|
|||||||
if item.Status.LastAutomationRunTime != nil {
|
if item.Status.LastAutomationRunTime != nil {
|
||||||
lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339)
|
lastRun = item.Status.LastAutomationRunTime.Time.Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind), lastRun, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, lastRun, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string {
|
func (s imageUpdateAutomationListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Last run", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Last run", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
return append(namespaceHeader, headers...)
|
return append(namespaceHeader, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ func (a kustomizationListAdapter) summariseItem(i int, includeNamespace bool, in
|
|||||||
msg = shortenCommitSha(msg)
|
msg = shortenCommitSha(msg)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a kustomizationListAdapter) headers(includeNamespace bool) []string {
|
func (a kustomizationListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ func init() {
|
|||||||
func (s receiverListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
func (s receiverListAdapter) summariseItem(i int, includeNamespace bool, includeKind bool) []string {
|
||||||
item := s.Items[i]
|
item := s.Items[i]
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind), strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
return append(nameColumns(&item, includeNamespace, includeKind), status, msg, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s receiverListAdapter) headers(includeNamespace bool) []string {
|
func (s receiverListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
return append(namespaceHeader, headers...)
|
return append(namespaceHeader, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getSourceAllCmd = &cobra.Command{
|
var getSourceAllCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getSourceBucketCmd = &cobra.Command{
|
var getSourceBucketCmd = &cobra.Command{
|
||||||
@@ -81,11 +81,11 @@ func (a *bucketListAdapter) summariseItem(i int, includeNamespace bool, includeK
|
|||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a bucketListAdapter) headers(includeNamespace bool) []string {
|
func (a bucketListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getSourceHelmChartCmd = &cobra.Command{
|
var getSourceHelmChartCmd = &cobra.Command{
|
||||||
@@ -81,11 +81,11 @@ func (a *helmChartListAdapter) summariseItem(i int, includeNamespace bool, inclu
|
|||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a helmChartListAdapter) headers(includeNamespace bool) []string {
|
func (a helmChartListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getSourceGitCmd = &cobra.Command{
|
var getSourceGitCmd = &cobra.Command{
|
||||||
@@ -86,11 +86,11 @@ func (a *gitRepositoryListAdapter) summariseItem(i int, includeNamespace bool, i
|
|||||||
msg = shortenCommitSha(msg)
|
msg = shortenCommitSha(msg)
|
||||||
}
|
}
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a gitRepositoryListAdapter) headers(includeNamespace bool) []string {
|
func (a gitRepositoryListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getSourceHelmCmd = &cobra.Command{
|
var getSourceHelmCmd = &cobra.Command{
|
||||||
@@ -81,11 +81,11 @@ func (a *helmRepositoryListAdapter) summariseItem(i int, includeNamespace bool,
|
|||||||
}
|
}
|
||||||
status, msg := statusAndMessage(item.Status.Conditions)
|
status, msg := statusAndMessage(item.Status.Conditions)
|
||||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
status, msg, revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a helmRepositoryListAdapter) headers(includeNamespace bool) []string {
|
func (a helmRepositoryListAdapter) headers(includeNamespace bool) []string {
|
||||||
headers := []string{"Name", "Revision", "Suspended", "Ready", "Message"}
|
headers := []string{"Name", "Ready", "Message", "Revision", "Suspended"}
|
||||||
if includeNamespace {
|
if includeNamespace {
|
||||||
headers = append([]string{"Namespace"}, headers...)
|
headers = append([]string{"Namespace"}, headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import (
|
|||||||
// helmv2.HelmRelease
|
// helmv2.HelmRelease
|
||||||
|
|
||||||
var helmReleaseType = apiType{
|
var helmReleaseType = apiType{
|
||||||
kind: helmv2.HelmReleaseKind,
|
kind: helmv2.HelmReleaseKind,
|
||||||
humanKind: "helmrelease",
|
humanKind: "helmreleases",
|
||||||
groupVersion: helmv2.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type helmReleaseAdapter struct {
|
type helmReleaseAdapter struct {
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ import (
|
|||||||
// imagev1.ImageRepository
|
// imagev1.ImageRepository
|
||||||
|
|
||||||
var imageRepositoryType = apiType{
|
var imageRepositoryType = apiType{
|
||||||
kind: imagev1.ImageRepositoryKind,
|
kind: imagev1.ImageRepositoryKind,
|
||||||
humanKind: "image repository",
|
humanKind: "image repository",
|
||||||
groupVersion: imagev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type imageRepositoryAdapter struct {
|
type imageRepositoryAdapter struct {
|
||||||
@@ -64,9 +63,8 @@ func (a imageRepositoryListAdapter) len() int {
|
|||||||
// imagev1.ImagePolicy
|
// imagev1.ImagePolicy
|
||||||
|
|
||||||
var imagePolicyType = apiType{
|
var imagePolicyType = apiType{
|
||||||
kind: imagev1.ImagePolicyKind,
|
kind: imagev1.ImagePolicyKind,
|
||||||
humanKind: "image policy",
|
humanKind: "image policy",
|
||||||
groupVersion: imagev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type imagePolicyAdapter struct {
|
type imagePolicyAdapter struct {
|
||||||
@@ -94,9 +92,8 @@ func (a imagePolicyListAdapter) len() int {
|
|||||||
// autov1.ImageUpdateAutomation
|
// autov1.ImageUpdateAutomation
|
||||||
|
|
||||||
var imageUpdateAutomationType = apiType{
|
var imageUpdateAutomationType = apiType{
|
||||||
kind: autov1.ImageUpdateAutomationKind,
|
kind: autov1.ImageUpdateAutomationKind,
|
||||||
humanKind: "image update automation",
|
humanKind: "image update automation",
|
||||||
groupVersion: autov1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type imageUpdateAutomationAdapter struct {
|
type imageUpdateAutomationAdapter struct {
|
||||||
|
|||||||
@@ -37,13 +37,10 @@ var installCmd = &cobra.Command{
|
|||||||
Long: `The install command deploys Flux in the specified namespace.
|
Long: `The install command deploys Flux in the specified namespace.
|
||||||
If a previous version is installed, then an in-place upgrade will be performed.`,
|
If a previous version is installed, then an in-place upgrade will be performed.`,
|
||||||
Example: ` # Install the latest version in the flux-system namespace
|
Example: ` # Install the latest version in the flux-system namespace
|
||||||
flux install --namespace=flux-system
|
flux install --version=latest --namespace=flux-system
|
||||||
|
|
||||||
# Install a specific series of components
|
# Install a specific version and a series of components
|
||||||
flux install --components="source-controller,kustomize-controller"
|
flux install --version=v0.0.7 --components="source-controller,kustomize-controller"
|
||||||
|
|
||||||
# Install all components including the image automation ones
|
|
||||||
flux install --components-extra="image-reflector-controller,image-automation-controller"
|
|
||||||
|
|
||||||
# Install Flux onto tainted Kubernetes nodes
|
# Install Flux onto tainted Kubernetes nodes
|
||||||
flux install --toleration-keys=node.kubernetes.io/dedicated-to-flux
|
flux install --toleration-keys=node.kubernetes.io/dedicated-to-flux
|
||||||
@@ -87,7 +84,7 @@ func init() {
|
|||||||
installCmd.Flags().StringSliceVar(&installArgs.defaultComponents, "components", rootArgs.defaults.Components,
|
installCmd.Flags().StringSliceVar(&installArgs.defaultComponents, "components", rootArgs.defaults.Components,
|
||||||
"list of components, accepts comma-separated values")
|
"list of components, accepts comma-separated values")
|
||||||
installCmd.Flags().StringSliceVar(&installArgs.extraComponents, "components-extra", nil,
|
installCmd.Flags().StringSliceVar(&installArgs.extraComponents, "components-extra", nil,
|
||||||
"list of components in addition to those supplied or defaulted, accepts values such as 'image-reflector-controller,image-automation-controller'")
|
"list of components in addition to those supplied or defaulted, accepts comma-separated values")
|
||||||
installCmd.Flags().StringVar(&installArgs.manifestsPath, "manifests", "", "path to the manifest directory")
|
installCmd.Flags().StringVar(&installArgs.manifestsPath, "manifests", "", "path to the manifest directory")
|
||||||
installCmd.Flags().StringVar(&installArgs.registry, "registry", rootArgs.defaults.Registry,
|
installCmd.Flags().StringVar(&installArgs.registry, "registry", rootArgs.defaults.Registry,
|
||||||
"container registry where the toolkit images are published")
|
"container registry where the toolkit images are published")
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import (
|
|||||||
// kustomizev1.Kustomization
|
// kustomizev1.Kustomization
|
||||||
|
|
||||||
var kustomizationType = apiType{
|
var kustomizationType = apiType{
|
||||||
kind: kustomizev1.KustomizationKind,
|
kind: kustomizev1.KustomizationKind,
|
||||||
humanKind: "kustomization",
|
humanKind: "kustomizations",
|
||||||
groupVersion: kustomizev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type kustomizationAdapter struct {
|
type kustomizationAdapter struct {
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"text/template"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|||||||
@@ -105,16 +105,6 @@ type rootFlags struct {
|
|||||||
defaults install.Options
|
defaults install.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestError is a custom error type that wraps an error returned by the flux api.
|
|
||||||
type RequestError struct {
|
|
||||||
StatusCode int
|
|
||||||
Err error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RequestError) Error() string {
|
|
||||||
return r.Err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
var rootArgs = NewRootFlags()
|
var rootArgs = NewRootFlags()
|
||||||
var kubeconfigArgs = genericclioptions.NewConfigFlags(false)
|
var kubeconfigArgs = genericclioptions.NewConfigFlags(false)
|
||||||
|
|
||||||
@@ -153,17 +143,6 @@ func NewRootFlags() rootFlags {
|
|||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
|
|
||||||
if err, ok := err.(*RequestError); ok {
|
|
||||||
if err.StatusCode == 1 {
|
|
||||||
logger.Warningf("%v", err)
|
|
||||||
} else {
|
|
||||||
logger.Failuref("%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(err.StatusCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Failuref("%v", err)
|
logger.Failuref("%v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
@@ -43,9 +42,6 @@ import (
|
|||||||
|
|
||||||
var nextNamespaceId int64
|
var nextNamespaceId int64
|
||||||
|
|
||||||
// update allows golden files to be updated based on the current output.
|
|
||||||
var update = flag.Bool("update", false, "update golden files")
|
|
||||||
|
|
||||||
// Return a unique namespace with the specified prefix, for tests to create
|
// Return a unique namespace with the specified prefix, for tests to create
|
||||||
// objects that won't collide with each other.
|
// objects that won't collide with each other.
|
||||||
func allocateNamespace(prefix string) string {
|
func allocateNamespace(prefix string) string {
|
||||||
@@ -302,18 +298,6 @@ func assertGoldenTemplateFile(goldenFile string, templateValues map[string]strin
|
|||||||
expectedOutput = string(goldenFileContents)
|
expectedOutput = string(goldenFileContents)
|
||||||
}
|
}
|
||||||
if assertErr := assertGoldenValue(expectedOutput)(output, err); assertErr != nil {
|
if assertErr := assertGoldenValue(expectedOutput)(output, err); assertErr != nil {
|
||||||
// Update the golden files if comparison fails and the update flag is set.
|
|
||||||
if *update && output != "" {
|
|
||||||
// Skip update if there are template values.
|
|
||||||
if len(templateValues) > 0 {
|
|
||||||
fmt.Println("NOTE: -update flag passed but golden template files can't be updated, please update it manually")
|
|
||||||
} else {
|
|
||||||
if err := os.WriteFile(goldenFile, []byte(output), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to update golden file '%s': %v", goldenFile, err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fmt.Errorf("Mismatch from golden file '%s': %v", goldenFile, assertErr)
|
return fmt.Errorf("Mismatch from golden file '%s': %v", goldenFile, assertErr)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -341,12 +325,6 @@ type cmdTestCase struct {
|
|||||||
|
|
||||||
func (cmd *cmdTestCase) runTestCmd(t *testing.T) {
|
func (cmd *cmdTestCase) runTestCmd(t *testing.T) {
|
||||||
actual, testErr := executeCommand(cmd.args)
|
actual, testErr := executeCommand(cmd.args)
|
||||||
|
|
||||||
// If the cmd error is a change, discard it
|
|
||||||
if isChangeError(testErr) {
|
|
||||||
testErr = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if assertErr := cmd.assert(actual, testErr); assertErr != nil {
|
if assertErr := cmd.assert(actual, testErr); assertErr != nil {
|
||||||
t.Error(assertErr)
|
t.Error(assertErr)
|
||||||
}
|
}
|
||||||
@@ -388,12 +366,3 @@ func resetCmdArgs() {
|
|||||||
getArgs = GetFlags{}
|
getArgs = GetFlags{}
|
||||||
secretGitArgs = NewSecretGitFlags()
|
secretGitArgs = NewSecretGitFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
func isChangeError(err error) bool {
|
|
||||||
if reqErr, ok := err.(*RequestError); ok {
|
|
||||||
if strings.Contains(err.Error(), "identified at least one change, exiting with non-zero exit code") && reqErr.StatusCode == 1 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import (
|
|||||||
// implementation can pick whichever it wants to use.
|
// implementation can pick whichever it wants to use.
|
||||||
type apiType struct {
|
type apiType struct {
|
||||||
kind, humanKind string
|
kind, humanKind string
|
||||||
groupVersion schema.GroupVersion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// adapter is an interface for a wrapper or alias from which we can
|
// adapter is an interface for a wrapper or alias from which we can
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import (
|
|||||||
// notificationv1.Receiver
|
// notificationv1.Receiver
|
||||||
|
|
||||||
var receiverType = apiType{
|
var receiverType = apiType{
|
||||||
kind: notificationv1.ReceiverKind,
|
kind: notificationv1.ReceiverKind,
|
||||||
humanKind: "receiver",
|
humanKind: "receiver",
|
||||||
groupVersion: notificationv1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type receiverAdapter struct {
|
type receiverAdapter struct {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/util/retry"
|
"k8s.io/client-go/util/retry"
|
||||||
@@ -60,22 +59,13 @@ type reconcilable interface {
|
|||||||
GetAnnotations() map[string]string
|
GetAnnotations() map[string]string
|
||||||
SetAnnotations(map[string]string)
|
SetAnnotations(map[string]string)
|
||||||
|
|
||||||
|
// this is usually implemented by GOTK types, since it's used for meta.SetResourceCondition
|
||||||
|
GetStatusConditions() *[]metav1.Condition
|
||||||
|
|
||||||
lastHandledReconcileRequest() string // what was the last handled reconcile request?
|
lastHandledReconcileRequest() string // what was the last handled reconcile request?
|
||||||
successMessage() string // what do you want to tell people when successfully reconciled?
|
successMessage() string // what do you want to tell people when successfully reconciled?
|
||||||
}
|
}
|
||||||
|
|
||||||
func reconcilableConditions(object reconcilable) []metav1.Condition {
|
|
||||||
if s, ok := object.(meta.ObjectWithConditions); ok {
|
|
||||||
return s.GetConditions()
|
|
||||||
}
|
|
||||||
|
|
||||||
if s, ok := object.(oldConditions); ok {
|
|
||||||
return *s.GetStatusConditions()
|
|
||||||
}
|
|
||||||
|
|
||||||
return []metav1.Condition{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
|
func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
return fmt.Errorf("%s name is required", reconcile.kind)
|
return fmt.Errorf("%s name is required", reconcile.kind)
|
||||||
@@ -105,8 +95,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, *kubeconfigArgs.Namespace)
|
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, *kubeconfigArgs.Namespace)
|
||||||
if err := requestReconciliation(ctx, kubeClient, namespacedName,
|
if err := requestReconciliation(ctx, kubeClient, namespacedName, reconcile.object); err != nil {
|
||||||
reconcile.groupVersion.WithKind(reconcile.kind)); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Successf("%s annotated", reconcile.kind)
|
logger.Successf("%s annotated", reconcile.kind)
|
||||||
@@ -127,7 +116,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
readyCond := apimeta.FindStatusCondition(reconcilableConditions(reconcile.object), meta.ReadyCondition)
|
readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition)
|
||||||
if readyCond == nil {
|
if readyCond == nil {
|
||||||
return fmt.Errorf("status can't be determined")
|
return fmt.Errorf("status can't be determined")
|
||||||
}
|
}
|
||||||
@@ -146,32 +135,28 @@ func reconciliationHandled(ctx context.Context, kubeClient client.Client,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
isProgressing := apimeta.IsStatusConditionPresentAndEqual(reconcilableConditions(obj),
|
isProgressing := apimeta.IsStatusConditionPresentAndEqual(*obj.GetStatusConditions(),
|
||||||
meta.ReadyCondition, metav1.ConditionUnknown)
|
meta.ReadyCondition, metav1.ConditionUnknown)
|
||||||
return obj.lastHandledReconcileRequest() != lastHandledReconcileAt && !isProgressing, nil
|
return obj.lastHandledReconcileRequest() != lastHandledReconcileAt && !isProgressing, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestReconciliation(ctx context.Context, kubeClient client.Client,
|
func requestReconciliation(ctx context.Context, kubeClient client.Client,
|
||||||
namespacedName types.NamespacedName, gvk schema.GroupVersionKind) error {
|
namespacedName types.NamespacedName, obj reconcilable) error {
|
||||||
return retry.RetryOnConflict(retry.DefaultBackoff, func() (err error) {
|
return retry.RetryOnConflict(retry.DefaultBackoff, func() (err error) {
|
||||||
object := &metav1.PartialObjectMetadata{}
|
if err := kubeClient.Get(ctx, namespacedName, obj.asClientObject()); err != nil {
|
||||||
object.SetGroupVersionKind(gvk)
|
|
||||||
object.SetName(namespacedName.Name)
|
|
||||||
object.SetNamespace(namespacedName.Namespace)
|
|
||||||
if err := kubeClient.Get(ctx, namespacedName, object); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
patch := client.MergeFrom(object.DeepCopy())
|
patch := client.MergeFrom(obj.deepCopyClientObject())
|
||||||
if ann := object.GetAnnotations(); ann == nil {
|
if ann := obj.GetAnnotations(); ann == nil {
|
||||||
object.SetAnnotations(map[string]string{
|
obj.SetAnnotations(map[string]string{
|
||||||
meta.ReconcileRequestAnnotation: time.Now().Format(time.RFC3339Nano),
|
meta.ReconcileRequestAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ann[meta.ReconcileRequestAnnotation] = time.Now().Format(time.RFC3339Nano)
|
ann[meta.ReconcileRequestAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||||
object.SetAnnotations(ann)
|
obj.SetAnnotations(ann)
|
||||||
}
|
}
|
||||||
return kubeClient.Patch(ctx, object, patch)
|
return kubeClient.Patch(ctx, obj.asClientObject(), patch)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +168,7 @@ func isReconcileReady(ctx context.Context, kubeClient client.Client,
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c := apimeta.FindStatusCondition(reconcilableConditions(obj), meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(*obj.GetStatusConditions(), meta.ReadyCondition); c != nil {
|
||||||
switch c.Status {
|
switch c.Status {
|
||||||
case metav1.ConditionTrue:
|
case metav1.ConditionTrue:
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var reconcileHrCmd = &cobra.Command{
|
var reconcileHrCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var reconcileKsCmd = &cobra.Command{
|
var reconcileKsCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -17,11 +17,18 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var reconcileSourceBucketCmd = &cobra.Command{
|
var reconcileSourceBucketCmd = &cobra.Command{
|
||||||
@@ -41,6 +48,31 @@ func init() {
|
|||||||
reconcileSourceCmd.AddCommand(reconcileSourceBucketCmd)
|
reconcileSourceCmd.AddCommand(reconcileSourceBucketCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isBucketReady(ctx context.Context, kubeClient client.Client,
|
||||||
|
namespacedName types.NamespacedName, bucket *sourcev1.Bucket) wait.ConditionFunc {
|
||||||
|
return func() (bool, error) {
|
||||||
|
err := kubeClient.Get(ctx, namespacedName, bucket)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm the state we are observing is for the current generation
|
||||||
|
if bucket.Generation != bucket.Status.ObservedGeneration {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if c := apimeta.FindStatusCondition(bucket.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
|
switch c.Status {
|
||||||
|
case metav1.ConditionTrue:
|
||||||
|
return true, nil
|
||||||
|
case metav1.ConditionFalse:
|
||||||
|
return false, fmt.Errorf(c.Message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (obj bucketAdapter) lastHandledReconcileRequest() string {
|
func (obj bucketAdapter) lastHandledReconcileRequest() string {
|
||||||
return obj.Status.GetLastHandledReconcileRequest()
|
return obj.Status.GetLastHandledReconcileRequest()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var reconcileSourceGitCmd = &cobra.Command{
|
var reconcileSourceGitCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var reconcileSourceHelmCmd = &cobra.Command{
|
var reconcileSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
|
|
||||||
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type reconcileWithSource interface {
|
type reconcileWithSource interface {
|
||||||
@@ -70,8 +71,7 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
|
|||||||
|
|
||||||
lastHandledReconcileAt := reconcile.object.lastHandledReconcileRequest()
|
lastHandledReconcileAt := reconcile.object.lastHandledReconcileRequest()
|
||||||
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, *kubeconfigArgs.Namespace)
|
logger.Actionf("annotating %s %s in %s namespace", reconcile.kind, name, *kubeconfigArgs.Namespace)
|
||||||
if err := requestReconciliation(ctx, kubeClient, namespacedName,
|
if err := requestReconciliation(ctx, kubeClient, namespacedName, reconcile.object); err != nil {
|
||||||
reconcile.groupVersion.WithKind(reconcile.kind)); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Successf("%s annotated", reconcile.kind)
|
logger.Successf("%s annotated", reconcile.kind)
|
||||||
@@ -82,7 +82,7 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
readyCond := apimeta.FindStatusCondition(reconcilableConditions(reconcile.object), meta.ReadyCondition)
|
readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition)
|
||||||
if readyCond == nil {
|
if readyCond == nil {
|
||||||
return fmt.Errorf("status can't be determined")
|
return fmt.Errorf("status can't be determined")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ var resumeCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResumeFlags struct {
|
type ResumeFlags struct {
|
||||||
all bool
|
all bool
|
||||||
wait bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var resumeArgs ResumeFlags
|
var resumeArgs ResumeFlags
|
||||||
@@ -44,14 +43,11 @@ var resumeArgs ResumeFlags
|
|||||||
func init() {
|
func init() {
|
||||||
resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.all, "all", "", false,
|
resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.all, "all", "", false,
|
||||||
"resume all resources in that namespace")
|
"resume all resources in that namespace")
|
||||||
resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.wait, "wait", "", false,
|
|
||||||
"waits for one resource to reconcile before moving to the next one")
|
|
||||||
rootCmd.AddCommand(resumeCmd)
|
rootCmd.AddCommand(resumeCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
type resumable interface {
|
type resumable interface {
|
||||||
adapter
|
adapter
|
||||||
copyable
|
|
||||||
statusable
|
statusable
|
||||||
setUnsuspended()
|
setUnsuspended()
|
||||||
successMessage() string
|
successMessage() string
|
||||||
@@ -101,30 +97,25 @@ func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
for i := 0; i < resume.list.len(); i++ {
|
for i := 0; i < resume.list.len(); i++ {
|
||||||
logger.Actionf("resuming %s %s in %s namespace", resume.humanKind, resume.list.resumeItem(i).asClientObject().GetName(), *kubeconfigArgs.Namespace)
|
logger.Actionf("resuming %s %s in %s namespace", resume.humanKind, resume.list.resumeItem(i).asClientObject().GetName(), *kubeconfigArgs.Namespace)
|
||||||
obj := resume.list.resumeItem(i)
|
resume.list.resumeItem(i).setUnsuspended()
|
||||||
patch := client.MergeFrom(obj.deepCopyClientObject())
|
if err := kubeClient.Update(ctx, resume.list.resumeItem(i).asClientObject()); err != nil {
|
||||||
obj.setUnsuspended()
|
|
||||||
if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Successf("%s resumed", resume.humanKind)
|
logger.Successf("%s resumed", resume.humanKind)
|
||||||
|
|
||||||
if resumeArgs.wait || !resumeArgs.all {
|
namespacedName := types.NamespacedName{
|
||||||
namespacedName := types.NamespacedName{
|
Name: resume.list.resumeItem(i).asClientObject().GetName(),
|
||||||
Name: resume.list.resumeItem(i).asClientObject().GetName(),
|
Namespace: *kubeconfigArgs.Namespace,
|
||||||
Namespace: *kubeconfigArgs.Namespace,
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Waitingf("waiting for %s reconciliation", resume.kind)
|
|
||||||
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
|
|
||||||
isReady(ctx, kubeClient, namespacedName, resume.list.resumeItem(i))); err != nil {
|
|
||||||
logger.Failuref(err.Error())
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
logger.Successf("%s reconciliation completed", resume.kind)
|
|
||||||
logger.Successf(resume.list.resumeItem(i).successMessage())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Waitingf("waiting for %s reconciliation", resume.kind)
|
||||||
|
if err := wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout,
|
||||||
|
isReady(ctx, kubeClient, namespacedName, resume.list.resumeItem(i))); err != nil {
|
||||||
|
logger.Failuref(err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
logger.Successf("%s reconciliation completed", resume.kind)
|
||||||
|
logger.Successf(resume.list.resumeItem(i).successMessage())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var resumeSourceBucketCmd = &cobra.Command{
|
var resumeSourceBucketCmd = &cobra.Command{
|
||||||
@@ -31,8 +31,7 @@ var resumeSourceBucketCmd = &cobra.Command{
|
|||||||
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),
|
||||||
RunE: resumeCommand{
|
RunE: resumeCommand{
|
||||||
apiType: bucketType,
|
apiType: bucketType,
|
||||||
object: bucketAdapter{&sourcev1.Bucket{}},
|
object: &bucketAdapter{&sourcev1.Bucket{}},
|
||||||
list: bucketListAdapter{&sourcev1.BucketList{}},
|
|
||||||
}.run,
|
}.run,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var resumeSourceHelmChartCmd = &cobra.Command{
|
var resumeSourceHelmChartCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var resumeSourceGitCmd = &cobra.Command{
|
var resumeSourceGitCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var resumeSourceHelmCmd = &cobra.Command{
|
var resumeSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// These are general-purpose adapters for attaching methods to, for
|
// These are general-purpose adapters for attaching methods to, for
|
||||||
@@ -29,9 +29,8 @@ import (
|
|||||||
// sourcev1.Bucket
|
// sourcev1.Bucket
|
||||||
|
|
||||||
var bucketType = apiType{
|
var bucketType = apiType{
|
||||||
kind: sourcev1.BucketKind,
|
kind: sourcev1.BucketKind,
|
||||||
humanKind: "source bucket",
|
humanKind: "source bucket",
|
||||||
groupVersion: sourcev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type bucketAdapter struct {
|
type bucketAdapter struct {
|
||||||
@@ -63,9 +62,8 @@ func (a bucketListAdapter) len() int {
|
|||||||
// sourcev1.HelmChart
|
// sourcev1.HelmChart
|
||||||
|
|
||||||
var helmChartType = apiType{
|
var helmChartType = apiType{
|
||||||
kind: sourcev1.HelmChartKind,
|
kind: sourcev1.HelmChartKind,
|
||||||
humanKind: "source chart",
|
humanKind: "source chart",
|
||||||
groupVersion: sourcev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type helmChartAdapter struct {
|
type helmChartAdapter struct {
|
||||||
@@ -97,9 +95,8 @@ func (a helmChartListAdapter) len() int {
|
|||||||
// sourcev1.GitRepository
|
// sourcev1.GitRepository
|
||||||
|
|
||||||
var gitRepositoryType = apiType{
|
var gitRepositoryType = apiType{
|
||||||
kind: sourcev1.GitRepositoryKind,
|
kind: sourcev1.GitRepositoryKind,
|
||||||
humanKind: "source git",
|
humanKind: "source git",
|
||||||
groupVersion: sourcev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type gitRepositoryAdapter struct {
|
type gitRepositoryAdapter struct {
|
||||||
@@ -131,9 +128,8 @@ func (a gitRepositoryListAdapter) len() int {
|
|||||||
// sourcev1.HelmRepository
|
// sourcev1.HelmRepository
|
||||||
|
|
||||||
var helmRepositoryType = apiType{
|
var helmRepositoryType = apiType{
|
||||||
kind: sourcev1.HelmRepositoryKind,
|
kind: sourcev1.HelmRepositoryKind,
|
||||||
humanKind: "source helm",
|
humanKind: "source helm",
|
||||||
groupVersion: sourcev1.GroupVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type helmRepositoryAdapter struct {
|
type helmRepositoryAdapter struct {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
|
||||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@@ -28,6 +27,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"sigs.k8s.io/cli-utils/pkg/object"
|
"sigs.k8s.io/cli-utils/pkg/object"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// statusable is used to see if a resource is considered ready in the usual way
|
// statusable is used to see if a resource is considered ready in the usual way
|
||||||
@@ -36,26 +37,10 @@ type statusable interface {
|
|||||||
// this is implemented by ObjectMeta
|
// this is implemented by ObjectMeta
|
||||||
GetGeneration() int64
|
GetGeneration() int64
|
||||||
getObservedGeneration() int64
|
getObservedGeneration() int64
|
||||||
}
|
|
||||||
|
|
||||||
// oldConditions represents the deprecated API which is sunsetting.
|
|
||||||
type oldConditions interface {
|
|
||||||
// this is usually implemented by GOTK API objects because it's used by pkg/apis/meta
|
// this is usually implemented by GOTK API objects because it's used by pkg/apis/meta
|
||||||
GetStatusConditions() *[]metav1.Condition
|
GetStatusConditions() *[]metav1.Condition
|
||||||
}
|
}
|
||||||
|
|
||||||
func statusableConditions(object statusable) []metav1.Condition {
|
|
||||||
if s, ok := object.(meta.ObjectWithConditions); ok {
|
|
||||||
return s.GetConditions()
|
|
||||||
}
|
|
||||||
|
|
||||||
if s, ok := object.(oldConditions); ok {
|
|
||||||
return *s.GetStatusConditions()
|
|
||||||
}
|
|
||||||
|
|
||||||
return []metav1.Condition{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func isReady(ctx context.Context, kubeClient client.Client,
|
func isReady(ctx context.Context, kubeClient client.Client,
|
||||||
namespacedName types.NamespacedName, object statusable) wait.ConditionFunc {
|
namespacedName types.NamespacedName, object statusable) wait.ConditionFunc {
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
@@ -69,7 +54,7 @@ func isReady(ctx context.Context, kubeClient client.Client,
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if c := apimeta.FindStatusCondition(statusableConditions(object), meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(*object.GetStatusConditions(), meta.ReadyCondition); c != nil {
|
||||||
switch c.Status {
|
switch c.Status {
|
||||||
case metav1.ConditionTrue:
|
case metav1.ConditionTrue:
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ func init() {
|
|||||||
|
|
||||||
type suspendable interface {
|
type suspendable interface {
|
||||||
adapter
|
adapter
|
||||||
copyable
|
|
||||||
isSuspended() bool
|
isSuspended() bool
|
||||||
setSuspended()
|
setSuspended()
|
||||||
}
|
}
|
||||||
@@ -95,11 +94,8 @@ func (suspend suspendCommand) run(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
for i := 0; i < suspend.list.len(); i++ {
|
for i := 0; i < suspend.list.len(); i++ {
|
||||||
logger.Actionf("suspending %s %s in %s namespace", suspend.humanKind, suspend.list.item(i).asClientObject().GetName(), *kubeconfigArgs.Namespace)
|
logger.Actionf("suspending %s %s in %s namespace", suspend.humanKind, suspend.list.item(i).asClientObject().GetName(), *kubeconfigArgs.Namespace)
|
||||||
|
suspend.list.item(i).setSuspended()
|
||||||
obj := suspend.list.item(i)
|
if err := kubeClient.Update(ctx, suspend.list.item(i).asClientObject()); err != nil {
|
||||||
patch := client.MergeFrom(obj.deepCopyClientObject())
|
|
||||||
obj.setSuspended()
|
|
||||||
if err := kubeClient.Patch(ctx, obj.asClientObject(), patch); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Successf("%s suspended", suspend.humanKind)
|
logger.Successf("%s suspended", suspend.humanKind)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var suspendSourceBucketCmd = &cobra.Command{
|
var suspendSourceBucketCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var suspendSourceHelmChartCmd = &cobra.Command{
|
var suspendSourceHelmChartCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var suspendSourceGitCmd = &cobra.Command{
|
var suspendSourceGitCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var suspendSourceHelmCmd = &cobra.Command{
|
var suspendSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -123,31 +123,6 @@ spec:
|
|||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
|
||||||
.dockerconfigjson: eyJtYXNrIjoiKipTT1BTKioifQ==
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
kustomize.toolkit.fluxcd.io/name: podinfo
|
|
||||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
|
||||||
name: docker-secret
|
|
||||||
namespace: default
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
kustomize.toolkit.fluxcd.io/name: podinfo
|
|
||||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
|
||||||
name: secret-basic-auth-stringdata
|
|
||||||
namespace: default
|
|
||||||
stringData:
|
|
||||||
password: '**SOPS**'
|
|
||||||
username: '**SOPS**'
|
|
||||||
type: kubernetes.io/basic-auth
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
data:
|
data:
|
||||||
token: KipTT1BTKio=
|
token: KipTT1BTKio=
|
||||||
kind: Secret
|
kind: Secret
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
.dockerconfigjson: ENC[AES256_GCM,data:KHCFH3hNnc+PMfWLFEPjebf3W4z4WXbGFAANRZyZC+07z7wlrTALJM6rn8YslW4tMAWCoAYxblC5WRCszTy0h9rw0U/RGOv5H0qCgnNg/FILFUqhwo9pNfrUH+MEP4M9qxxbLKZwObpHUE7DUsKx1JYAxsI=,iv:q48lqUbUQD+0cbYcjNMZMJLRdGHi78ZmDhNAT2th9tg=,tag:QRI2SZZXQrAcdql3R5AH2g==,type:str]
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: docker-secret
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
||||||
sops:
|
|
||||||
kms: []
|
|
||||||
gcp_kms: []
|
|
||||||
azure_kv: []
|
|
||||||
hc_vault: []
|
|
||||||
age:
|
|
||||||
- recipient: age10la2ge0wtvx3qr7datqf7rs4yngxszdal927fs9rukamr8u2pshsvtz7ce
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA3eU1CTEJhVXZ4eEVYYkVV
|
|
||||||
OU90TEcrR2pYckttN0pBanJoSUZWSW1RQXlRCkUydFJ3V1NZUTBuVFF0aC9GUEcw
|
|
||||||
bUdhNjJWTkoyL1FUVi9Dc1dxUDBkM0UKLS0tIE1sQXkwcWdGaEFuY0RHQTVXM0J6
|
|
||||||
dWpJcThEbW15V3dXYXpPZklBdW1Hd1kKoIAdmGNPrEctV8h1w8KuvQ5S+BGmgqN9
|
|
||||||
MgpNmUhJjWhgcQpb5BRYpQesBOgU5TBGK7j58A6DMDKlSiYZsdQchQ==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
lastmodified: "2022-02-03T16:03:17Z"
|
|
||||||
mac: ENC[AES256_GCM,data:AHdYSawajwgAFwlmDN1IPNmT9vWaYKzyVIra2d6sPcjTbZ8/p+VRSRpVm4XZFFsaNnW5AUJaouwXnKYDTmJDXKlr/rQcu9kXqsssQgdzcXaA6l5uJlgsnml8ba7J3OK+iEKMax23mwQEx2EUskCd9ENOwFDkunP02sxqDNOz20k=,iv:8F5OamHt3fAVorf6p+SoIrWoqkcATSGWVoM0EK87S4M=,tag:E1mxXnc7wWkEX5BxhpLtng==,type:str]
|
|
||||||
pgp: []
|
|
||||||
encrypted_regex: ^(data|stringData)$
|
|
||||||
version: 3.7.1
|
|
||||||
@@ -4,8 +4,6 @@ resources:
|
|||||||
- ./deployment.yaml
|
- ./deployment.yaml
|
||||||
- ./hpa.yaml
|
- ./hpa.yaml
|
||||||
- ./service.yaml
|
- ./service.yaml
|
||||||
- ./dockerconfigjson-sops-secret.yaml
|
|
||||||
- ./stringdata-secret.yaml
|
|
||||||
secretGenerator:
|
secretGenerator:
|
||||||
- files:
|
- files:
|
||||||
- token=token.encrypted
|
- token=token.encrypted
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: secret-basic-auth-stringdata
|
|
||||||
type: kubernetes.io/basic-auth
|
|
||||||
stringData:
|
|
||||||
username: ENC[AES256_GCM,data:uKiQR48=,iv:jh2lgyAVu7igJAgoJsnOGhjxFyvUAa9lvT21u3hhqpU=,tag:zXM2JEpk3ZEH7WfkcWXXkw==,type:str]
|
|
||||||
password: ENC[AES256_GCM,data:PyhZmNhy929JGQ==,iv:PBqPaJmSw21+kn4gIlg5VdjLNZyf613z5RUTCesBoVw=,tag:Hjc7DsuUrtsz7PYPdNkL3g==,type:str]
|
|
||||||
sops:
|
|
||||||
kms: []
|
|
||||||
gcp_kms: []
|
|
||||||
azure_kv: []
|
|
||||||
hc_vault: []
|
|
||||||
age:
|
|
||||||
- recipient: age10la2ge0wtvx3qr7datqf7rs4yngxszdal927fs9rukamr8u2pshsvtz7ce
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBJd0xxbDZhYjVoZzY4YWhK
|
|
||||||
d2NvMVgrSGRVUGhHRGg3R1FpVURnbmh1TDBzCjcwby85M3JaK09QVk0yZFNMb2NL
|
|
||||||
c2NQZW5hS1FhYlBHU0VoUzBVYzZYUUUKLS0tIEdaNEw2Y0VjVHpZc3pyYUtLVmJk
|
|
||||||
NmN3K2VLU0NiZ1d0VHBYbGlCM1lrNmMKeWz3yfFbMNE+ly21oLfc1XnDSPRmnlPP
|
|
||||||
wIs8lk/qrzVZ45C9GdWnnPeGZZiia46Yop9TxseUS8gCjJ6KCxJCAg==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
lastmodified: "2022-02-06T12:51:07Z"
|
|
||||||
mac: ENC[AES256_GCM,data:jtdzwj19uxdxvnmXg1HkAkDA6XlKMJOYFy7uLI5t/t11LwGop5Yeo7a4nQEEELehRx9J7B6U6NiySxAxBxWx5uW5vI5c8+069VV6dkiCIefnYSzuoIhQafjlFl1/KvH7VEjIWfHYuXF09v9PEKXkxEHUYDpS3QqQ3ymHRRI08pU=, iv:xX3E7F+AM29Pm8G5oqxRfYu9E7tEBGIaHeCJYgrtFmc=,tag:MJPGusNvu05z939jg8PAwQ==,type:str]
|
|
||||||
pgp: []
|
|
||||||
encrypted_regex: ^(data|stringData)$
|
|
||||||
version: 3.7.1
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
► HorizontalPodAutoscaler/default/podinfo created
|
► HorizontalPodAutoscaler/default/podinfo created
|
||||||
► Service/default/podinfo created
|
► Service/default/podinfo created
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
► Secret/default/podinfo-token-77t89m9b67 created
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
► Secret/default/db-user-pass-bkbd782d2c created
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
► Deployment/default/podinfo created
|
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
|
||||||
► Service/default/podinfo created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
► Deployment/default/podinfo created
|
► Deployment/default/podinfo created
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
► HorizontalPodAutoscaler/default/podinfo created
|
||||||
► Service/default/podinfo created
|
► Service/default/podinfo created
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 drifted
|
► Secret/default/podinfo-token-77t89m9b67 drifted
|
||||||
|
|
||||||
data
|
data
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
► Deployment/default/podinfo created
|
► Deployment/default/podinfo created
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
► HorizontalPodAutoscaler/default/podinfo created
|
||||||
► Service/default/podinfo created
|
► Service/default/podinfo created
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
► Secret/default/podinfo-token-77t89m9b67 created
|
||||||
► Secret/default/db-user-pass-bkbd782d2c drifted
|
► Secret/default/db-user-pass-bkbd782d2c drifted
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,5 @@ spec.ports.http.port
|
|||||||
- 9899
|
- 9899
|
||||||
+ 9898
|
+ 9898
|
||||||
|
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
► Secret/default/podinfo-token-77t89m9b67 created
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
► Secret/default/db-user-pass-bkbd782d2c created
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
► Deployment/default/podinfo created
|
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
|
||||||
► Service/default/podinfo created
|
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata drifted
|
|
||||||
|
|
||||||
data
|
|
||||||
- one map entry removed: + one map entry added:
|
|
||||||
username1: "*****" username: "*****"
|
|
||||||
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
► Deployment/default/podinfo created
|
► Deployment/default/podinfo created
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
► HorizontalPodAutoscaler/default/podinfo created
|
||||||
► Service/default/podinfo created
|
► Service/default/podinfo created
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
► Secret/default/db-user-pass-bkbd782d2c created
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
.dockerconfigjson: eyJtYXNrIjoiKipTT1BTKioifQ==
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
kustomize.toolkit.fluxcd.io/name: podinfo
|
|
||||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
|
||||||
name: docker-secret
|
|
||||||
namespace: default
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
► Deployment/default/podinfo created
|
► Deployment/default/podinfo created
|
||||||
► HorizontalPodAutoscaler/default/podinfo created
|
► HorizontalPodAutoscaler/default/podinfo created
|
||||||
► Service/default/podinfo created
|
► Service/default/podinfo created
|
||||||
► Secret/default/docker-secret created
|
|
||||||
► Secret/default/secret-basic-auth-stringdata created
|
|
||||||
► Secret/default/podinfo-token-77t89m9b67 created
|
► Secret/default/podinfo-token-77t89m9b67 created
|
||||||
► Secret/default/db-user-pass-bkbd782d2c created
|
► Secret/default/db-user-pass-bkbd782d2c created
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
kustomize.toolkit.fluxcd.io/name: podinfo
|
|
||||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
|
||||||
name: secret-basic-auth-stringdata
|
|
||||||
namespace: default
|
|
||||||
stringData:
|
|
||||||
password: KipTT1BTKio=
|
|
||||||
username1: KipTT1BTKio=
|
|
||||||
type: kubernetes.io/basic-auth
|
|
||||||
2
cmd/flux/testdata/export/bucket.yaml
vendored
2
cmd/flux/testdata/export/bucket.yaml
vendored
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
apiVersion: source.toolkit.fluxcd.io/v1beta1
|
||||||
kind: Bucket
|
kind: Bucket
|
||||||
metadata:
|
metadata:
|
||||||
name: flux-system
|
name: flux-system
|
||||||
|
|||||||
4
cmd/flux/testdata/export/git-repo.yaml
vendored
4
cmd/flux/testdata/export/git-repo.yaml
vendored
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
apiVersion: source.toolkit.fluxcd.io/v1beta1
|
||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
metadata:
|
metadata:
|
||||||
name: flux-system
|
name: flux-system
|
||||||
@@ -11,6 +11,6 @@ spec:
|
|||||||
branch: main
|
branch: main
|
||||||
secretRef:
|
secretRef:
|
||||||
name: flux-system
|
name: flux-system
|
||||||
timeout: 1m0s
|
timeout: 20s
|
||||||
url: ssh://git@github.com/example/repo
|
url: ssh://git@github.com/example/repo
|
||||||
|
|
||||||
|
|||||||
2
cmd/flux/testdata/export/helm-repo.yaml
vendored
2
cmd/flux/testdata/export/helm-repo.yaml
vendored
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
apiVersion: source.toolkit.fluxcd.io/v1beta1
|
||||||
kind: HelmRepository
|
kind: HelmRepository
|
||||||
metadata:
|
metadata:
|
||||||
name: flux-system
|
name: flux-system
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
► deleting helmrelease thrfg in {{ .ns }} namespace
|
► deleting helmreleases thrfg in {{ .ns }} namespace
|
||||||
✔ helmrelease deleted
|
✔ helmreleases deleted
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
NAME REVISION SUSPENDED READY MESSAGE
|
NAME READY MESSAGE REVISION SUSPENDED
|
||||||
thrfg 6.0.0 False True Release reconciliation succeeded
|
thrfg True Release reconciliation succeeded 6.0.0 False
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
► resuming helmrelease thrfg in {{ .ns }} namespace
|
► resuming helmreleases thrfg in {{ .ns }} namespace
|
||||||
✔ helmrelease resumed
|
✔ helmreleases resumed
|
||||||
◎ waiting for HelmRelease reconciliation
|
◎ waiting for HelmRelease reconciliation
|
||||||
✔ HelmRelease reconciliation completed
|
✔ HelmRelease reconciliation completed
|
||||||
✔ applied revision 6.0.0
|
✔ applied revision 6.0.0
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
► suspending helmrelease thrfg in {{ .ns }} namespace
|
► suspending helmreleases thrfg in {{ .ns }} namespace
|
||||||
✔ helmrelease suspended
|
✔ helmreleases suspended
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user