Skip to content

Commit

Permalink
Fix isRegistered check in GetK8sInfraYaml
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <nageshbansal59@gmail.com>
  • Loading branch information
Nageshbansal committed Sep 20, 2023
1 parent ed9728a commit 5382087
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions chaoscenter/graphql/server/pkg/chaos_infrastructure/infra_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,19 @@ func GetK8sInfraYaml(infra dbChaosInfra.ChaosInfra) ([]byte, error) {
config.TLSCert = utils.Config.TlsCertB64
}

if !infra.IsRegistered {
var respData []byte
if infra.InfraScope == ClusterScope {
respData, err = ManifestParser(infra, "manifests/cluster", &config)
} else if infra.InfraScope == NamespaceScope {
respData, err = ManifestParser(infra, "manifests/namespace", &config)
} else {
logrus.Error("INFRA_SCOPE env is empty!")
}
if err != nil {
return nil, err
}

return respData, nil
var respData []byte
if infra.InfraScope == ClusterScope {
respData, err = ManifestParser(infra, "manifests/cluster", &config)
} else if infra.InfraScope == NamespaceScope {
respData, err = ManifestParser(infra, "manifests/namespace", &config)
} else {
return []byte("Infra is already registered"), nil
logrus.Error("INFRA_SCOPE env is empty!")
}
if err != nil {
return nil, err
}

return respData, nil
}

// ManifestParser parses manifests yaml and generates dynamic manifest with specified keys
Expand Down

0 comments on commit 5382087

Please sign in to comment.