-
Notifications
You must be signed in to change notification settings - Fork 11
CR-18810-fix-create-gs #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
"github.com/Masterminds/semver/v3" | ||
"github.com/argoproj-labs/argocd-autopilot/pkg/kube" | ||
apkube "github.com/argoproj-labs/argocd-autopilot/pkg/kube" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorder and add alias
@@ -38,8 +38,7 @@ import ( | |||
"github.com/codefresh-io/cli-v2/pkg/util/kube" | |||
routingutil "github.com/codefresh-io/cli-v2/pkg/util/routing" | |||
|
|||
"github.com/argoproj-labs/argocd-autopilot/pkg/fs" | |||
"github.com/argoproj-labs/argocd-autopilot/pkg/git" | |||
apfs "github.com/argoproj-labs/argocd-autopilot/pkg/fs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorder and add alias
func isRuntimeManaged(ctx context.Context, runtimeName string) (bool, error) { | ||
rt, err := getRuntime(ctx, runtimeName) | ||
if err != nil { | ||
return false, err | ||
} | ||
|
||
return rt.Managed, nil | ||
} | ||
|
||
func getRuntimeInstallationType(ctx context.Context, runtimeName string) (*platmodel.InstallationType, error) { | ||
rt, err := getRuntime(ctx, runtimeName) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &rt.InstallationType, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for those two funcs, were used in install prerun func before
apapp "github.com/argoproj-labs/argocd-autopilot/pkg/application" | ||
apfs "github.com/argoproj-labs/argocd-autopilot/pkg/fs" | ||
apgit "github.com/argoproj-labs/argocd-autopilot/pkg/git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorder and add alias
runtimeName := args[0] | ||
runtime, err := getRuntime(ctx, runtimeName) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
runtimeNamespace := runtimeName | ||
if runtime.Metadata.Namespace != nil { | ||
runtimeNamespace = *runtime.Metadata.Namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix for git-source create
command
return errors.New("This runtime was installed using Helm, please use Helm to uninstall it as well.") | ||
} | ||
|
||
if !opts.SkipChecks { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed all usage of SkipChecks
if !opts.Managed { | ||
opts.kubeContext, err = getKubeContextName(cmd.Flag("context"), cmd.Flag("kubeconfig")) | ||
if rt.Metadata.Namespace != nil { | ||
opts.runtimeNamespace = *rt.Metadata.Namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get namespace from platform runtime object
apapp "github.com/argoproj-labs/argocd-autopilot/pkg/application" | ||
apfs "github.com/argoproj-labs/argocd-autopilot/pkg/fs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorder and add alias
@@ -2191,3 +2192,22 @@ func patchClusterResourcesAppSet(fs fs.FS) error { | |||
appSet.ObjectMeta.Labels[store.Get().LabelKeyCFInternal] = "true" | |||
return fs.WriteYamls(name, appSet) | |||
} | |||
|
|||
func getRuntimeNamespace(cmd *cobra.Command, runtimeName string, runtimeVersion *semver.Version) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved from runtime.go
to runtime_install.go
- only used inside this file
@@ -40,7 +40,6 @@ cli-v2 runtime uninstall [RUNTIME_NAME] [flags] | |||
-n, --namespace string If present, the namespace scope for this CLI request | |||
--repo string Repository URL [GIT_REPO] | |||
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") | |||
--skip-checks If true, will not verify that runtime exists before uninstalling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marked as deprecated - so it doesn't appear in help text
What
cf git-source create
command to not crash (and handle runtime namespace correctly)cf runtime uninstall
to get runtime namespace from platformWhy
the
cf git-source create
command was crashing, thecf runtime uninstall
was working (even when runtimeName !== runtimeNamespace), but in a less safe way