Update components to v0.1
This commit is contained in:
@@ -34,8 +34,8 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var bootstrapCmd = &cobra.Command{
|
||||
@@ -53,6 +53,7 @@ var (
|
||||
bootstrapBranch string
|
||||
bootstrapWatchAllNamespaces bool
|
||||
bootstrapLogLevel string
|
||||
bootstrapManifestsPath string
|
||||
bootstrapRequiredComponents = []string{"source-controller", "kustomize-controller"}
|
||||
)
|
||||
|
||||
@@ -80,6 +81,8 @@ func init() {
|
||||
bootstrapCmd.PersistentFlags().BoolVar(&bootstrapWatchAllNamespaces, "watch-all-namespaces", true,
|
||||
"watch for custom resources in all namespaces, if set to false it will only watch the namespace where the toolkit is installed")
|
||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapLogLevel, "log-level", "info", "set the controllers log level")
|
||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapManifestsPath, "manifests", "", "path to the manifest directory")
|
||||
bootstrapCmd.PersistentFlags().MarkHidden("manifests")
|
||||
}
|
||||
|
||||
func bootstrapValidate() error {
|
||||
@@ -100,7 +103,21 @@ func bootstrapValidate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateInstallManifests(targetPath, namespace, tmpDir string) (string, error) {
|
||||
func generateInstallManifests(targetPath, namespace, tmpDir string, localManifests string) (string, error) {
|
||||
manifestsDir := path.Join(tmpDir, targetPath, namespace)
|
||||
if err := os.MkdirAll(manifestsDir, os.ModePerm); err != nil {
|
||||
return "", fmt.Errorf("creating manifests dir failed: %w", err)
|
||||
}
|
||||
manifest := path.Join(manifestsDir, bootstrapInstallManifest)
|
||||
|
||||
if localManifests != "" {
|
||||
if err := buildKustomization(localManifests, manifest); err != nil {
|
||||
return "", fmt.Errorf("build kustomization failed: %w", err)
|
||||
}
|
||||
|
||||
return manifest, nil
|
||||
}
|
||||
|
||||
gotkDir := path.Join(tmpDir, ".gotk")
|
||||
defer os.RemoveAll(gotkDir)
|
||||
|
||||
@@ -114,12 +131,6 @@ func generateInstallManifests(targetPath, namespace, tmpDir string) (string, err
|
||||
return "", fmt.Errorf("generating manifests failed: %w", err)
|
||||
}
|
||||
|
||||
manifestsDir := path.Join(tmpDir, targetPath, namespace)
|
||||
if err := os.MkdirAll(manifestsDir, os.ModePerm); err != nil {
|
||||
return "", fmt.Errorf("generating manifests failed: %w", err)
|
||||
}
|
||||
|
||||
manifest := path.Join(manifestsDir, bootstrapInstallManifest)
|
||||
if err := buildKustomization(gotkDir, manifest); err != nil {
|
||||
return "", fmt.Errorf("build kustomization failed: %w", err)
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// generate install manifests
|
||||
logger.Generatef("generating manifests")
|
||||
manifest, err := generateInstallManifests(ghPath, namespace, tmpDir)
|
||||
manifest, err := generateInstallManifests(ghPath, namespace, tmpDir, bootstrapManifestsPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// generate install manifests
|
||||
logger.Generatef("generating manifests")
|
||||
manifest, err := generateInstallManifests(glPath, namespace, tmpDir)
|
||||
manifest, err := generateInstallManifests(glPath, namespace, tmpDir, bootstrapManifestsPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -32,8 +33,8 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var createHelmReleaseCmd = &cobra.Command{
|
||||
@@ -275,7 +276,7 @@ func isHelmChartReady(ctx context.Context, kubeClient client.Client, name, names
|
||||
}
|
||||
|
||||
for _, condition := range helmChart.Status.Conditions {
|
||||
if condition.Type == helmv2.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
|
||||
@@ -30,9 +30,10 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var createKsCmd = &cobra.Command{
|
||||
@@ -306,7 +307,7 @@ func isKustomizationReady(ctx context.Context, kubeClient client.Client, name, n
|
||||
}
|
||||
|
||||
for _, condition := range kustomization.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var createSourceBucketCmd = &cobra.Command{
|
||||
|
||||
@@ -20,12 +20,13 @@ import (
|
||||
"context"
|
||||
"crypto/elliptic"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/manifoldco/promptui"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -373,7 +374,7 @@ func isGitRepositoryReady(ctx context.Context, kubeClient client.Client, name, n
|
||||
}
|
||||
|
||||
for _, condition := range gitRepository.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var createSourceHelmCmd = &cobra.Command{
|
||||
|
||||
@@ -64,6 +64,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
createTenantCmd.Hidden = true
|
||||
createTenantCmd.Flags().StringSliceVar(&tenantNamespaces, "with-namespace", nil, "namespace belonging to this tenant")
|
||||
createTenantCmd.Flags().StringVar(&tenantClusterRole, "cluster-role", "cluster-admin", "cluster role of the tenant role binding")
|
||||
createCmd.AddCommand(createTenantCmd)
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
)
|
||||
|
||||
var deleteHelmReleaseCmd = &cobra.Command{
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/manifoldco/promptui"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/manifoldco/promptui"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/manifoldco/promptui"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/manifoldco/promptui"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
)
|
||||
|
||||
var exportHelmReleaseCmd = &cobra.Command{
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var exportKsCmd = &cobra.Command{
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var exportSourceBucketCmd = &cobra.Command{
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var exportSourceGitCmd = &cobra.Command{
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var exportSourceHelmCmd = &cobra.Command{
|
||||
|
||||
@@ -18,12 +18,13 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
)
|
||||
|
||||
var getHelmReleaseCmd = &cobra.Command{
|
||||
@@ -68,7 +69,7 @@ func getHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
isInitialized := false
|
||||
for _, condition := range helmRelease.Status.Conditions {
|
||||
if condition.Type == helmv2.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status != corev1.ConditionFalse {
|
||||
if helmRelease.Status.LastAppliedRevision != "" {
|
||||
logger.Successf("%s last applied revision %s", helmRelease.GetName(), helmRelease.Status.LastAppliedRevision)
|
||||
|
||||
@@ -18,8 +18,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@@ -67,7 +68,7 @@ func getKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
isInitialized := false
|
||||
for _, condition := range kustomization.Status.Conditions {
|
||||
if condition.Type == kustomizev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status != corev1.ConditionFalse {
|
||||
if kustomization.Status.LastAppliedRevision != "" {
|
||||
logger.Successf("%s last applied revision %s", kustomization.GetName(), kustomization.Status.LastAppliedRevision)
|
||||
|
||||
@@ -18,8 +18,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@@ -62,7 +63,7 @@ func getSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
|
||||
for _, source := range list.Items {
|
||||
isInitialized := false
|
||||
for _, condition := range source.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status != corev1.ConditionFalse {
|
||||
logger.Successf("%s last fetched revision: %s", source.GetName(), source.Status.Artifact.Revision)
|
||||
} else {
|
||||
|
||||
@@ -18,8 +18,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@@ -62,7 +63,7 @@ func getSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||
for _, source := range list.Items {
|
||||
isInitialized := false
|
||||
for _, condition := range source.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status != corev1.ConditionFalse {
|
||||
logger.Successf("%s last fetched revision: %s", source.GetName(), source.Status.Artifact.Revision)
|
||||
} else {
|
||||
|
||||
@@ -18,8 +18,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@@ -62,7 +63,7 @@ func getSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||
for _, source := range list.Items {
|
||||
isInitialized := false
|
||||
for _, condition := range source.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status != corev1.ConditionFalse {
|
||||
logger.Successf("%s last fetched revision: %s", source.GetName(), source.Status.Artifact.Revision)
|
||||
} else {
|
||||
|
||||
@@ -76,8 +76,8 @@ func init() {
|
||||
"toolkit version")
|
||||
installCmd.Flags().StringSliceVar(&installComponents, "components", defaultComponents,
|
||||
"list of components, accepts comma-separated values")
|
||||
installCmd.Flags().StringVar(&installManifestsPath, "manifests", "",
|
||||
"path to the manifest directory, dev only")
|
||||
installCmd.Flags().StringVar(&installManifestsPath, "manifests", "", "path to the manifest directory")
|
||||
installCmd.Flags().MarkHidden("manifests")
|
||||
installCmd.Flags().StringVar(&installRegistry, "registry", "ghcr.io/fluxcd",
|
||||
"container registry where the toolkit images are published")
|
||||
installCmd.Flags().StringVar(&installImagePullSecret, "image-pull-secret", "",
|
||||
@@ -102,14 +102,6 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
|
||||
var kustomizePath string
|
||||
if installVersion == "" && !strings.HasPrefix(installManifestsPath, "github.com/") {
|
||||
if _, err := os.Stat(installManifestsPath); err != nil {
|
||||
return fmt.Errorf("manifests not found: %w", err)
|
||||
}
|
||||
kustomizePath = installManifestsPath
|
||||
}
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", namespace)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -119,18 +111,18 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
|
||||
if !installExport {
|
||||
logger.Generatef("generating manifests")
|
||||
}
|
||||
if kustomizePath == "" {
|
||||
if installManifestsPath == "" {
|
||||
err = genInstallManifests(installVersion, namespace, installComponents,
|
||||
installWatchAllNamespaces, installRegistry, installImagePullSecret,
|
||||
installArch, installLogLevel, tmpDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("install failed: %w", err)
|
||||
}
|
||||
kustomizePath = tmpDir
|
||||
installManifestsPath = tmpDir
|
||||
}
|
||||
|
||||
manifest := path.Join(tmpDir, fmt.Sprintf("%s.yaml", namespace))
|
||||
if err := buildKustomization(kustomizePath, manifest); err != nil {
|
||||
if err := buildKustomization(installManifestsPath, manifest); err != nil {
|
||||
return fmt.Errorf("install failed: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/spf13/cobra/doc"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
|
||||
gotklog "github.com/fluxcd/toolkit/pkg/log"
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -27,9 +28,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
consts "github.com/fluxcd/pkg/runtime"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var reconcileHrCmd = &cobra.Command{
|
||||
@@ -98,10 +98,10 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error {
|
||||
logger.Actionf("annotating HelmRelease %s in %s namespace", name, namespace)
|
||||
if helmRelease.Annotations == nil {
|
||||
helmRelease.Annotations = map[string]string{
|
||||
consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
meta.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
}
|
||||
} else {
|
||||
helmRelease.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
helmRelease.Annotations[meta.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
if err := kubeClient.Update(ctx, &helmRelease); err != nil {
|
||||
return err
|
||||
@@ -144,7 +144,7 @@ func isHelmReleaseReady(ctx context.Context, kubeClient client.Client, name, nam
|
||||
}
|
||||
|
||||
for _, condition := range helmRelease.Status.Conditions {
|
||||
if condition.Type == helmv2.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse && helmRelease.Status.LastAttemptedRevision != "" {
|
||||
|
||||
@@ -19,15 +19,15 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
consts "github.com/fluxcd/pkg/runtime"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var reconcileKsCmd = &cobra.Command{
|
||||
@@ -94,10 +94,10 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
logger.Actionf("annotating kustomization %s in %s namespace", name, namespace)
|
||||
if kustomization.Annotations == nil {
|
||||
kustomization.Annotations = map[string]string{
|
||||
consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
meta.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
}
|
||||
} else {
|
||||
kustomization.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
kustomization.Annotations[meta.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
if err := kubeClient.Update(ctx, &kustomization); err != nil {
|
||||
return err
|
||||
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -27,8 +28,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
consts "github.com/fluxcd/pkg/runtime"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var reconcileSourceBucketCmd = &cobra.Command{
|
||||
@@ -73,10 +73,10 @@ func reconcileSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if bucket.Annotations == nil {
|
||||
bucket.Annotations = map[string]string{
|
||||
consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
meta.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
}
|
||||
} else {
|
||||
bucket.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
bucket.Annotations[meta.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
if err := kubeClient.Update(ctx, &bucket); err != nil {
|
||||
return err
|
||||
@@ -118,7 +118,7 @@ func isBucketReady(ctx context.Context, kubeClient client.Client, name, namespac
|
||||
}
|
||||
|
||||
for _, condition := range bucket.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
|
||||
@@ -19,14 +19,14 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
||||
consts "github.com/fluxcd/pkg/runtime"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var reconcileSourceGitCmd = &cobra.Command{
|
||||
@@ -71,10 +71,10 @@ func reconcileSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if gitRepository.Annotations == nil {
|
||||
gitRepository.Annotations = map[string]string{
|
||||
consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
meta.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
}
|
||||
} else {
|
||||
gitRepository.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
gitRepository.Annotations[meta.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
if err := kubeClient.Update(ctx, &gitRepository); err != nil {
|
||||
return err
|
||||
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -27,8 +28,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
consts "github.com/fluxcd/pkg/runtime"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var reconcileSourceHelmCmd = &cobra.Command{
|
||||
@@ -73,10 +73,10 @@ func reconcileSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if helmRepository.Annotations == nil {
|
||||
helmRepository.Annotations = map[string]string{
|
||||
consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
meta.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano),
|
||||
}
|
||||
} else {
|
||||
helmRepository.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
helmRepository.Annotations[meta.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
if err := kubeClient.Update(ctx, &helmRepository); err != nil {
|
||||
return err
|
||||
@@ -118,7 +118,7 @@ func isHelmRepositoryReady(ctx context.Context, kubeClient client.Client, name,
|
||||
}
|
||||
|
||||
for _, condition := range helmRepository.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -26,7 +27,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
)
|
||||
|
||||
var resumeHrCmd = &cobra.Command{
|
||||
@@ -112,11 +113,11 @@ func isHelmReleaseResumed(ctx context.Context, kubeClient client.Client, name, n
|
||||
}
|
||||
|
||||
for _, condition := range helmRelease.Status.Conditions {
|
||||
if condition.Type == helmv2.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
if condition.Reason == helmv2.SuspendedReason {
|
||||
if condition.Reason == meta.SuspendedReason {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -112,11 +112,11 @@ func isKustomizationResumed(ctx context.Context, kubeClient client.Client, name,
|
||||
}
|
||||
|
||||
for _, condition := range kustomization.Status.Conditions {
|
||||
if condition.Type == sourcev1.ReadyCondition {
|
||||
if condition.Type == meta.ReadyCondition {
|
||||
if condition.Status == corev1.ConditionTrue {
|
||||
return true, nil
|
||||
} else if condition.Status == corev1.ConditionFalse {
|
||||
if condition.Reason == kustomizev1.SuspendedReason {
|
||||
if condition.Reason == meta.SuspendedReason {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
)
|
||||
|
||||
var suspendHrCmd = &cobra.Command{
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
var uninstallCmd = &cobra.Command{
|
||||
|
||||
@@ -40,10 +40,10 @@ import (
|
||||
kustypes "sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
|
||||
"github.com/fluxcd/pkg/runtime/dependency"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
)
|
||||
|
||||
type Utils struct {
|
||||
|
||||
Reference in New Issue
Block a user