Skip to content
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

fix: PR930 ArgoCD pipeline set the namespace based on user input #1081

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ const (
ConfigCICDTektonGitRepoBasicAuthSecretNameKey = ConfigCICDTektonKey + d + "gitrepobasicauthsecret"
// ConfigCICDTektonRegistryPushSecretNameKey is for Tekton push image to registry credentials
ConfigCICDTektonRegistryPushSecretNameKey = ConfigCICDTektonKey + d + "registrypushsecret"
//ConfigCICDArgoDestinationNameSpace gives the user input namespace destination
ConfigCICDArgoDestinationNameSpace = "destnamespace"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the variable name from ConfigCICDArgoDestinationNameSpace to ConfigCICDArgoCDDestinationNameSpaceKey?

Also, can you add a new constantConfigCICDArgoCDKey = ConfigCICDKey + d + "argocd" (like we have for Tekton here), and change the value of ConfigCICDArgoCDDestinationNameSpaceKey to ConfigCICDArgoCDKey + d + "destnamespace"

//ConfigTargetExistingVersionUpdate represents key which how to update versions
ConfigTargetExistingVersionUpdate = ConfigTargetKey + d + "existingversionupdate"
//ConfigImageRegistryURLKey represents image registry url Key
Expand Down
13 changes: 12 additions & 1 deletion transformer/kubernetes/apiresource/argocdapplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package apiresource
import (
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/konveyor/move2kube/common"
"github.com/konveyor/move2kube/qaengine"
collecttypes "github.com/konveyor/move2kube/types/collection"
irtypes "github.com/konveyor/move2kube/types/ir"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -70,6 +71,16 @@ func (*ArgoCDApplication) createNewResource(irApplication irtypes.Application, t
clusterServer = deployToSameCluster
}
appGVK := v1alpha1.ApplicationSchemaGroupVersionKind
destNamespace := qaengine.FetchStringAnswer(
common.ConfigCICDArgoDestinationNameSpace,
"Enter the destination namespace for argo cd pipeline",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the string to "Enter the destination namespace for the Argo CD pipeline"

[]string{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of providing empty context []string{}, can we provide a context something like []string{If Argo CD pipeline is not relevant to you, then leave empty to use the default value for it.}

"",
nil,
)
if destNamespace == "" {
destNamespace = irApplication.DestNamespace
}
return &v1alpha1.Application{
TypeMeta: metav1.TypeMeta{APIVersion: appGVK.GroupVersion().String(), Kind: appGVK.Kind},
ObjectMeta: metav1.ObjectMeta{Name: irApplication.Name, Namespace: argoCDNameSpace},
Expand All @@ -81,7 +92,7 @@ func (*ArgoCDApplication) createNewResource(irApplication irtypes.Application, t
},
Destination: v1alpha1.ApplicationDestination{
Server: clusterServer,
Namespace: irApplication.DestNamespace,
Namespace: destNamespace,
},
},
}
Expand Down