This is an automated email from the ASF dual-hosted git repository.
mbalassi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new e84b1d7 [FLINK-26594][helm] Use helm release namespace as operator
namespace
e84b1d7 is described below
commit e84b1d71f020beeb54ea983beaf84ee31d2b81ed
Author: Hao Xin <[email protected]>
AuthorDate: Sat Mar 12 00:35:50 2022 +0800
[FLINK-26594][helm] Use helm release namespace as operator namespace
Closes #50
---
README.md | 17 +++++++++++++----
helm/flink-operator/templates/flink-operator.yaml | 8 ++++----
helm/flink-operator/templates/ingress.yaml | 2 +-
helm/flink-operator/templates/rbac.yaml | 14 +++++++-------
helm/flink-operator/templates/serviceaccount.yaml | 6 +++---
helm/flink-operator/templates/webhook.yaml | 18 +++++++++---------
helm/flink-operator/values.yaml | 3 ---
7 files changed, 37 insertions(+), 31 deletions(-)
diff --git a/README.md b/README.md
index ea8c57d..d8f3c9e 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,21 @@ A Kubernetes operator for Apache Flink, implemented in Java.
See [FLIP-212](http
## Installation
-The operator is managed helm chart. To install run:
+The operator installation is managed by a helm chart. To install run:
+
+```
+helm install flink-operator helm/flink-operator
+```
+
+Alternatively to install the operator (and also the helm chart) to a specific
namespace:
+
```
- cd helm/flink-operator
- helm install flink-operator .
+helm install flink-operator helm/flink-operator --namespace flink-operator
--create-namespace
```
+Note that in this case you will need to update the namespace in the examples
accordingly or the `default`
+namespace to the [watched namespaces](#watching-only-specific-namespaces).
+
### Validating webhook
In order to use the webhook for FlinkDeployment validation, you must install
the cert-manager on the Kubernetes cluster:
@@ -154,4 +163,4 @@ Savepoints can be triggered manually by defining a random
(nonce) value to the v
state: running
savepointTriggerNonce: 123
```
-The operator will trigger a savepoint every time the modified CR is applied
and the nonce is different from the previous value.
\ No newline at end of file
+The operator will trigger a savepoint every time the modified CR is applied
and the nonce is different from the previous value.
diff --git a/helm/flink-operator/templates/flink-operator.yaml
b/helm/flink-operator/templates/flink-operator.yaml
index 85bf299..df79f91 100644
--- a/helm/flink-operator/templates/flink-operator.yaml
+++ b/helm/flink-operator/templates/flink-operator.yaml
@@ -20,7 +20,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "flink-operator.name" . }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
spec:
@@ -54,7 +54,7 @@ spec:
{{- end }}
env:
- name: OPERATOR_NAMESPACE
- value: {{ .Values.operatorNamespace.name }}
+ value: {{ .Release.Namespace }}
- name: OPERATOR_NAME
value: {{ include "flink-operator.name" . }}
- name: FLINK_CONF_DIR
@@ -135,7 +135,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: flink-operator-config
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
data:
@@ -160,7 +160,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: flink-default-config
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
data:
diff --git a/helm/flink-operator/templates/ingress.yaml
b/helm/flink-operator/templates/ingress.yaml
index ddd990f..9ec43bf 100644
--- a/helm/flink-operator/templates/ingress.yaml
+++ b/helm/flink-operator/templates/ingress.yaml
@@ -21,7 +21,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "flink-operator.name" . }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
spec:
diff --git a/helm/flink-operator/templates/rbac.yaml
b/helm/flink-operator/templates/rbac.yaml
index ee3887d..8fa96aa 100644
--- a/helm/flink-operator/templates/rbac.yaml
+++ b/helm/flink-operator/templates/rbac.yaml
@@ -131,7 +131,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ include "flink-operator.serviceAccountName" $ }}
- namespace: {{ $.Values.operatorNamespace.name }}
+ namespace: {{ $.Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
@@ -161,7 +161,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: flink-operator
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
{{- template "flink-operator.rbacRules" $ }}
@@ -170,7 +170,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: flink
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
annotations:
@@ -181,7 +181,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: flink-operator-cluster-role-binding
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
roleRef:
@@ -191,13 +191,13 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ include "flink-operator.serviceAccountName" . }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: flink-role-binding
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
annotations:
@@ -209,6 +209,6 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ include "flink-operator.jobServiceAccountName" . }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
diff --git a/helm/flink-operator/templates/serviceaccount.yaml
b/helm/flink-operator/templates/serviceaccount.yaml
index 6602e57..665a236 100644
--- a/helm/flink-operator/templates/serviceaccount.yaml
+++ b/helm/flink-operator/templates/serviceaccount.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "flink-operator.serviceAccountName" . }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
{{- with .Values.operatorServiceAccount.annotations }}
@@ -59,7 +59,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "flink-operator.jobServiceAccountName" $ }}
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
labels:
{{- include "flink-operator.labels" $ | nindent 4 }}
{{- with .Values.jobServiceAccount.annotations }}
@@ -67,4 +67,4 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
-{{- end }}
\ No newline at end of file
+{{- end }}
diff --git a/helm/flink-operator/templates/webhook.yaml
b/helm/flink-operator/templates/webhook.yaml
index 664ae77..f1ffa9a 100644
--- a/helm/flink-operator/templates/webhook.yaml
+++ b/helm/flink-operator/templates/webhook.yaml
@@ -22,7 +22,7 @@ apiVersion: v1
kind: Service
metadata:
name: flink-operator-webhook-service
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 443
@@ -35,7 +35,7 @@ apiVersion: v1
kind: Secret
metadata:
name: flink-operator-webhook-secret
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
type: Opaque
data:
password: cGFzc3dvcmQxMjM0
@@ -45,11 +45,11 @@ apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: flink-operator-serving-cert
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
spec:
dnsNames:
- - flink-operator-webhook-service.{{ .Values.operatorNamespace.name }}.svc
- - flink-operator-webhook-service.{{ .Values.operatorNamespace.name
}}.svc.cluster.local
+ - flink-operator-webhook-service.{{ .Release.Namespace }}.svc
+ - flink-operator-webhook-service.{{ .Release.Namespace }}.svc.cluster.local
keystores:
pkcs12:
create: true
@@ -72,7 +72,7 @@ apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: flink-operator-selfsigned-issuer
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
spec:
selfSigned: {}
---
@@ -80,15 +80,15 @@ apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
- cert-manager.io/inject-ca-from: {{ .Values.operatorNamespace.name
}}/flink-operator-serving-cert
- name: flink-operator-{{ .Values.operatorNamespace.name
}}-webhook-configuration
+ cert-manager.io/inject-ca-from: {{ .Release.Namespace
}}/flink-operator-serving-cert
+ name: flink-operator-{{ .Release.Namespace }}-webhook-configuration
webhooks:
- name: vflinkdeployments.flink.apache.org
admissionReviewVersions: ["v1"]
clientConfig:
service:
name: flink-operator-webhook-service
- namespace: {{ .Values.operatorNamespace.name }}
+ namespace: {{ .Release.Namespace }}
path: /validate
failurePolicy: Fail
rules:
diff --git a/helm/flink-operator/values.yaml b/helm/flink-operator/values.yaml
index 4681713..3ca8a9b 100644
--- a/helm/flink-operator/values.yaml
+++ b/helm/flink-operator/values.yaml
@@ -18,9 +18,6 @@
---
-operatorNamespace:
- name: default
-
# List of kubernetes namespaces to watch for FlinkDeployment changes, empty
means all namespaces.
# When enabled RBAC is only created for said namespaces, otherwise it is done
for the cluster scope.
# watchNamespaces: ["flink"]