Skip to content

Commit

Permalink
Added a check for endpoint and some fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Chouhan <[email protected]>
  • Loading branch information
achouhan09 committed Sep 25, 2024
1 parent b51b8f5 commit 080d4f2
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions pkg/diagnostics/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ func RunReport(cmd *cobra.Command, args []string) {
log.Fatalf(`❌ Could not get core StatefulSet %q in Namespace %q`,
coreApp.Name, coreApp.Namespace)
}

// Fetching endpoint configurations
endpointApp := util.KubeObject(bundle.File_deploy_internal_deployment_endpoint_yaml).(*appsv1.Deployment)
endpointApp.Namespace = options.Namespace
if !util.KubeCheck(endpointApp) {
log.Fatalf(`❌ Could not get endpoint Deployment %q in Namespace %q`,
endpointApp.Name, endpointApp.Namespace)
}
fmt.Println("")

// retrieving the status of proxy environment variables
proxyStatus(coreApp)

// retrieving the overriden env variables using `CONFIG_JS_` prefix
overridenEnvVar(coreApp)
overridenEnvVar(coreApp, endpointApp)

// TODO: Add support for additional features
}
Expand All @@ -51,14 +59,23 @@ func proxyStatus(coreApp *appsv1.StatefulSet) {
}

// overridedEnvVar retrieves and displays overridden environment variables with the prefix `CONFIG_JS_` from the noobaa-core-0 pod
func overridenEnvVar(coreApp *appsv1.StatefulSet) {
func overridenEnvVar(coreApp *appsv1.StatefulSet, endpointApp *appsv1.Deployment) {
log := util.Logger()

log.Print("⏳ Retrieving overridden environment variables from the pod `noobaa-core-0`...\n")
fmt.Print("Overriden Environment Variables Check:\n----------------------------------\n")
log.Print("⏳ Retrieving overridden environment variable details...\n")

fmt.Print("Overriden Environment Variables Check (NOOBAA-CORE):\n----------------------------------\n")
for _, envVar := range coreApp.Spec.Template.Spec.Containers[0].Env {
if strings.HasPrefix(envVar.Name, "CONFIG_JS_") {
fmt.Printf(" ✔ %-12s : %s\n", envVar.Name, envVar.Value)
fmt.Printf(" ✔ %-20s : %s\n", envVar.Name, envVar.Value)
}
}
fmt.Println("")

fmt.Print("Overriden Environment Variables Check (ENDPOINT):\n----------------------------------\n")
for _, envVar := range endpointApp.Spec.Template.Spec.Containers[0].Env {
if strings.HasPrefix(envVar.Name, "CONFIG_JS_") {
fmt.Printf(" ✔ %-20s : %s\n", envVar.Name, envVar.Value)
}
}
fmt.Println("")
Expand Down

0 comments on commit 080d4f2

Please sign in to comment.