Files
fission-src/charts/fission-all/templates/deployment.yaml
T
smruthi2187andGitHub 2e37611da8 pre-upgrade job to verify function references and restricted privileges for fetcher and builder SA (#717)
It is mandatory (from this release onwards) for function to refer to secrets, config-maps and packages in its own namespace to ensure isolation of users sharing the same cluster.
This change runs a pre-upgrade job to verify function references for all functions created prior to this release and fails the upgrade by printing a list of functions that violate this restriction.
2018-06-04 19:30:27 -07:00

625 lines
15 KiB
YAML

---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.functionNamespace }}
labels:
name: fission-function
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.enableIstio }}
istio-injection: enabled
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.builderNamespace }}
labels:
name: fission-builder
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.enableIstio }}
istio-injection: enabled
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: secret-configmap-getter
rules:
- apiGroups:
- '*'
resources:
- secrets
- configmaps
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: package-getter
rules:
- apiGroups:
- '*'
resources:
- packages
verbs:
- get
- watch
- list
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-svc
namespace: {{ .Release.Namespace }}
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fission-admin
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: fission-svc
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: admin
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fission-crd
subjects:
- kind: ServiceAccount
name: fission-svc
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-fetcher
namespace: {{ .Values.functionNamespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-builder
namespace: {{ .Values.builderNamespace }}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: controller
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: controller
application: fission-api
spec:
containers:
- name: controller
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--controllerPort", "8888"]
env:
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
readinessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
serviceAccount: fission-svc
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
svc: executor
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: executor
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: executor
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: executor
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--fission-namespace", "{{ .Release.Namespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
readinessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: buildermgr
spec:
containers:
- name: buildermgr
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
serviceAccount: fission-svc
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kubewatcher
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: kubewatcher
spec:
containers:
- name: kubewatcher
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
serviceAccount: fission-svc
---
apiVersion: v1
kind: Service
metadata:
name: influxdb
labels:
svc: influxdb
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 8086
targetPort: 8086
selector:
svc: influxdb
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: influxdb
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: influxdb
spec:
containers:
- name: influxdb
image: tutum/influxdb
env:
- name: PRE_CREATE_DB
value: fissionFunctionLog
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: influxdb
key: username
- name: INFLUXDB_INIT_PWD
valueFrom:
secretKeyRef:
name: influxdb
key: password
---
{{- if .Values.heapster }}
apiVersion: v1
kind: Service
metadata:
name: heapster
namespace: kube-system
labels:
svc: heapster
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: heapster
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8082
selector:
svc: heapster
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: heapster
spec:
containers:
- name: heapster
image: gcr.io/google_containers/heapster-amd64:v1.5.0
command:
- /heapster
- --source=kubernetes:https://kubernetes.default
serviceAccount: {{ .Release.Namespace }}/fission-svc
---
{{- end -}}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: logger
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
template:
metadata:
labels:
svc: logger
spec:
containers:
- name: fluentd
image: "{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: INFLUXDB_ADDRESS
value: influxdb
- name: INFLUXDB_PORT
value: "8086"
- name: INFLUXDB_DBNAME
value: "fissionFunctionLog"
- name: INFLUXDB_USERNAME
valueFrom:
secretKeyRef:
name: influxdb
key: username
- name: INFLUXDB_PASSWD
valueFrom:
secretKeyRef:
name: influxdb
key: password
- name: FLUENTD_PATH
value: /var/log/containers/*{{.Values.functionNamespace}}*.log
volumeMounts:
- name: container-log
mountPath: /var/log/
readOnly: true
- name: docker-log
mountPath: /var/lib/docker/containers
readOnly: true
- name: fission-log
mountPath: /var/log/fission
readOnly: false
serviceAccount: fission-svc
volumes:
- name: container-log
hostPath:
path: /var/log/
- name: docker-log
hostPath:
path: /var/lib/docker/containers
- name: fission-log
hostPath:
path: /var/log/fission
updateStrategy:
type: RollingUpdate
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: timer
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: timer
spec:
containers:
- name: timer
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
serviceAccount: fission-svc
#
# This is commented out until fission-ui allows configuring the
# namespace. Right now it just crashes if Release.Namespace !=
# "fission".
#
#---
#apiVersion: extensions/v1beta1
#kind: Deployment
#metadata:
# name: fission-ui
# labels:
# chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
#spec:
# replicas: 1
# template:
# metadata:
# labels:
# svc: fission-ui
# spec:
# containers:
# - name: nginx
# image: {{ .Values.fissionUiImage }}
# - name: kubectl-proxy
# image: lachlanevenson/k8s-kubectl
# args: ["proxy", "--port", "8001", "--address", "127.0.0.1"]
# serviceAccount: fission-svc
---
{{- if eq .Values.messageQueue.type "nats-streaming" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
svc: nats-streaming
name: nats-streaming
spec:
replicas: 1
template:
metadata:
labels:
svc: nats-streaming
spec:
containers:
- name: nats-streaming
image: nats-streaming
args: [
"--cluster_id", "{{ .Values.nats.clusterID }}",
"--auth", "{{ .Values.nats.authToken }}",
"--max_channels", "0"
]
ports:
- containerPort: 4222
hostPort: 4222
protocol: TCP
{{- end }}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mqtrigger
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: mqtrigger
spec:
containers:
- name: mqtrigger
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: MESSAGE_QUEUE_TYPE
value: {{ .Values.messageQueue.type }}
{{- if eq .Values.messageQueue.type "nats-streaming" }}
- name: MESSAGE_QUEUE_URL
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
{{- else if eq .Values.messageQueue.type "azure-storage-queue" }}
- name: AZURE_STORAGE_ACCOUNT_NAME
value: {{ required "An Azure storage account name is required." .Values.azureStorageQueue.accountName }}
- name: AZURE_STORAGE_ACCOUNT_KEY
valueFrom:
secretKeyRef:
name: azure-storage-account-key
key: key
{{- end }}
serviceAccount: fission-svc
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: storagesvc
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: storagesvc
spec:
containers:
- name: storagesvc
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
env:
- name: PRUNE_INTERVAL
value: "{{.Values.pruneInterval}}"
volumeMounts:
- name: fission-storage
mountPath: /fission
readinessProbe:
httpGet:
path: "/healthz"
port: 8000
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8000
initialDelaySeconds: 35
periodSeconds: 5
serviceAccount: fission-svc
volumes:
- name: fission-storage
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default "fission-storage-pvc" }}
{{- else }}
emptyDir: {}
{{- end -}}