Skip to content

Commit

Permalink
fix: take destNamespace from user (#1069)
Browse files Browse the repository at this point in the history
* fix: take destNamespace from user
* fix: replace func with FetchStringAnswer
* fix: add key to constants.go
* fix: change description

Signed-off-by: Vamsi Krishna <vamsikrishnasatyasi971@gmail.com>
  • Loading branch information
SVKREP authored Sep 5, 2023
1 parent 18bb00d commit 6a71835
Show file tree
Hide file tree
Showing 2 changed files with 11 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 @@ -189,6 +189,8 @@ const (
ConfigServicesDotNetChildProjectsNamesKey = ConfigServicesKey + d + "%s" + d + "childProjects" + d + Special + d + "enable"
// ConfigServicesChildModulesSpringProfilesKey is the list of spring profiles for this child module. 1st arg is service name and 2nd is child module name.
ConfigServicesChildModulesSpringProfilesKey = ConfigServicesKey + d + "%s" + d + "childModules" + d + "%s" + d + "springBootProfiles"
// ConfigTransformersKubernetesArgoCDNamespaceKey represents namespace key for argocd transformer
ConfigTransformersKubernetesArgoCDNamespaceKey = ConfigTransformersKey + d + "kubernetes" + d + "argocd" + d + "namespace"
//VCSKey represents version control system key
VCSKey = BaseKey + d + "vcs"
//GitKey represents git qa key
Expand Down
10 changes: 9 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,13 @@ func (*ArgoCDApplication) createNewResource(irApplication irtypes.Application, t
clusterServer = deployToSameCluster
}
appGVK := v1alpha1.ApplicationSchemaGroupVersionKind
destNamespace := qaengine.FetchStringAnswer(
common.ConfigTransformersKubernetesArgoCDNamespaceKey,
"Enter the destination namespace for the Argo CD pipeline",
[]string{"If Argo CD pipeline is not relevant to you, then leave empty to use the default value for it."},
"",
nil,
)
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 +89,7 @@ func (*ArgoCDApplication) createNewResource(irApplication irtypes.Application, t
},
Destination: v1alpha1.ApplicationDestination{
Server: clusterServer,
Namespace: irApplication.DestNamespace,
Namespace: destNamespace,
},
},
}
Expand Down

0 comments on commit 6a71835

Please sign in to comment.