Skip to content

Commit

Permalink
Fixes connect chaos-infra for infrastructureType (#177)
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <nageshbansal59@gmail.com>
  • Loading branch information
Nageshbansal committed Jan 16, 2024
1 parent cf8c33a commit 9794b0b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ require (
github.com/fatih/color v1.13.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
github.com/litmuschaos/chaos-operator v0.0.0-20230109130222-de7c74a937a9
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20230720053327-bca5e97f553f
github.com/litmuschaos/chaos-operator v0.0.0-20230718113617-6819a4be12e4
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20240115142759-7a29dc1eb1d8
github.com/manifoldco/promptui v0.9.0
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.3
k8s.io/apimachinery v0.23.3
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v12.0.0+incompatible
sigs.k8s.io/yaml v1.3.0
)
Expand All @@ -35,7 +35,7 @@ require (
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
Expand Down Expand Up @@ -78,11 +78,11 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.40.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/controller-runtime v0.11.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

// Pinned to kubernetes-1.21.2
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
Expand Down Expand Up @@ -347,10 +347,10 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/litmuschaos/chaos-operator v0.0.0-20230109130222-de7c74a937a9 h1:5VkAw2Zqf6xXEElnmFTVuNiP+YVZqH2Qr2t/yv6eI5g=
github.com/litmuschaos/chaos-operator v0.0.0-20230109130222-de7c74a937a9/go.mod h1:jRA6jKGed6ytLDJ7897yr2Kr2ygg+cuRXJqwvNmE4Bw=
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20230720053327-bca5e97f553f h1:XqbLcwNv3tRseZ0YjkE73bfHEpqqn2rUnoZCkoLWLFM=
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20230720053327-bca5e97f553f/go.mod h1:aQBzsyzaNX/JVS3KK0WGeaWSdLy898FM7gLHhJqfDBk=
github.com/litmuschaos/chaos-operator v0.0.0-20230718113617-6819a4be12e4 h1:GVU1jK8Gb9OaYuU3iDyU/FE3uZYmBwAEB95VY41SYJ8=
github.com/litmuschaos/chaos-operator v0.0.0-20230718113617-6819a4be12e4/go.mod h1:i6wMEZRQoHjUy4bhq6ePuA2FChX1b7WBR2lH09iM0tU=
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20240115142759-7a29dc1eb1d8 h1:Hu5I2NRugLXseU60mC25Da8lLbuXfUtmqQQuY+FELco=
github.com/litmuschaos/litmus/chaoscenter/graphql/server v0.0.0-20240115142759-7a29dc1eb1d8/go.mod h1:bS4JreJjEAUeMbp1iFDqaP/3QN8YZXF7TmDXSRru/7s=
github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
Expand Down Expand Up @@ -990,24 +990,24 @@ k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAE
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
k8s.io/klog/v2 v2.40.1 h1:P4RRucWk/lFOlDdkAr3mc7iWFkgKrZY9qZMAgek06S4=
k8s.io/klog/v2 v2.40.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE=
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf h1:M9XBsiMslw2lb2ZzglC0TOkBPK5NQi0/noUrdnoFwUg=
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk=
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs=
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/controller-runtime v0.11.1 h1:7YIHT2QnHJArj/dk9aUkYhfqfK5cIxPOX5gPECfdZLU=
sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y=
sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
8 changes: 1 addition & 7 deletions pkg/apis/infrastructure/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,13 @@ func ConnectInfra(infra types.Infra, cred types.Credentials) (InfraConnectionDat
}

func CreateRegisterInfraRequest(infra types.Infra) (request models.RegisterInfraRequest) {
var mode models.InfrastructureType
if infra.InfraType == utils.InfraTypeExternal {
mode = models.InfrastructureTypeExternal
} else {
mode = models.InfrastructureTypeInternal
}
return models.RegisterInfraRequest{
Name: infra.InfraName,
InfraScope: infra.Mode,
Description: &infra.Description,
PlatformName: infra.PlatformName,
EnvironmentID: infra.EnvironmentID,
InfrastructureType: mode,
InfrastructureType: models.InfrastructureTypeKubernetes,
InfraNamespace: &infra.Namespace,
ServiceAccount: &infra.ServiceAccount,
InfraNsExists: &infra.NsExists,
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/connect/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func init() {
infraCmd.Flags().String("name", "", "Set the Chaos infra name")
infraCmd.Flags().String("description", "---", "Set the Chaos infra description")
infraCmd.Flags().String("platform-name", "Others", "Set the platform name. Supported- AWS/GKE/Openshift/Rancher/Others")
infraCmd.Flags().String("chaos-infra-type", "external", "Set the chaos-infra-type to external for external Chaos infras | Supported=external/internal")
infraCmd.Flags().String("chaos-infra-type", "Kubernetes", "Set the chaos-infra-type to external for external Chaos infras | Supported=external/internal")
infraCmd.Flags().String("node-selector", "", "Set the node-selector for Chaos infra components | Format: \"key1=value1,key2=value2\")")
infraCmd.Flags().String("namespace", "litmus", "Set the namespace for the Chaos infra installation")
infraCmd.Flags().String("service-account", "litmus", "Set the service account to be used by the Chaos infra")
Expand Down
2 changes: 1 addition & 1 deletion pkg/infra_ops/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ ENVIRONMENT:
// Get platform name as input
newInfra.PlatformName = GetPlatformName(kubeconfig)
// Set Infra type
newInfra.InfraType = utils.InfraTypeExternal
newInfra.InfraType = utils.InfraTypeKubernetes
// Set project id
newInfra.ProjectId = pid
// Get namespace
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
ChaosInfraLabel = "app=subscriber"

// infra type is "external" for infras connected via litmusctl
InfraTypeExternal = "external"
InfraTypeKubernetes = "Kubernetes"

// member owner role
MemberOwnerRole = "Owner"
Expand Down

0 comments on commit 9794b0b

Please sign in to comment.