Skip to content

Commit

Permalink
get destNamespace from user input
Browse files Browse the repository at this point in the history
Signed-off-by: yzhang2480 <[email protected]>
  • Loading branch information
yzhang2480 committed Aug 26, 2023
1 parent 29c061c commit ff39df3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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"
//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",
[]string{},
"",
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

0 comments on commit ff39df3

Please sign in to comment.