Skip to content

Commit

Permalink
fixing injection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abodhekar committed Sep 27, 2023
1 parent d2bfc6e commit e6ce38f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion helm/db-controller/templates/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ webhooks:
- clientConfig:
caBundle: Cg==
service:
name: {{ include "db-controller.fullname" . }}-dsnexec
name: {{ include "db-controller.fullname" . }}
path: /mutate-dsnexec
port: 7443
namespace: {{ .Release.Namespace }}
Expand Down
8 changes: 4 additions & 4 deletions webhook/webhook-dsnexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ var (
func dsnExecSideCarInjectionRequired(pod *corev1.Pod) (bool, string, string) {
remoteDbSecretName, ok := pod.Annotations["infoblox.com/remote-db-dsn-secret"]
if !ok {
dsnexecLog.Info("remote-db-dsn-secret can not be seen in the annotations.", pod.Name)
dsnexecLog.Info("remote-db-dsn-secret can not be seen in the annotations.", pod.Name, pod.Annotations)
return false, "", ""
}

dsnExecConfigSecret, ok := pod.Annotations["infoblox.com/dsnexec-config-secret"]
if !ok {
dsnexecLog.Info("dsnexec-config-secret can not be seen in the annotations.", pod.Name)
dsnexecLog.Info("dsnexec-config-secret can not be seen in the annotations.", pod.Name, pod.Annotations)
return false, "", ""
}

alreadyInjected, err := strconv.ParseBool(pod.Annotations["infoblox.com/dsnexec-injected"])

if err == nil && alreadyInjected {
dsnexecLog.Info("DsnExec sidecar already injected: ", pod.Name, remoteDbSecretName, dsnExecConfigSecret)
dsnexecLog.Info("DsnExec sidecar already injected: ", pod.Name, remoteDbSecretName, pod.Name, dsnExecConfigSecret)
return false, remoteDbSecretName, dsnExecConfigSecret
}

dsnexecLog.Info("DsnExec sidecar Injection required: ", pod.Name, remoteDbSecretName, dsnExecConfigSecret)
dsnexecLog.Info("DsnExec sidecar Injection required: ", pod.Name, remoteDbSecretName, pod.Name, dsnExecConfigSecret)

return true, remoteDbSecretName, dsnExecConfigSecret
}
Expand Down

0 comments on commit e6ce38f

Please sign in to comment.