Skip to content

Commit

Permalink
Correctly checking if previous NS not in Terminating state (#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
devdattakulkarni authored Jul 26, 2024
1 parent 7af70e4 commit a7fe791
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mutating-webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,17 +586,17 @@ func getReleaseName(ar *v1.AdmissionReview) string {
}

func saveResource(ar *v1.AdmissionReview) {
fmt.Printf("Inside saveResource")
fmt.Printf("Inside saveResource\n")
kind, resName, _ := getObjectDetails(ar)
//key := kind + "/" + namespace + "/" + resName
key := kind + "-" + resName
fmt.Printf("Res Key:%s\n", key)
val, ok := resourceNameObjMap[key]
//fmt.Printf("Res Key:%s\n", key)
_, ok := resourceNameObjMap[key]
if !ok {
resourceNameObjMap[key] = ar
} else {
fmt.Printf("Key %s already present in resourceNameObjMap\n", key)
fmt.Printf("%v\n", val)
//fmt.Printf("%v\n", val)
}
}

Expand Down Expand Up @@ -1423,7 +1423,7 @@ func handleCustomAPIs(ar *v1.AdmissionReview) *v1.AdmissionResponse {
}

nsObj, nsGetErr := kubeClient.CoreV1().Namespaces().Get(context.Background(), crname, metav1.GetOptions{})
if nsGetErr != nil {
if nsGetErr == nil {
nsPhase := nsObj.Status.Phase
fmt.Printf("Namespace for %s exists. Current status is: %s\n", crname, nsPhase)
if nsPhase == "Terminating" {
Expand Down

0 comments on commit a7fe791

Please sign in to comment.