feat: limit control to single current only namespace
This commit is contained in:
@@ -7,6 +7,8 @@ metadata:
|
|||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: {{ .Release.Name }}-flink
|
app.kubernetes.io/name: {{ .Release.Name }}-flink
|
||||||
@@ -17,8 +19,28 @@ spec:
|
|||||||
app.kubernetes.io/name: {{ .Release.Name }}-flink
|
app.kubernetes.io/name: {{ .Release.Name }}-flink
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: volume-mount-hack
|
||||||
|
image: {{ .Values.flink.image.repository }}:{{ .Values.flink.image.tag }}
|
||||||
|
runAsUser: 0
|
||||||
|
command: ["sh", "-c", "chown -R flink {{ .Values.flink.state.data.dir }}/data {{ .Values.flink.state.data.dir }}/rocksdb {{ .Values.flink.state.data.dir }}/checkpoints {{ .Values.flink.state.data.dir }}/web-upload {{ .Values.flink.state.ha.dir }} {{ .Values.flink.state.savepoints.dir }}"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: flink-data
|
||||||
|
mountPath: {{ .Values.flink.state.data.dir }}/data
|
||||||
|
- name: flink-data
|
||||||
|
mountPath: {{ .Values.flink.state.data.dir }}/rocksdb
|
||||||
|
subPath: rocksdb
|
||||||
|
- name: flink-data
|
||||||
|
mountPath: {{ .Values.flink.state.data.dir }}/checkpoints
|
||||||
|
subPath: checkpoints
|
||||||
|
- name: flink-data
|
||||||
|
mountPath: {{ .Values.flink.state.data.dir }}/web-upload
|
||||||
|
subPath: web-upload
|
||||||
|
- name: flink-ha
|
||||||
|
mountPath: {{ .Values.flink.state.ha.dir }}
|
||||||
|
- name: flink-savepoints
|
||||||
|
mountPath: {{ .Values.flink.state.savepoints.dir }}
|
||||||
serviceAccountName: {{ include "flink-kube-operator.serviceAccountName" . }}
|
serviceAccountName: {{ include "flink-kube-operator.serviceAccountName" . }}
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
- name: flink
|
- name: flink
|
||||||
image: {{ .Values.flink.image.repository }}:{{ .Values.flink.image.tag }}
|
image: {{ .Values.flink.image.repository }}:{{ .Values.flink.image.tag }}
|
||||||
@@ -27,10 +49,12 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
port: 8081
|
port: 8081
|
||||||
|
failureThreshold: 8
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
port: 8081
|
port: 8081
|
||||||
|
failureThreshold: 8
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8081 # JobManager Web UI port
|
- containerPort: 8081 # JobManager Web UI port
|
||||||
- containerPort: 6121 # TaskManager communication port
|
- containerPort: 6121 # TaskManager communication port
|
||||||
@@ -38,6 +62,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: JOB_MANAGER_RPC_ADDRESS
|
- name: JOB_MANAGER_RPC_ADDRESS
|
||||||
value: "localhost" # JobManager and TaskManager in the same container
|
value: "localhost" # JobManager and TaskManager in the same container
|
||||||
|
- name: NAMESPACE
|
||||||
|
value: {{ .Release.Namespace }}
|
||||||
- name: FLINK_PROPERTIES
|
- name: FLINK_PROPERTIES
|
||||||
value: |
|
value: |
|
||||||
jobmanager.rpc.address: localhost
|
jobmanager.rpc.address: localhost
|
||||||
@@ -58,6 +84,7 @@ spec:
|
|||||||
state.backend.rocksdb.localdir: file://{{ .Values.flink.state.data.dir }}/rocksdb
|
state.backend.rocksdb.localdir: file://{{ .Values.flink.state.data.dir }}/rocksdb
|
||||||
high-availability.storageDir: file://{{ .Values.flink.state.ha.dir }}
|
high-availability.storageDir: file://{{ .Values.flink.state.ha.dir }}
|
||||||
state.savepoints.dir: file://{{ .Values.flink.state.savepoints.dir }}
|
state.savepoints.dir: file://{{ .Values.flink.state.savepoints.dir }}
|
||||||
|
state.backend.incremental: false
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: flink-data
|
- name: flink-data
|
||||||
mountPath: {{ .Values.flink.state.data.dir }}/data
|
mountPath: {{ .Values.flink.state.data.dir }}/data
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1
|
|||||||
kind: Role
|
kind: Role
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "flink-kube-operator.serviceAccountName" . }}
|
name: {{ include "flink-kube-operator.serviceAccountName" . }}
|
||||||
namespace: {{ .Release.Namespace }} # Namespace where the role is created
|
|
||||||
labels:
|
labels:
|
||||||
{{- include "flink-kube-operator.labels" . | nindent 4 }}
|
{{- include "flink-kube-operator.labels" . | nindent 4 }}
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ service:
|
|||||||
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
|
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
|
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
|
||||||
port: 80
|
port: 3000
|
||||||
|
|
||||||
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
|
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
|
||||||
ingress:
|
ingress:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package crd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flink-kube-operator/internal/crd/v1alpha1"
|
"flink-kube-operator/internal/crd/v1alpha1"
|
||||||
|
"os"
|
||||||
|
|
||||||
"flink-kube-operator/pkg"
|
"flink-kube-operator/pkg"
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ func (crd Crd) watchFlinkJobs() rxgo.Observable {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
pkg.Logger.Debug("[crd] starting watch")
|
pkg.Logger.Debug("[crd] starting watch")
|
||||||
watcher, err := crd.client.Watch(context.Background(), metaV1.ListOptions{})
|
watcher, err := crd.client.Namespace(os.Getenv("NAMESPACE")).Watch(context.Background(), metaV1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user