Skip to content

Commit

Permalink
support to change the namespace when install with helm
Browse files Browse the repository at this point in the history
Signed-off-by: wanjunlei <[email protected]>
  • Loading branch information
wanjunlei committed May 13, 2022
1 parent c14f9e5 commit 9b0991c
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 30 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/apis/v2beta1"
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/apis/v2beta2"

helm: controller-gen
kustomize build config/helm | sed -e '/creationTimestamp/d' > helm/crds/bundle.yaml
tar zcvf notification-manager.tgz helm

# Build all docker images for amd64 and arm64
build: test build-op build-nm

Expand Down
15 changes: 9 additions & 6 deletions hack/generate-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ openssl genrsa -out ca.key 2048
openssl req -x509 -new -nodes -key ca.key -subj "/C=CN/ST=HB/O=QC/CN=webhook-ca" -sha256 -days 36500 -out ca.crt
openssl genrsa -out server.key 2048
openssl req -new -nodes -keyout server.key -out server.csr -subj "/C=CN/ST=HB/O=QC/CN=notification-manager-webhook" -config openssl.cnf
#openssl req -new -sha256 -key server.key -subj "/C=CN/ST=HB/O=QC/CN=notification-manager-webhook.kubesphere-monitoring-system.svc" -out server.csr
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extfile openssl.cnf -out server.crt -days 36500 -sha256 -extensions v3_req

sed -ri "s/(tls.crt: )[^\n]*/\1$(cat server.crt | base64 -w 0)/" ../config/cert/webhook-server-cert.yaml
sed -ri "s/(tls.key: )[^\n]*/\1$(cat server.key | base64 -w 0)/" ../config/cert/webhook-server-cert.yaml
sed -ri "s/(caBundle: )[^\n]*/\1$(cat ca.crt | base64 -w 0)/" ../config/crd/patches/webhook_in_configs.yaml
sed -ri "s/(caBundle: )[^\n]*/\1$(cat ca.crt | base64 -w 0)/" ../config/crd/patches/webhook_in_receivers.yaml
sed -ri "s/(caBundle: )[^\n]*/\1$(cat ca.crt | base64 -w 0)/" ../config/webhook/manifests.yaml
key=$(cat server.key | base64 -w 0)
crt=$(cat server.crt | base64 -w 0)
ca=$(cat ca.crt | base64 -w 0)

sed -ri "s/(tls.crt: )[^\n]*/\1${crt}/" ../config/cert/webhook-server-cert.yaml
sed -ri "s/(tls.key: )[^\n]*/\1${key}/" ../config/cert/webhook-server-cert.yaml
sed -ri "s/(caBundle: )[^\n]*/\1${ca}/" ../config/crd/patches/webhook_in_configs.yaml
sed -ri "s/(caBundle: )[^\n]*/\1${ca}/" ../config/crd/patches/webhook_in_receivers.yaml
sed -ri "s/(caBundle: )[^\n]*/\1${ca}/" ../config/webhook/manifests.yaml

rm -rf ca.* ca.srt server.*
4 changes: 2 additions & 2 deletions hack/openssl.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ stateOrProvinceName_default = Some-State

localityName = Locality Name (eg, city)

0.organizationName = Organization Name (eg, company)
0.organizationName_default = Internet Widgits Pty Ltd
organizationName = Organization Name (eg, company)
organizationName_default = Internet Widgits Pty Ltd

# we can do this but it is not needed normally :-)
#1.organizationName = Second Organization Name (eg, company)
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/clusterrolebindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: notification-manager-sa
namespace: kubesphere-monitoring-system
namespace: {{ .Release.Namespace }}
{{- end}}
89 changes: 89 additions & 0 deletions helm/templates/post-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}-post-install
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-post-install
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- admissionregistration.k8s.io
resources:
- '*'
verbs:
- '*'

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-post-install
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "3"
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-post-install
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-post-install
apiGroup: rbac.authorization.k8s.io

---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-post-install
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "4"
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
spec:
backoffLimit: {{ .Values.hook.postInstall.backoffLimit }}
template:
metadata:
name: {{ .Release.Name }}
spec:
restartPolicy: Never
serviceAccountName: {{ .Release.Name }}-post-install
containers:
- name: post-install-job
image: "bitnami/kubectl:1.23.6"
command:
- /bin/sh
- -c
- |
caBundle=$(kubectl get validatingWebhookConfiguration notification-manager-validating-webhook -o jsonpath='{.webhooks[0].clientConfig.caBundle}')
cat > /tmp/patch.yaml <<EOF
spec:
conversion:
webhook:
clientConfig:
caBundle: ${caBundle}
service:
namespace: {{ .Release.Namespace }}
EOF
kubectl patch crd configs.notification.kubesphere.io --type=merge --patch-file /tmp/patch.yaml
kubectl patch crd receivers.notification.kubesphere.io --type=merge --patch-file /tmp/patch.yaml
1 change: 0 additions & 1 deletion helm/templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ apiVersion: v1
kind: Service
metadata:
name: notification-manager-webhook
namespace: kubesphere-monitoring-system
spec:
ports:
- port: 443
Expand Down
1 change: 0 additions & 1 deletion helm/templates/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ data:
kind: ConfigMap
metadata:
name: notification-manager-template
namespace: kubesphere-monitoring-system
9 changes: 0 additions & 9 deletions helm/templates/tls.yaml

This file was deleted.

29 changes: 21 additions & 8 deletions helm/templates/validating.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{{- $ca := genCA "webhook-ca" 36500 -}}
{{- $dns := cat "notification-manager-webhook." .Release.Namespace ".svc" | nospace -}}
{{- $cert := genSignedCert "notification-manager-webhook" (list) (list $dns) 36500 $ca -}}
apiVersion: v1
data:
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
kind: Secret
metadata:
name: notification-manager-webhook-server-cert
type: kubernetes.io/tls

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
Expand All @@ -6,10 +19,10 @@ webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURXekNDQWtPZ0F3SUJBZ0lVT3hOb1NwMTlmNS9CNllvZGlRek53MFdJWGhrd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1BERUxNQWtHQTFVRUJoTUNRMDR4Q3pBSkJnTlZCQWdNQWtoQ01Rc3dDUVlEVlFRS0RBSlJRekVUTUJFRwpBMVVFQXd3S2QyVmlhRzl2YXkxallUQWdGdzB5TVRBM01qY3dPREV5TXpaYUdBOHlNVEl4TURjd016QTRNVEl6Ck5sb3dQREVMTUFrR0ExVUVCaE1DUTA0eEN6QUpCZ05WQkFnTUFraENNUXN3Q1FZRFZRUUtEQUpSUXpFVE1CRUcKQTFVRUF3d0tkMlZpYUc5dmF5MWpZVENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQgpBTlpzblhIZ21meFJYL2MvQy95S0QzY3hMaGd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NzZoWVhCdVVReE9BVHlCdjNJMmZYUUkvU2ZrdW89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
caBundle: {{ $ca.Cert | b64enc }}
service:
name: notification-manager-webhook
namespace: kubesphere-monitoring-system
namespace: {{ .Release.Namespace }}
path: /validate-notification-kubesphere-io-v2beta2-config
failurePolicy: Fail
name: vconfig.notification.kubesphere.io
Expand All @@ -27,10 +40,10 @@ webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURXekNDQWtPZ0F3SUJBZ0lVT3hOb1NwMTlmNS9CNllvZGlRek53MFdJWGhrd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1BERUxNQWtHQTFVRUJoTUNRMDR4Q3pBSkJnTlZCQWdNQWtoQ01Rc3dDUVlEVlFRS0RBSlJRekVUTUJFRwpBMVVFQXd3S2QyVmlhRzl2YXkxallUQWdGdzB5TVRBM01qY3dPREV5TXpaYUdBOHlNVEl4TURjd016QTRNVEl6Ck5sb3dQREVMTUFrR0ExVUVCaE1DUTA0eEN6QUpCZ05WQkFnTUFraENNUXN3Q1FZRFZRUUtEQUpSUXpFVE1CRUcKQTFVRUF3d0tkMlZpYUc5dmF5MWpZVENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQgpBTlpzblhIZ21meFJYL2MvQy95S0QzY3hMaGdpSzZ5MkphMlh4OUtYeWRPUjNLSStVSzZ2dXM2V1YzTGl0eTZDCmtPVFlScjV6ZlV3aXZZYUMydHVGRnhTUE80L085dHhFVlBha1UwUGo1N0tVRDBiUnJZWEpDY1V5Ri9TZUlCY0EKMlFmbDZEem0rWjd4NHM1TnE1NFMvUUhpYzJFclVVbHEwbmd3MFQ3UVRieDB4M2Ria0ZNRko0VjlLSjVZdkhOSwpLeWdwR2szb2RpUWZ2Yi81b2hjUUhkTXpQV0Rmd25GTERHZjFUWGFHK0VYeDZodmVoK0RXV2grQzA5ZlI5R05yCmhzNnlZaUU1cmVmY29EUlhrRGVCSkZ3eWtPaVErRE5Fc0RaSU40VHlHTkhmeTRYaUp3QWgxNXBsZTkzQWNTTVQKTlEwNWRYK2FiQmg0djQ4NDRab1lUS2tDQXdFQUFhTlRNRkV3SFFZRFZSME9CQllFRko5NzNRUUVSVi9DVlRCZQovbmFyQmhZcS9GV0pNQjhHQTFVZEl3UVlNQmFBRko5NzNRUUVSVi9DVlRCZS9uYXJCaFlxL0ZXSk1BOEdBMVVkCkV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBQk9ZOWNDbFpTYm1scndFN0YvZVBMVm4Kenl2dW0yUUE3MU9rcGRtWjN6cnV1MW16VmZNNU1ORndkUkJMOGduS05IdjEzaGhFeGQ4enJmQ2hYQWIzaWl5aQpSZnBSTzJodDBWSi9HQklaYlM1ZjIvZ1hvNXpSRHk0cFV0ekozOWZUZG9pNzQxNlhJdU9ubHI0bDk3ZnlRRTI4Cno0NlAzYlhidlZKU1VEcytFL1g0NVNHVS8xdFNCaFNnaTg1NllVWGxybWJNMDlHN29kSmx4VGozTG1qQ1NlQWUKWG9lYWlTUEl6UlMrWjVUQ0tudDdvbjVBSGQydzdrT0Q1K2tTK3gvbWY4aU1iaVV5dCtXYWVzdjNIcHg1TmwvWgprb1dxVVc1cXZlQ0poQUM0SVc5V3hmc2JWRXlZSTR0Zm9SNzZoWVhCdVVReE9BVHlCdjNJMmZYUUkvU2ZrdW89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
caBundle: {{ $ca.Cert | b64enc }}
service:
name: notification-manager-webhook
namespace: kubesphere-monitoring-system
namespace: {{ .Release.Namespace }}
path: /validate-notification-kubesphere-io-v2beta2-receiver
failurePolicy: Fail
name: vreceiver.notification.kubesphere.io
Expand All @@ -48,10 +61,10 @@ webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
caBundle: LS0tLS1C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L0ZXSk1BOEdBMVVkCkV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBQk9ZOWNDbFpTYm1scndFN0YvZVBMVm4Kenl2dW0yUUE3MU9rcGRtWjN6cnV1MW16VmZNNU1ORndkUkJMOGduS05IdjEzaGhFeGQ4enJmQ2hYQWIzaWl5aQpSZnBSTzJodDBWSi9HQklaYlM1ZjIvZ1hvNXpSRHk0cFV0ekozOWZUZG9pNzQxNlhJdU9ubHI0bDk3ZnlRRTI4Cno0NlAzYlhidlZKU1VEcytFL1g0NVNHVS8xdFNCaFNnaTg1NllVWGxybWJNMDlHN29kSmx4VGozTG1qQ1NlQWUKWG9lYWlTUEl6UlMrWjVUQ0tudDdvbjVBSGQydzdrT0Q1K2tTK3gvbWY4aU1iaVV5dCtXYWVzdjNIcHg1TmwvWgprb1dxVVc1cXZlQ0poQUM0SVc5V3hmc2JWRXlZSTR0Zm9SNzZoWVhCdVVReE9BVHlCdjNJMmZYUUkvU2ZrdW89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
caBundle: {{ $ca.Cert | b64enc }}
service:
name: notification-manager-webhook
namespace: kubesphere-monitoring-system
namespace: {{ .Release.Namespace }}
path: /validate-notification-kubesphere-io-v2beta2-router
failurePolicy: Fail
name: vrouter.notification.kubesphere.io
Expand All @@ -69,10 +82,10 @@ webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURXekNDQWtPZ0F3SUJBZ0lVT3hOb1NwMTlmNS9CNllvZGlRek53MFdJWGhrd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1BERUxNQWtHQTFVRUJoTUNRMDR4Q3pBSkJnTlZCQWdNQWtoQ01Rc3dDUVlEVlFRS0RBSlJRekVUTUJFRwpBMVVFQXd3S2QyVmlhRzl2YXkxallUQWdGdzB5TVRBM01qY3dPREV5TXpaYUdBOHlNVEl4TURjd016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I4Cno0NlAzYlhidlZKU1VEcytFL1g0NVNHVS8xdFNCaFNnaTg1NllVWGxybWJNMDlHN29kSmx4VGozTG1qQ1NlQWUKWG9lYWlTUEl6UlMrWjVUQ0tudDdvbjVBSGQydzdrT0Q1K2tTK3gvbWY4aU1iaVV5dCtXYWVzdjNIcHg1TmwvWgprb1dxVVc1cXZlQ0poQUM0SVc5V3hmc2JWRXlZSTR0Zm9SNzZoWVhCdVVReE9BVHlCdjNJMmZYUUkvU2ZrdW89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
caBundle: {{ $ca.Cert | b64enc }}
service:
name: notification-manager-webhook
namespace: kubesphere-monitoring-system
namespace: {{ .Release.Namespace }}
path: /validate-notification-kubesphere-io-v2beta2-silence
failurePolicy: Fail
name: vsilence.notification.kubesphere.io
Expand Down
5 changes: 4 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Whether Notification manager is running at the kubesphere.
kubesphere: false

hook:
postInstall:
backoffLimit: 1

# value of notification-manager-operator
operator:
containers:
Expand Down Expand Up @@ -78,4 +82,3 @@ notificationmanager:
template:
text:
name: notification-manager-template
namespace: kubesphere-monitoring-system
2 changes: 1 addition & 1 deletion pkg/notify/notifier/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (n *Notifier) Notify(ctx context.Context, data *template.Data) error {

err := n.send(ctx, to, subject, body)
if err != nil {
_ = level.Error(n.logger).Log("msg", "EmailNotifier: notify error", "from", n.receiver.From, "to", n.receiver.To, "error", err.Error())
_ = level.Error(n.logger).Log("msg", "EmailNotifier: notify error", "from", n.receiver.From, "to", utils.ArrayToString(n.receiver.To, ","), "error", err.Error())
return err
}

Expand Down

0 comments on commit 9b0991c

Please sign in to comment.