Skip to content

Commit

Permalink
Fix isRegistered check in GetK8sInfraYaml (#4127)
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <nageshbansal59@gmail.com>
Co-authored-by: Saranya Jena <saranya.jena@harness.io>
  • Loading branch information
Nageshbansal and Saranya-jena committed Oct 4, 2023
1 parent c0a2bde commit 835a670
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
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 835a670

Please sign in to comment.