From 06de7c53ba6c51c44ac966663c43908962187074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 1 Aug 2023 21:11:13 +0300 Subject: [PATCH 01/77] minio-clusters: Clean up ingresses --- minio-clusters/README.md | 2 +- minio-clusters/dedicated.yaml | 51 +++++++++++ minio-clusters/external.yaml | 89 +++++++++++++++++++ .../{application.yaml => shared.yaml} | 85 +----------------- 4 files changed, 145 insertions(+), 82 deletions(-) create mode 100644 minio-clusters/dedicated.yaml create mode 100644 minio-clusters/external.yaml rename minio-clusters/{application.yaml => shared.yaml} (55%) diff --git a/minio-clusters/README.md b/minio-clusters/README.md index e19e93f..973f0b2 100644 --- a/minio-clusters/README.md +++ b/minio-clusters/README.md @@ -6,5 +6,5 @@ This namespace houses Minio clusters managed by To update bump the `image` tag for the classes and issue: ``` -kubectl apply -n minio-clusters -f application.yaml +kubectl apply -n minio-clusters -f dedicated.yaml -f external.yaml -f shared.yaml ``` diff --git a/minio-clusters/dedicated.yaml b/minio-clusters/dedicated.yaml new file mode 100644 index 0000000..33b5095 --- /dev/null +++ b/minio-clusters/dedicated.yaml @@ -0,0 +1,51 @@ +--- +apiVersion: codemowers.io/v1alpha1 +kind: ClusterBucketClass +metadata: + name: dedicated +spec: + targetNamespace: minio-clusters + description: "Dedicated Minio clusters" + replicas: 4 + storageClass: minio + podSpec: + containers: + - name: minio + env: + - name: MINIO_PROMETHEUS_AUTH_TYPE + value: public + image: minio/minio:RELEASE.2023-02-17T17-52-43Z + args: + - server + - --address + - 0.0.0.0:9000 + - --console-address + - 0.0.0.0:9001 + ports: + - containerPort: 9000 + name: http + - containerPort: 9001 + name: console + readinessProbe: + httpGet: + path: /minio/health/ready + port: 9000 + initialDelaySeconds: 2 + periodSeconds: 5 + resources: + requests: + cpu: 300m + memory: 1Gi + limits: + cpu: 4000m + memory: 2Gi + volumeMounts: + - name: data + mountPath: /data + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/minio-clusters/external.yaml b/minio-clusters/external.yaml new file mode 100644 index 0000000..cd9a614 --- /dev/null +++ b/minio-clusters/external.yaml @@ -0,0 +1,89 @@ +--- +apiVersion: codemowers.io/v1alpha1 +kind: ClusterBucketClass +metadata: + name: external +spec: + description: "Minio instance running on the ZFS storage box" + targetNamespace: minio-clusters + targetCluster: external +--- +apiVersion: v1 +kind: Service +metadata: + name: external + namespace: minio-clusters +spec: + externalName: 172.20.9.2 + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 9000 + type: ExternalName +--- +apiVersion: v1 +kind: Service +metadata: + name: external-console + namespace: minio-clusters +spec: + externalName: 172.20.9.2 + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 9001 + type: ExternalName +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: external + namespace: minio-clusters + annotations: + kubernetes.io/ingress.class: traefik + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + external-dns.alpha.kubernetes.io/target: traefik.k-space.ee +spec: + rules: + - host: minio-cluster-external.k-space.ee + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: external + port: + name: http + tls: + - hosts: + - "*.k-space.ee" +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: external-console + namespace: minio-clusters + annotations: + kubernetes.io/ingress.class: traefik + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + external-dns.alpha.kubernetes.io/target: traefik.k-space.ee +spec: + rules: + - host: minio-cluster-external-console.k-space.ee + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: external-console + port: + name: http + tls: + - hosts: + - "*.k-space.ee" diff --git a/minio-clusters/application.yaml b/minio-clusters/shared.yaml similarity index 55% rename from minio-clusters/application.yaml rename to minio-clusters/shared.yaml index 753ec5b..16b6a1b 100644 --- a/minio-clusters/application.yaml +++ b/minio-clusters/shared.yaml @@ -1,15 +1,6 @@ --- apiVersion: codemowers.io/v1alpha1 kind: ClusterBucketClass -metadata: - name: external -spec: - description: "Minio instance running on the ZFS storage box" - targetNamespace: minio-clusters - targetCluster: external ---- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterBucketClass metadata: name: shared spec: @@ -60,61 +51,10 @@ spec: operator: Equal value: storage --- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterBucketClass -metadata: - name: dedicated -spec: - targetNamespace: minio-clusters - description: "Dedicated Minio clusters" - replicas: 4 - storageClass: minio - podSpec: - containers: - - name: minio - env: - - name: MINIO_PROMETHEUS_AUTH_TYPE - value: public - image: minio/minio:RELEASE.2023-02-17T17-52-43Z - args: - - server - - --address - - 0.0.0.0:9000 - - --console-address - - 0.0.0.0:9001 - ports: - - containerPort: 9000 - name: http - - containerPort: 9001 - name: console - readinessProbe: - httpGet: - path: /minio/health/ready - port: 9000 - initialDelaySeconds: 2 - periodSeconds: 5 - resources: - requests: - cpu: 300m - memory: 1Gi - limits: - cpu: 4000m - memory: 2Gi - volumeMounts: - - name: data - mountPath: /data - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: minio-cluster-shared + name: shared namespace: minio-clusters annotations: kubernetes.io/ingress.class: traefik @@ -130,40 +70,23 @@ spec: path: "/" backend: service: - name: minio-cluster-shared + name: shared port: name: http tls: - hosts: - "*.k-space.ee" --- -apiVersion: v1 -kind: Service -metadata: - name: minio-cluster-shared-console - namespace: minio-clusters -spec: - ports: - - name: http - protocol: TCP - port: 80 - targetPort: 9001 - selector: - app.kubernetes.io/instance: shared - app.kubernetes.io/name: minio - clusterIP: None ---- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: minio-cluster-shared-console + name: shared-console namespace: minio-clusters annotations: kubernetes.io/ingress.class: traefik traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee - traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd spec: rules: - host: minio-cluster-shared-console.k-space.ee @@ -173,7 +96,7 @@ spec: path: "/" backend: service: - name: minio-cluster-shared-console + name: shared-console port: name: http tls: From 29be7832c7667103c7880f9905a2d22791825e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 2 Aug 2023 09:06:13 +0300 Subject: [PATCH 02/77] freescout: Fix S3 URL-s --- freescout/application.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/freescout/application.yml b/freescout/application.yml index b9c1374..54d2d9c 100644 --- a/freescout/application.yml +++ b/freescout/application.yml @@ -124,6 +124,8 @@ spec: secretKeyRef: name: freescout-secrets key: DB_PASS + - name: AWS_USE_PATH_STYLE_ENDPOINT + value: "true" - name: AWS_BUCKET valueFrom: secretKeyRef: From 603b237091bf7ae8fa0231142cf6f81bd898518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 3 Aug 2023 08:41:51 +0300 Subject: [PATCH 03/77] Add Wikijs --- wiki/application.yml | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 wiki/application.yml diff --git a/wiki/application.yml b/wiki/application.yml new file mode 100644 index 0000000..65bda04 --- /dev/null +++ b/wiki/application.yml @@ -0,0 +1,99 @@ +--- +apiVersion: codemowers.io/v1alpha1 +kind: OIDCGWClient +metadata: + name: wiki +spec: + displayName: Wiki + uri: https://wiki.k-space.ee + redirectUris: + - https://wiki.k-space.ee/login/a4cdccdc-c879-4387-a64a-6584a02a85e9/callback + allowedGroups: + - k-space:floor + grantTypes: + - authorization_code + - refresh_token + responseTypes: + - code + availableScopes: + - openid + - profile + tokenEndpointAuthMethod: client_secret_post + pkce: false +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: wikijs + labels: + app.kubernetes.io/name: wikijs +spec: + serviceName: wikijs + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: wikijs + template: + metadata: + labels: + app.kubernetes.io/name: wikijs + spec: + containers: + - name: wikijs + image: requarks/wiki:2 + env: + - name: DB_TYPE + value: mysql + - name: DB_HOST + value: mariadb.infra.k-space.ee + - name: DB_PORT + value: "3306" + - name: DB_USER + value: kspace_wiki + - name: DB_NAME + value: kspace_wiki + - name: DB_PASS + valueFrom: + secretKeyRef: + name: wikijs-secrets + key: DB_PASS + ports: + - containerPort: 3000 + name: http +--- +apiVersion: v1 +kind: Service +metadata: + name: wikijs +spec: + selector: + app.kubernetes.io/name: wikijs + ports: + - port: 80 + name: http + targetPort: http +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: wikijs + annotations: + kubernetes.io/ingress.class: traefik + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + external-dns.alpha.kubernetes.io/target: traefik.k-space.ee +spec: + rules: + - host: wiki.k-space.ee + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: wikijs + port: + name: http + tls: + - hosts: + - "*.k-space.ee" From a97b66448527d18ded9acfba42856455beaa886f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 3 Aug 2023 17:05:11 +0300 Subject: [PATCH 04/77] Update Kube API OIDC configuration --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5c6cb8d..0ae9d98 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ patch /etc/kubernetes/manifests/kube-apiserver.yaml - << EOF - --etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt - --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key - --etcd-servers=https://127.0.0.1:2379 -+ - --oidc-issuer-url=https://auth.k-space.ee ++ - --oidc-issuer-url=https://auth2.k-space.ee/ + - --oidc-client-id=kubelogin -+ - --oidc-username-claim=preferred_username ++ - --oidc-username-claim=sub + - --oidc-groups-claim=groups - --kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt - --kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key @@ -77,8 +77,8 @@ users: args: - oidc-login - get-token - - --oidc-issuer-url=https://auth.k-space.ee - - --oidc-client-id=kubelogin + - --oidc-issuer-url=https://auth2.k-space.ee/ + - --oidc-client-id=oidc-gateway-kubelogin - --oidc-use-pkce - --oidc-extra-scope=profile,email,groups - --listen-address=127.0.0.1:27890 From c338ca3bed21dd77ba4a69e1e01ee1d652e940ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 4 Aug 2023 18:06:36 +0300 Subject: [PATCH 05/77] grafana: Use direct link for OIDC app listing # Please enter the commit message for your changes. Lines starting --- grafana/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana/application.yml b/grafana/application.yml index 5a0aff9..913f910 100644 --- a/grafana/application.yml +++ b/grafana/application.yml @@ -5,7 +5,7 @@ metadata: name: grafana spec: displayName: Grafana - uri: https://grafana.k-space.ee + uri: https://grafana.k-space.ee/login/generic_oauth redirectUris: - https://grafana.k-space.ee/login/generic_oauth allowedGroups: From 66f2a9ada096140b999647387440126e384978d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 4 Aug 2023 18:06:57 +0300 Subject: [PATCH 06/77] wildduck: Use upstream image for Wildduck webmail --- wildduck/webmail.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wildduck/webmail.yaml b/wildduck/webmail.yaml index 7aa21d5..7bc40ef 100644 --- a/wildduck/webmail.yaml +++ b/wildduck/webmail.yaml @@ -72,7 +72,7 @@ spec: spec: containers: - name: webmail - image: harbor.k-space.ee/k-space/wildduck-webmail:latest + image: nodemailer/wildduck-webmail:latest command: - node - server.js @@ -114,7 +114,7 @@ spec: ports: - protocol: TCP port: 80 - targetPort: 5000 + targetPort: 3000 --- apiVersion: networking.k8s.io/v1 kind: Ingress From d0bfdf514768ed6769656a022a81dc7d566efb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 4 Aug 2023 18:09:16 +0300 Subject: [PATCH 07/77] wildduck: Add ACL-s for webmail --- wildduck/webmail.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wildduck/webmail.yaml b/wildduck/webmail.yaml index 7bc40ef..2945805 100644 --- a/wildduck/webmail.yaml +++ b/wildduck/webmail.yaml @@ -14,6 +14,9 @@ metadata: spec: displayName: Wildduck Webmail uri: 'https://webmail.k-space.ee' + allowedGroups: + - k-space:floor + - k-space:friends headerMapping: user: Remote-Username --- From fe25d03989c6f69880713d73159e18310ab4e214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 10 Aug 2023 19:35:17 +0300 Subject: [PATCH 08/77] Add Ansible config --- ansible.cfg | 12 ++++++++++++ inventory.yml | 27 +++++++++++++++++++++++++++ ssh_config | 6 ++++++ 3 files changed, 45 insertions(+) create mode 100644 ansible.cfg create mode 100644 inventory.yml create mode 100644 ssh_config diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..fc206d3 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,12 @@ +[defaults] +ansible_managed = This file is managed by Ansible, manual changes will be overwritten. +inventory = inventory.yml +nocows = 1 +pipelining = True +pattern = +deprecation_warnings = False +fact_caching = jsonfile +fact_caching_connection = ~/.ansible/k-space-fact-cache + +[ssh_connection] +ssh_args = -F ssh_config diff --git a/inventory.yml b/inventory.yml new file mode 100644 index 0000000..ee93559 --- /dev/null +++ b/inventory.yml @@ -0,0 +1,27 @@ +all: + children: + masters: + hosts: + master1.kube.k-space.ee: + master2.kube.k-space.ee: + master3.kube.k-space.ee: + workers: + hosts: + mon1.kube.k-space.ee: + mon2.kube.k-space.ee: + mon3.kube.k-space.ee: + storage1.kube.k-space.ee: + storage2.kube.k-space.ee: + storage3.kube.k-space.ee: + storage4.kube.k-space.ee: + worker1.kube.k-space.ee: + worker2.kube.k-space.ee: + worker3.kube.k-space.ee: + worker4.kube.k-space.ee: + worker9.kube.k-space.ee: + doors: + hosts: + 100.102.3.1: + 100.102.3.2: + 100.102.3.3: + 100.102.3.4: diff --git a/ssh_config b/ssh_config new file mode 100644 index 0000000..901de57 --- /dev/null +++ b/ssh_config @@ -0,0 +1,6 @@ +Host * + User root + ControlPersist 8h + ControlMaster auto + ControlPath ~/.ssh/cm-%r@%h:%p + From 7a92a18bba9783c35878d19bc77c8519be6e716f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 11 Aug 2023 14:05:05 +0300 Subject: [PATCH 09/77] gitea: Fix HTTP to HTTPS redirect and Git URI format --- gitea/application.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitea/application.yaml b/gitea/application.yaml index 490456c..eaf1562 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -67,12 +67,14 @@ spec: value: "2222" - name: GITEA__SERVER__PROTOCOL value: https - - name: GITEA__REDIRECT_OTHER_PORT + - name: GITEA__SERVER__REDIRECT_OTHER_PORT value: "true" - - name: GITEA__PORT_TO_REDIRECT + - name: GITEA__SERVER__PORT_TO_REDIRECT value: "8080" - name: GITEA__SERVER__DOMAIN value: git.k-space.ee + - name: GITEA__SERVER__SSH_DOMAIN + value: git.k-space.ee - name: GITEA__SERVER__HTTP_ADDR value: 0.0.0.0 - name: GITEA__SERVER__ROOT_URL From ade71fffad9837927610069475f0d0b63dae03a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 11 Aug 2023 14:10:40 +0300 Subject: [PATCH 10/77] gitea: Bump to 1.20.2 --- gitea/application.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitea/application.yaml b/gitea/application.yaml index eaf1562..1aab414 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -53,7 +53,7 @@ spec: enableServiceLinks: false containers: - name: gitea - image: gitea/gitea:1.20.1 + image: gitea/gitea:1.20.2 env: - name: GITEA__SERVER__SSH_SERVER_HOST_KEYS value: ssh/gitea.rsa,ssh/gitea.ecdsa,ssh/gitea.ed25519 From b3fe86ea906c4f4f9688ed3d699221b5470501d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 11 Aug 2023 14:26:55 +0300 Subject: [PATCH 11/77] drone: Clean up configs --- drone/application.yml | 47 +++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/drone/application.yml b/drone/application.yml index eefc8ee..96b010e 100644 --- a/drone/application.yml +++ b/drone/application.yml @@ -1,14 +1,3 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: application-config -data: - DRONE_GITEA_SERVER: "https://git.k-space.ee" - DRONE_GIT_ALWAYS_AUTH: "false" - DRONE_PROMETHEUS_ANONYMOUS_ACCESS: "true" - DRONE_SERVER_HOST: "drone.k-space.ee" - DRONE_SERVER_PROTO: "https" - DRONE_USER_CREATE: "username:lauri,admin:true" --- apiVersion: v1 kind: Service @@ -59,14 +48,27 @@ spec: httpGet: path: / port: http + env: + - name: DRONE_GITEA_SERVER + value: https://git.k-space.ee + - name: DRONE_GIT_ALWAYS_AUTH + value: "false" + - name: DRONE_SERVER_HOST + value: drone.k-space.ee + - name: DRONE_SERVER_PROTO + value: https + - name: DRONE_USER_CREATE + value: username:lauri,admin:true + - name: DRONE_DEBUG + value: "true" + - name: DRONE_TRACE + value: "true" envFrom: - - secretRef: - name: application-secrets - - configMapRef: - name: application-config + - secretRef: + name: application-secrets volumeMounts: - - name: drone-data - mountPath: /data + - name: drone-data + mountPath: /data volumeClaimTemplates: - metadata: name: drone-data @@ -78,6 +80,16 @@ spec: requests: storage: 8Gi --- +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: redirect +spec: + redirectRegex: + regex: ^https://(.*)/register$ + replacement: https://${1}/ + permanent: false +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -87,6 +99,7 @@ metadata: kubernetes.io/ingress.class: traefik traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" + traefik.ingress.kubernetes.io/router.middlewares: drone-redirect@kubernetescrd spec: tls: - hosts: From 612e788d9bd74b1113275a7b94e6c1d89e9edeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 11 Aug 2023 15:02:36 +0300 Subject: [PATCH 12/77] gitea: Disable third party OIDC login --- gitea/application.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitea/application.yaml b/gitea/application.yaml index 1aab414..abb7c1b 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -55,6 +55,8 @@ spec: - name: gitea image: gitea/gitea:1.20.2 env: + - name: GITEA__OPENID__ENABLE_OPENID_SIGNIN + value: "false" - name: GITEA__SERVER__SSH_SERVER_HOST_KEYS value: ssh/gitea.rsa,ssh/gitea.ecdsa,ssh/gitea.ed25519 - name: GITEA__SERVER__START_SSH_SERVER From d492b400fad690b679bd067e21310a43a4d162b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 12 Aug 2023 13:20:03 +0300 Subject: [PATCH 13/77] Add door controller setup --- ansible-doors.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 ansible-doors.yml diff --git a/ansible-doors.yml b/ansible-doors.yml new file mode 100644 index 0000000..41d6893 --- /dev/null +++ b/ansible-doors.yml @@ -0,0 +1,49 @@ +# ansible doors -m shell -a "ctr image pull harbor.k-space.ee/k-space/mjpg-streamer:latest" +# journalctl -u mjpg_streamer@video0.service -f +- name: Setup doors + hosts: doors + tasks: + - name: Make sure containerd is installed + ansible.builtin.apt: + name: containerd + state: present + - name: Copy systemd service for mjpg-streamer + copy: + dest: /etc/systemd/system/mjpg_streamer@.service + content: | + [Unit] + Description=A server for streaming Motion-JPEG from a video capture device + After=network.target + ConditionPathExists=/dev/%I + [Service] + ExecStart=ctr run --rm --privileged --read-only --net-host harbor.k-space.ee/k-space/mjpg-streamer:latest mjpg-streamer /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I' -o 'output_http.so -w /usr/share/mjpg_streamer/www' + [Install] + WantedBy=multi-user.target + - name: Enable Doorboy controller + ansible.builtin.systemd: + state: restarted + daemon_reload: yes + name: mjpg_streamer@video0.service + - name: Copy systemd service for Doorboy controller + copy: + dest: /etc/systemd/system/godoor.service + content: | + [Unit] + Description=Doorboy service + Documentation=https://git.k-space.ee/k-space/godoor + [Service] + EnvironmentFile=/etc/godoor + Environment=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed + Environment=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll + Environment=KDOORPI_API_SWIPE=https://inventory.k-space.ee/swipes + Environment=KDOORPI_DOOR=%H + ExecStart=/usr/local/bin/godoor + User=root + Restart=always + [Install] + WantedBy=multi-user.target + - name: Enable Doorboy controller + ansible.builtin.systemd: + state: restarted + daemon_reload: yes + name: godoor.service From 2ef01e2b2875d0cb5e5907f17a95142e74890af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 08:16:26 +0300 Subject: [PATCH 14/77] camtiler: Require floor access ACL --- camtiler/ingress.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/camtiler/ingress.yml b/camtiler/ingress.yml index 255dbda..c4a4dde 100644 --- a/camtiler/ingress.yml +++ b/camtiler/ingress.yml @@ -6,6 +6,8 @@ metadata: spec: displayName: Cameras uri: 'https://cams.k-space.ee/tiled' + allowedGroups: + - k-space:floor --- apiVersion: networking.k8s.io/v1 kind: Ingress From 0fce65b6a59bde53565b03e9d77887fb3b08ce36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 08:17:32 +0300 Subject: [PATCH 15/77] camtiler: Update cameras config --- camtiler/application.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/camtiler/application.yml b/camtiler/application.yml index 6990673..05f5304 100644 --- a/camtiler/application.yml +++ b/camtiler/application.yml @@ -274,7 +274,7 @@ metadata: spec: target: http://user@server-room.cam.k-space.ee:8080/?action=stream secretRef: camera-secrets - replicas: 1 + replicas: 2 --- apiVersion: k-space.ee/v1alpha1 kind: Camera @@ -317,7 +317,7 @@ kind: Camera metadata: name: back-door spec: - target: http://user@back-door.cam.k-space.ee:8080/?action=stream + target: http://user@100.102.3.3:8080/?action=stream secretRef: camera-secrets replicas: 1 --- @@ -326,6 +326,6 @@ kind: Camera metadata: name: ground-door spec: - target: http://user@ground-door.cam.k-space.ee:8080/?action=stream + target: http://user@100.102.3.1:8080/?action=stream secretRef: camera-secrets replicas: 1 From a00c85d5f6e61fc6b9dba9f01ce640d26bad37fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 18:35:25 +0300 Subject: [PATCH 16/77] Move whoami --- oidc-gateway/deployment.yml | 4 +- oidc-gateway/kubelogin.yaml | 1 + oidc-gateway/texts.yml | 132 +++++++++++++++++++++++++-- {traefik => oidc-gateway}/whoami.yml | 0 traefik/values.yml | 2 + 5 files changed, 130 insertions(+), 9 deletions(-) rename {traefik => oidc-gateway}/whoami.yml (100%) diff --git a/oidc-gateway/deployment.yml b/oidc-gateway/deployment.yml index a83c560..e85b37e 100644 --- a/oidc-gateway/deployment.yml +++ b/oidc-gateway/deployment.yml @@ -72,7 +72,7 @@ spec: serviceAccountName: oidc-gateway containers: - name: oidc-key-manager - image: codemowers/oidc-gateway + image: docker.io/codemowers/passmower command: [ '/app/node_modules/.bin/key-manager', 'initialize', '-c', 'cluster' ] restartPolicy: Never --- @@ -95,7 +95,7 @@ spec: serviceAccountName: oidc-gateway containers: - name: oidc-gateway - image: docker.io/codemowers/oidc-gateway + image: docker.io/codemowers/passmower ports: - containerPort: 3000 diff --git a/oidc-gateway/kubelogin.yaml b/oidc-gateway/kubelogin.yaml index 71dc572..3c46dcf 100644 --- a/oidc-gateway/kubelogin.yaml +++ b/oidc-gateway/kubelogin.yaml @@ -18,3 +18,4 @@ spec: availableScopes: - openid - profile + tokenEndpointAuthMethod: none diff --git a/oidc-gateway/texts.yml b/oidc-gateway/texts.yml index d472d0f..400cbd4 100644 --- a/oidc-gateway/texts.yml +++ b/oidc-gateway/texts.yml @@ -4,9 +4,127 @@ kind: ConfigMap metadata: name: oidc-gateway-tos-v1 data: - tos.txt: | - Terms of Service + tos.md: | + Rules + Also known as code of conduct, guidelines, member vows, values etc. Please keep em' on one wiki page. Canonical URL shall be [k-space.ee/rules](http://k-space.ee/rules) which will redirect to right wiki page. + + These rules were approved 30. October 2020. Current version contains minor corrections. For future amendments of the rules please put your ideas and thoughts into [pad.k-space.ee/p/rules](https://pad.k-space.ee/p/rules), they will be taken into account during next General Assembly. + + Upon becoming a member I solemny swear that + + 1. **Who's who** + - I acknowledge the management of the hackerspace is governed by K-SPACE MTÜ (non-profit organization), it's [charter](/pohikiri_80397632_716212.pdf) and [Non-profit Associations Act](https://www.riigiteataja.ee/en/eli/528052020003/consolide) + - I acknowledge there are different membership forms listed under [membership#packages](/about/membership#packages) which can be largely broken down to affiliates (Regulars, Associates, Residents) who are at the hackerspace to make use of some services and members who are more involved in making the hackerspace happen. + - I acknowledge that in order to participate in the K-SPACE MTÜ management processes I need to obtain the [Member Tier](/about/membership#member-tier) status, note that this is different from the 'Member package' which was renamed to 'Associate tier' in October of 2020 in order to clarify what member of an non-profit association means. + - Among the ['Member Tier'](https://members.k-space.ee/?filter=resident-member&filter=associate-member) people the board is elected which represents K-SPACE MTÜ in legal matters such as getting bills paid, signing rental contracts and so forth. Currently board members include Erki Naumanis only. Bearing the responsibility also means that board has the final word in many cases. + - I acknowledge K-SPACE MTÜ is renting rooms from SA Tallinna Teaduspark Tehnopol. The rental agreement imposes numerous conditions and constraints due to safety reasons. Eg corridors must be kept accessible and free of flammable materials. + + 1. **Stay positive.** + - I will set up a recurring payment (püsikorraldus) or pay up front in bulk. + - I will not go in debt. + - I acknowledge failing to pay membership fees for 2 months results in door access cancellation. + - I will mark my payments clearly and consistenly with my full name, so the payments can be automatically procesed. + + 1. **Clarity not obscurity.** + - I will mark my equipment, server, locker, desk with my full name, phone number and e-mail. + - I acknowledge that my unlabelled stuff will be unplugged. + - Before asking questions I will familiarize myself [how to ask questions](https://www.khanacademy.org/computing/computer-programming/programming/becoming-a-community-coder/a/ask-for-program-help) and provide enough details. + + 1. **Communication is vital** + - I will proactively communicate need to cancel or pause my subscription, e.g. in case of being unable to pay. + - Upon leaving I will vacate the locker and return any keys given to me. + - I acknowledge Slack is primary communications platform for K-SPACE MTÜ. This is mainly due to wanting to have a way to communicate even if all the selfhosted infra is down. I will request access to the channel from any of the onboarders. I will not complain about being left out of the loop about changes etc if I am not on the #members channel. + + 1. **Access controls** + + - I acknowledge primary method of accessing the floor is by using some of my own NFC cards (eg green Ühiskaart) or keyfobs. + - I will get my token registered in the door system of the day. To be on the safe side I will register multiple cards and/or keyfobs. + - I acknowledge Slack bot for opening the doors supplements the primary one, eg I can get in if I have forgot my card at home. + - I acknowledge that when it comes to security of doorcards it's nonexistant. I will not make copies of my card or distribute it's unique identifier sequence. + + 1. **Treat as your own -- with care** + - I will do my best to take care of the equipment and the space. + - I acknowledge that I must turn off the lights and leave windows in microventilation mode when I am the last one to leave. + - In case of equiment breakage I will notify info@k-space.ee immediately for resolution options. Any K-SPACE MTÜ owned equiment replacements must be purchased by K-SPACE MTÜ, see below under 'Regarding the toys' why. + - Upon losing (physical metal) key I will compensate 10EUR to K-SPACE MTÜ for it + + 1. **Contributions are welcome** + - I acknowledge that my immaterial contributions (e.g. building something for the hackerspace or helping others) doesn't compensate my membership fees. The only discount option is the 'Student discount'. Flexing with your contributions on your CV is OK. + - Before bringing any items for donation I will consult with a board member. K-SPACE is not my free (e-)junk disposal station. + - Donations don't compensate for my membership fees. K-SPACE MTÜ still needs to pay rent and electricity bills. + + 1. **Underpromise, overdeliver** + - I acknowledge there are many fun activities I want to be part of. + - I acknowledge I have obligations elsewhere as well (eg school, work, family). + - I will do my best to fulfill what I have promised to other members. + - I will rather say no in first place than say yes and fail to fulfill the promise. + - I will let the relying party know as soon as possible if I am not able to handle something I promised to do. + + 1. **Regarding the toys** + - I acknowledge I can bring my own equipment to hackerspace for common use. I acknowledge many others already do that. Lasercutter, CNC cutter, and many power tools are not owned by K-SPACE MTÜ. I take extra care of other members' equipment and before making use of them request training from the machine owner. + - I agree not to utilise any tool or piece of equipment unless I am competent in its use (and have completed induction/training where necessary) or are under the direct supervision of a competent user. + - I agree that the space is a potentially dangerous environment and that I may be exposed to various risks as a result of work undertaken by me or others. Notwithstanding all reasonable attempts by K-Space to ensure the safety of me and others, I agree to the full extent permitted by law to assume complete responsibility for my own actions and their consequences. + - If I think some new equipment would be useful for the space to be purchased by K-SPACE MTÜ I will make a suggestion to K-SPACE MTÜ board via board@k-space.ee. + - If I want to build something for the hackerspace I will consult with a board member for the compensation of materials. + - I acknowledge that my membership fees contribute towards refreshing equipment in common use, that is soldering irons, switches in server room etc. + - Purchases related to the hackerspace must be made by K-SPACE MTÜ. + - This is the clearest option from accounting perspective. + - It's also important that so any warranty, receipts and other documents would be correctly assigned to K-SPACE MTÜ and usable should you give up your membership at some point. + - Preferred option is to ask for proforma invoice for K-SPACE MTÜ, Akadeemia tee 21/1 and send it to info@k-space.ee - the payment will be executed by a board member. + - In case of Internet shops ask for the credit card from a board member. + + + 1. **No borrowing or lending equipment** + + - I acknowledge that equipment provided by K-SPACE MTÜ or it's members is for on-prem use only + - I will not take any of the equipment with me + - Only exception to this is workshops happening outside (eg visiting Robotex, Lapikud, IT College etc) + - I will notify info@k-space.ee about what I am going to take with me and why + - I will return equipment immediately after the event + - I acknowledge that this rule is due to numerous occasions people forgetting to return borrowed stuff + + 1. **Sharing is caring** + - I acknowledge that flexidesks also known as hot desks (8 desks in the middle of big room with projector) are to be cleaned by the end of the day. + - Sometimes exprompt events are scheduled in the room - I will not leave my stuff on flexidesks over night. If I come in often I can leave my screen and keyboard on one of the desks near the window. + - I acknowledge that for more persistent setup I should really switch to resident tier + + 1. **Being Mindful** + - While being active in the hackerspace I will make sure that my activites are not disturbing others, my activites are not causing exess financial drain on the K-SPACE MTÜ. + - Wearing earphones is generally sign of working on something and not wanting to be interrupted. + - I will act frugal. For example running additional servers without paying or running Bitcoin miner on the expense of K-SPACE MTÜ is NOT okay. + - Causing interruptions in the server room operation during working hours is NOT okay. Designated timeslot for disruptive changes is Thursday 19:00 until Friday 6:00. I recognize that occasionally hardware fails and non-disruptive changes might turn into disruptive outside that timeslot. + - I will not smoke inside the hackerspace rooms. I will exit the building for a cigarette. + + 1. **Striving for improvement*** + - I acknowledge that hackerspace is a vague term ranging from anarchocommunist potsmoking to fullblown commercial operation. + - I will do my best to educate myself about hackerspace and makerspace scene in general and I will not indulge in flamewars. + + 1. **Lock and stock** + - I acknowledge one locker is available for me for no charge with supporter and member tiers. + - I acknowledge that if would switch to resident tier I would be not eligible for a free locker as I would already have whole desk for my stuff + - I acknowledge additional lockers are available for 10EUR per month. + + 1. **Run the jewels** + - I will not make use of a blade server without legit reason, eg running hypervisor host. For single web application obtain VM from our Proxmox cluster. + - I will shut down machine not in use and I will make sure it stays shut. It's recurring issue that servers that have been shut down are discovered powered on again, eg in BIOS make sure it says 'last state' not 'always on' or even better disconnect power. + + 1. **Community FTW!** + - I acknowledge that people who take time to deal with me are not paid, they do it voluntarily off their free time for sh\*ts and giggles. + - They still pay membership fees. + - I will treat them and their time with respect. + - I will not become a burden for them. + - I acknowledge rules above are not exhaustive. + - I will do my best to act in good faith and not try to work around the rules. + - I accept that there will always be certain amount chaos at the hackerspace. + + **Disclaimer**: Lauri (K-SPACE founder) believes that: + * a) we can have a hackerspace that is not utter chaos + * b) that is financially in order + * c) offers friendly/flexible pricing for students + * d) keeps doors open for companies and startups + * e) allows reasonable buffer for experimentation. + Lauri's favourite example hackerspaces include [AFRA](https://wiki.hackerspaces.org/AFRA) and [Raumfahrtagentur](https://wiki.hackerspaces.org/Raumfahrtagentur) --- apiVersion: v1 kind: ConfigMap @@ -15,11 +133,11 @@ metadata: data: approval.txt: | Dear User, - + Thank you for your interest in accessing the K-Space MTÜ infrastructure. To become a member, please contact us at info@k-space.ee - + Also see https://www.k-space.ee/ - + Best regards, K-Space MTÜ --- apiVersion: v1 @@ -29,11 +147,11 @@ metadata: data: tos.txt: | Hi, <%= name %>! - + You agreed with the Terms of Service at <%= timestamp %> Content SHA256 hash: <%= hash %> - + Best regards, K-Space MTÜ tos.ejs: | diff --git a/traefik/whoami.yml b/oidc-gateway/whoami.yml similarity index 100% rename from traefik/whoami.yml rename to oidc-gateway/whoami.yml diff --git a/traefik/values.yml b/traefik/values.yml index 56b7a3b..d5f0f3b 100644 --- a/traefik/values.yml +++ b/traefik/values.yml @@ -10,6 +10,8 @@ websecure: providers: kubernetesCRD: enabled: true + allowEmptyServices: true + allowExternalNameServices: true kubernetesIngress: allowEmptyServices: true From 14617aad392507f665c768545f867dd483e0a03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 18:38:26 +0300 Subject: [PATCH 17/77] wildduck: Make wildflock HA --- wildduck/wildflock.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index 95bb31f..b13bcae 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -67,7 +67,7 @@ spec: selector: matchLabels: app: wildflock - replicas: 1 + replicas: 2 template: metadata: labels: @@ -79,6 +79,11 @@ spec: ports: - containerPort: 3030 env: + - name: REDIS_URL + valueFrom: + secretKeyRef: + name: redis-webmail-owner-secrets + key: REDIS_MASTER_1_URI - name: CLIENT_URL value: https://wildflock.k-space.ee - name: WILDDUCK_DOMAIN From ecf9111f8ff43cac9efda178653f8976a0cf1a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 18:48:45 +0300 Subject: [PATCH 18/77] wildduck: Add session secret for wildflock --- wildduck/wildflock.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index b13bcae..142bb64 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -1,4 +1,14 @@ --- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: wildflock +spec: + size: 32 + mapping: + - key: SESSION_SECRET + value: "%(plaintext)s" +--- apiVersion: codemowers.io/v1alpha1 kind: OIDCGWClient metadata: @@ -97,6 +107,11 @@ spec: secretKeyRef: name: wildduck key: WILDDUCK_API_TOKEN + - name: SESSION_SECRET + valueFrom: + secretKeyRef: + name: wildflock + key: SESSION_SECRET envFrom: - secretRef: name: oidc-client-wildflock-owner-secrets From 4d2071a5bd446cba7570bb5cd77a5fcb3054e5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Aug 2023 20:21:15 +0300 Subject: [PATCH 19/77] Move Kubernetes cluster bootstrap partially to Ansible --- README.md | 58 +------------------------------------- ansible-kubernetes.yml | 63 ++++++++++++++++++++++++++++++++++++++++++ inventory.yml | 46 +++++++++++++++++------------- 3 files changed, 91 insertions(+), 76 deletions(-) create mode 100644 ansible-kubernetes.yml diff --git a/README.md b/README.md index 0ae9d98..f8f0f1f 100644 --- a/README.md +++ b/README.md @@ -160,30 +160,7 @@ Added some ARM64 workers by using Ubuntu 22.04 server on Raspberry Pi. After machines have booted up and you can reach them via SSH: -```bash -# Enable required kernel modules -cat > /etc/modules << EOF -overlay -br_netfilter -EOF -cat /etc/modules | xargs -L 1 -t modprobe - -# Finetune sysctl: -cat > /etc/sysctl.d/99-k8s.conf << EOF -net.ipv4.conf.all.accept_redirects = 0 -net.bridge.bridge-nf-call-iptables = 1 -net.ipv4.ip_forward = 1 -net.bridge.bridge-nf-call-ip6tables = 1 - -# Elasticsearch needs this -vm.max_map_count = 524288 - -# Bump inotify limits to make sure -fs.inotify.max_user_instances=1280 -fs.inotify.max_user_watches=655360 -EOF -sysctl --system - +``` # Disable Ubuntu caching DNS resolver systemctl disable systemd-resolved.service systemctl stop systemd-resolved @@ -206,39 +183,6 @@ apt-get install -yqq linux-image-generic apt-get remove -yq cloud-init linux-image-*-kvm ``` -Install packages: - -```bash -OS=xUbuntu_22.04 -VERSION=1.25 -echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /"| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list -echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list - -rm -fv /etc/apt/trusted.gpg - -curl -s https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | gpg --dearmor > /etc/apt/trusted.gpg.d/libcontainers-archive-keyring.gpg -curl -s https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/Release.key | gpg --dearmor > /etc/apt/trusted.gpg.d/libcontainers-crio-archive-keyring.gpg -curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/packages-cloud-google.gpg - -echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list - -apt-get update -apt-get install -yqq --allow-change-held-packages apt-transport-https curl cri-o cri-o-runc kubelet=1.25.12-00 kubectl=1.25.12-00 kubeadm=1.25.12-00 cri-o=1.25.3~0 -apt-mark hold kubelet kubeadm kubectl cri-o - -cat << \EOF > /etc/containers/registries.conf -unqualified-search-registries = ["docker.io"] -# To pull Docker images from a mirror uncomment following -#[[registry]] -#prefix = "docker.io" -#location = "mirror.gcr.io" -EOF -sudo systemctl restart crio -sudo systemctl daemon-reload -sudo systemctl enable crio --now - -``` - On master: ``` diff --git a/ansible-kubernetes.yml b/ansible-kubernetes.yml new file mode 100644 index 0000000..39a6f15 --- /dev/null +++ b/ansible-kubernetes.yml @@ -0,0 +1,63 @@ +--- +- name: Pin kube components + hosts: kubernetes + tasks: + - name: Pin packages + loop: + - kubeadm + - kubectl + - kubelet + ansible.builtin.copy: + dest: "/etc/apt/preferences.d/{{ item }}" + content: | + Package: {{ item }} + Pin: version 1.26.* + Pin-Priority: 1001 + +- name: Reset /etc/containers/registries.conf + hosts: kubernetes + tasks: + - name: Copy /etc/containers/registries.conf + ansible.builtin.copy: + content: "unqualified-search-registries = [\"docker.io\"]\n" + dest: /etc/containers/registries.conf + register: registries + - name: Restart CRI-O + service: + name: cri-o + state: restarted + when: registries.changed + +- name: Reset /etc/modules + hosts: kubernetes + tasks: + - name: Copy /etc/modules + ansible.builtin.copy: + content: | + overlay + br_netfilter + dest: /etc/modules + register: kernel_modules + - name: Load kernel modules + ansible.builtin.shell: "cat /etc/modules | xargs -L 1 -t modprobe" + when: kernel_modules.changed + +- name: Reset /etc/sysctl.d/99-k8s.conf + hosts: kubernetes + tasks: + - name: Copy /etc/sysctl.d/99-k8s.conf + ansible.builtin.copy: + content: | + cat > /etc/sysctl.d/99-k8s.conf << EOF + net.ipv4.conf.all.accept_redirects = 0 + net.bridge.bridge-nf-call-iptables = 1 + net.ipv4.ip_forward = 1 + net.bridge.bridge-nf-call-ip6tables = 1 + vm.max_map_count = 524288 + fs.inotify.max_user_instances = 1280 + fs.inotify.max_user_watches = 655360 + dest: /etc/sysctl.d/99-k8s.conf + register: sysctl + - name: Reload sysctl config + ansible.builtin.shell: "sysctl --system" + when: sysctl.changed diff --git a/inventory.yml b/inventory.yml index ee93559..c5134b4 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,24 +1,32 @@ all: children: - masters: - hosts: - master1.kube.k-space.ee: - master2.kube.k-space.ee: - master3.kube.k-space.ee: - workers: - hosts: - mon1.kube.k-space.ee: - mon2.kube.k-space.ee: - mon3.kube.k-space.ee: - storage1.kube.k-space.ee: - storage2.kube.k-space.ee: - storage3.kube.k-space.ee: - storage4.kube.k-space.ee: - worker1.kube.k-space.ee: - worker2.kube.k-space.ee: - worker3.kube.k-space.ee: - worker4.kube.k-space.ee: - worker9.kube.k-space.ee: + kubernetes: + children: + masters: + hosts: + master1.kube.k-space.ee: + master2.kube.k-space.ee: + master3.kube.k-space.ee: + kubelets: + children: + mon: + hosts: + mon1.kube.k-space.ee: + mon2.kube.k-space.ee: + mon3.kube.k-space.ee: + storage: + hosts: + storage1.kube.k-space.ee: + storage2.kube.k-space.ee: + storage3.kube.k-space.ee: + storage4.kube.k-space.ee: + workers: + hosts: + worker1.kube.k-space.ee: + worker2.kube.k-space.ee: + worker3.kube.k-space.ee: + worker4.kube.k-space.ee: + worker9.kube.k-space.ee: doors: hosts: 100.102.3.1: From e02a10b192c41e5dd26ad53fbcd24b675898ba91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 14 Aug 2023 18:59:15 +0300 Subject: [PATCH 20/77] external-dns: Migrate k6.ee and kspace.ee --- external-dns/.gitignore | 1 + .../{application.yml => k-space.yaml} | 14 ++-- external-dns/k6.yaml | 72 +++++++++++++++++++ external-dns/kspace.yaml | 67 +++++++++++++++++ 4 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 external-dns/.gitignore rename external-dns/{application.yml => k-space.yaml} (87%) create mode 100644 external-dns/k6.yaml create mode 100644 external-dns/kspace.yaml diff --git a/external-dns/.gitignore b/external-dns/.gitignore new file mode 100644 index 0000000..c996e50 --- /dev/null +++ b/external-dns/.gitignore @@ -0,0 +1 @@ +*.key diff --git a/external-dns/application.yml b/external-dns/k-space.yaml similarity index 87% rename from external-dns/application.yml rename to external-dns/k-space.yaml index e29b1a2..423b87a 100644 --- a/external-dns/application.yml +++ b/external-dns/k-space.yaml @@ -62,26 +62,27 @@ subjects: apiVersion: apps/v1 kind: Deployment metadata: - name: external-dns + name: k-space namespace: external-dns spec: revisionHistoryLimit: 0 selector: - matchLabels: - app: external-dns + matchLabels: &selectorLabels + app.kubernetes.io/name: external-dns + domain: k-space.ee template: metadata: - labels: - app: external-dns + labels: *selectorLabels spec: serviceAccountName: external-dns containers: - name: external-dns - image: k8s.gcr.io/external-dns/external-dns:v0.13.1 + image: registry.k8s.io/external-dns/external-dns:v0.13.5 envFrom: - secretRef: name: tsig-secret args: + - --events - --registry=txt - --txt-prefix=external-dns- - --txt-owner-id=k8s @@ -90,6 +91,7 @@ spec: - --source=service - --source=crd - --domain-filter=k-space.ee + - --rfc2136-tsig-axfr - --rfc2136-host=193.40.103.2 - --rfc2136-port=53 - --rfc2136-zone=k-space.ee diff --git a/external-dns/k6.yaml b/external-dns/k6.yaml new file mode 100644 index 0000000..515cb86 --- /dev/null +++ b/external-dns/k6.yaml @@ -0,0 +1,72 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: k6 + namespace: external-dns +spec: + revisionHistoryLimit: 0 + selector: + matchLabels: &selectorLabels + app.kubernetes.io/name: external-dns + domain: k6.ee + template: + metadata: + labels: *selectorLabels + spec: + serviceAccountName: external-dns + containers: + - name: external-dns + image: registry.k8s.io/external-dns/external-dns:v0.13.5 + envFrom: + - secretRef: + name: tsig-secret + args: + - --log-level=debug + - --events + - --registry=noop + - --provider=rfc2136 + - --source=service + - --source=crd + - --domain-filter=k6.ee + - --rfc2136-tsig-axfr + - --rfc2136-host=193.40.103.2 + - --rfc2136-port=53 + - --rfc2136-zone=k6.ee + - --rfc2136-tsig-keyname=acme + - --rfc2136-tsig-secret-alg=hmac-sha512 + - --rfc2136-tsig-secret=$(TSIG_SECRET) + # https://github.com/kubernetes-sigs/external-dns/issues/2446 +--- +apiVersion: externaldns.k8s.io/v1alpha1 +kind: DNSEndpoint +metadata: + name: k6 +spec: + endpoints: + - dnsName: k6.ee + recordTTL: 300 + recordType: SOA + targets: + - "ns1.k-space.ee. hostmaster.k-space.ee. (1 300 300 300 300)" + - dnsName: k6.ee + recordTTL: 300 + recordType: NS + targets: + - ns1.k-space.ee + - ns2.k-space.ee + - dnsName: ns1.k-space.ee + recordTTL: 300 + recordType: A + targets: + - 193.40.103.2 + - dnsName: ns2.k-space.ee + recordTTL: 300 + recordType: A + targets: + - 62.65.250.2 + - dnsName: k-space.ee + recordTTL: 300 + recordType: MX + targets: + - 10 mail.k-space.ee diff --git a/external-dns/kspace.yaml b/external-dns/kspace.yaml new file mode 100644 index 0000000..35b3886 --- /dev/null +++ b/external-dns/kspace.yaml @@ -0,0 +1,67 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kspace + namespace: external-dns +spec: + revisionHistoryLimit: 0 + selector: + matchLabels: &selectorLabels + app.kubernetes.io/name: external-dns + domain: kspace.ee + template: + metadata: + labels: *selectorLabels + spec: + serviceAccountName: external-dns + containers: + - name: external-dns + image: registry.k8s.io/external-dns/external-dns:v0.13.5 + envFrom: + - secretRef: + name: tsig-secret + args: + - --events + - --registry=noop + - --provider=rfc2136 + - --source=ingress + - --source=service + - --source=crd + - --domain-filter=kspace.ee + - --rfc2136-tsig-axfr + - --rfc2136-host=193.40.103.2 + - --rfc2136-port=53 + - --rfc2136-zone=kspace.ee + - --rfc2136-tsig-keyname=acme + - --rfc2136-tsig-secret-alg=hmac-sha512 + - --rfc2136-tsig-secret=$(TSIG_SECRET) + # https://github.com/kubernetes-sigs/external-dns/issues/2446 +--- +apiVersion: externaldns.k8s.io/v1alpha1 +kind: DNSEndpoint +metadata: + name: kspace +spec: + endpoints: + - dnsName: kspace.ee + recordTTL: 300 + recordType: SOA + targets: + - "ns1.k-space.ee. hostmaster.k-space.ee. (1 300 300 300 300)" + - dnsName: kspace.ee + recordTTL: 300 + recordType: NS + targets: + - ns1.k-space.ee + - ns2.k-space.ee + - dnsName: ns1.k-space.ee + recordTTL: 300 + recordType: A + targets: + - 193.40.103.2 + - dnsName: ns2.k-space.ee + recordTTL: 300 + recordType: A + targets: + - 62.65.250.2 From ce7f5f51fb2a9d39374dda6f7bd6716b9520bfa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 14 Aug 2023 19:03:04 +0300 Subject: [PATCH 21/77] prometheus-operator: Fix alertmanager config --- prometheus-operator/application.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/prometheus-operator/application.yml b/prometheus-operator/application.yml index 7c2a535..27d1e5b 100644 --- a/prometheus-operator/application.yml +++ b/prometheus-operator/application.yml @@ -16,6 +16,7 @@ spec: value: critical receiver: 'null' receivers: + - name: 'null' - name: 'slack-notifications' slackConfigs: - channel: '#kube-prod' From f0c4be9b7dcc7c4f5b165a3c0b89dac60ef54962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 14 Aug 2023 22:25:56 +0300 Subject: [PATCH 22/77] prometheus-operator: Remove cone nodes --- prometheus-operator/node-exporter.yml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/prometheus-operator/node-exporter.yml b/prometheus-operator/node-exporter.yml index 409133b..f373058 100644 --- a/prometheus-operator/node-exporter.yml +++ b/prometheus-operator/node-exporter.yml @@ -26,28 +26,6 @@ spec: targetLabel: target --- apiVersion: monitoring.coreos.com/v1 -kind: Probe -metadata: - name: nodes-misc -spec: - targets: - staticConfig: - static: - - sprucecone.infra.k-space.ee:9100 - - cedarcone.infra.k-space.ee:9100 - relabelingConfigs: - - sourceLabels: [__param_target] - targetLabel: instance - - sourceLabels: [__param_target] - targetLabel: __address__ - prober: - url: localhost - path: /metrics - metricRelabelings: - - sourceLabels: [__address__] - targetLabel: target ---- -apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: node-exporter From ca4ded3d0de5a30348d496c133ac13813d4cf907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 14 Aug 2023 23:38:01 +0300 Subject: [PATCH 23/77] gitea: Cleanup config and rotate secrets --- gitea/application.yaml | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/gitea/application.yaml b/gitea/application.yaml index abb7c1b..9e6aa85 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -12,6 +12,26 @@ spec: name: default secretName: git-tls --- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: gitea-security-secret-key +spec: + size: 32 + mapping: + - key: secret + value: "%(plaintext)s" +--- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: gitea-security-internal-token +spec: + size: 32 + mapping: + - key: secret + value: "%(plaintext)s" +--- apiVersion: codemowers.io/v1alpha1 kind: OIDCGWClient metadata: @@ -55,8 +75,8 @@ spec: - name: gitea image: gitea/gitea:1.20.2 env: - - name: GITEA__OPENID__ENABLE_OPENID_SIGNIN - value: "false" + - name: GITEA__ADMIN__DISABLE_REGULAR_ORG_CREATION + value: "true" - name: GITEA__SERVER__SSH_SERVER_HOST_KEYS value: ssh/gitea.rsa,ssh/gitea.ecdsa,ssh/gitea.ed25519 - name: GITEA__SERVER__START_SSH_SERVER @@ -97,10 +117,6 @@ spec: value: "false" - name: GITEA__SECURITY__INSTALL_LOCK value: "true" - - name: GITEA__SECURITY__SECRET_KEY - value: t2RrFCn4Q22MFPc - - name: GITEA__SECURITY__LOGIN_REMEMBER_DAYS - value: "30" - name: GITEA__SERVICE__REGISTER_EMAIL_CONFIRM value: "true" - name: GITEA__SERVICE__DISABLE_REGISTRATION @@ -125,10 +141,6 @@ spec: value: "false" - name: GITEA__CRON__ENABLED value: "true" - - name: GITEA__I18N__LANGS - value: en-US - - name: GITEA__I18N__NAMES - value: English - name: GITEA__DATABASE__PASSWD valueFrom: secretKeyRef: @@ -147,8 +159,13 @@ spec: - name: GITEA__SECURITY__INTERNAL_TOKEN valueFrom: secretKeyRef: - name: gitea-secrets - key: GITEA__SECURITY__INTERNAL_TOKEN + name: gitea-security-internal-token + key: secret + - name: GITEA__SECURITY__SECRET_KEY + valueFrom: + secretKeyRef: + name: gitea-security-secret-key + key: secret ports: - containerPort: 8080 name: http @@ -199,4 +216,3 @@ spec: name: https targetPort: 3000 sessionAffinity: ClientIP - publishNotReadyAddresses: true From 46677df2a3fe33107dfa6439260bdbc85d13cd7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Aug 2023 08:08:46 +0300 Subject: [PATCH 24/77] gitea: Switch to rootless image --- gitea/application.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gitea/application.yaml b/gitea/application.yaml index 9e6aa85..144c5e5 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -71,9 +71,16 @@ spec: app.kubernetes.io/name: gitea spec: enableServiceLinks: false + securityContext: + fsGroup: 1000 + runAsUser: 1000 + runAsGroup: 1000 + runAsNonRoot: true containers: - name: gitea - image: gitea/gitea:1.20.2 + image: gitea/gitea:1.20.2-rootless + securityContext: + readOnlyRootFilesystem: true env: - name: GITEA__ADMIN__DISABLE_REGULAR_ORG_CREATION value: "true" @@ -85,8 +92,8 @@ spec: value: "/cert/tls.crt" - name: GITEA__SERVER__KEY_FILE value: "/cert/tls.key" - - name: GITEA__SERVER__SSH_LISTEN_PORT - value: "2222" + - name: GITEA__SERVER__SSH_PORT + value: "22" - name: GITEA__SERVER__PROTOCOL value: https - name: GITEA__SERVER__REDIRECT_OTHER_PORT @@ -174,11 +181,19 @@ spec: - containerPort: 2222 name: ssh volumeMounts: + - mountPath: /tmp + name: tmp + - mountPath: /etc/gitea + name: etc - mountPath: /cert name: cert - - mountPath: /data + - mountPath: /var/lib/gitea name: data volumes: + - name: tmp + emptyDir: {} + - name: etc + emptyDir: {} - name: cert secret: secretName: git-tls From 2e49b842a92408ef725db8b5d23c1af44bf8fd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Aug 2023 11:23:43 +0300 Subject: [PATCH 25/77] camtiler: Fix spammy mongo agent --- camtiler/mongodb.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camtiler/mongodb.yml b/camtiler/mongodb.yml index e56ee8d..48fb6e0 100644 --- a/camtiler/mongodb.yml +++ b/camtiler/mongodb.yml @@ -4,6 +4,9 @@ kind: MongoDBCommunity metadata: name: mongodb spec: + agent: + logLevel: ERROR + maxLogFileDurationHours: 1 additionalMongodConfig: systemLog: quiet: true From 4c5a58f67d465bdd05efa13a8008b04f4a7fe428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Aug 2023 13:54:49 +0300 Subject: [PATCH 26/77] logmower: Reduce mongo agent noise --- logmower/application.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/logmower/application.yml b/logmower/application.yml index 5a4f056..4d6f8f3 100644 --- a/logmower/application.yml +++ b/logmower/application.yml @@ -32,13 +32,16 @@ spec: size: 32 mapping: - key: password - value: "%(password)s" + value: "%(plaintext)s" --- apiVersion: mongodbcommunity.mongodb.com/v1 kind: MongoDBCommunity metadata: name: logmower-mongodb spec: + agent: + logLevel: ERROR + maxLogFileDurationHours: 1 additionalMongodConfig: systemLog: quiet: true From f9393fd0dac12a5e27eaf195d27cabcf376d9701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Aug 2023 21:58:23 +0300 Subject: [PATCH 27/77] Add Ansible task to configure graceful shutdown of Kubelet --- ansible-kubernetes.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ansible-kubernetes.yml b/ansible-kubernetes.yml index 39a6f15..e39d6ae 100644 --- a/ansible-kubernetes.yml +++ b/ansible-kubernetes.yml @@ -1,4 +1,18 @@ --- +- name: Reconfigure graceful shutdown for kubelet + hosts: kubernetes + tasks: + - name: Reconfigure shutdownGracePeriod + ansible.builtin.lineinfile: + path: /var/lib/kubelet/config.yaml + regexp: '^shutdownGracePeriod:' + line: 'shutdownGracePeriod: 5m' + - name: Reconfigure shutdownGracePeriodCriticalPods + ansible.builtin.lineinfile: + path: /var/lib/kubelet/config.yaml + regexp: '^shutdownGracePeriodCriticalPods:' + line: 'shutdownGracePeriodCriticalPods: 5m' + - name: Pin kube components hosts: kubernetes tasks: From 3dce3d07fdef3b05ba098aeac8c269f4fc655bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Aug 2023 22:41:54 +0300 Subject: [PATCH 28/77] Work around unattended-upgrades quirk https://github.com/kubernetes/kubernetes/issues/107043#issuecomment-997769940 --- ansible-kubernetes.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible-kubernetes.yml b/ansible-kubernetes.yml index e39d6ae..032efd3 100644 --- a/ansible-kubernetes.yml +++ b/ansible-kubernetes.yml @@ -12,6 +12,11 @@ path: /var/lib/kubelet/config.yaml regexp: '^shutdownGracePeriodCriticalPods:' line: 'shutdownGracePeriodCriticalPods: 5m' + - name: Work around unattended-upgrades + ansible.builtin.lineinfile: + path: /lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf + regexp: '^InhibitDelayMaxSec=' + line: 'InhibitDelayMaxSec=5m0s' - name: Pin kube components hosts: kubernetes From 508c03268ef507b37239e768692eea859bf51918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:10:21 +0300 Subject: [PATCH 29/77] woodpecker-agent: Drop privileges --- woodpecker/woodpecker-agent.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/woodpecker/woodpecker-agent.yml b/woodpecker/woodpecker-agent.yml index 94dbe47..d081884 100644 --- a/woodpecker/woodpecker-agent.yml +++ b/woodpecker/woodpecker-agent.yml @@ -68,11 +68,12 @@ spec: spec: serviceAccountName: woodpecker-agent securityContext: - {} + runAsNonRoot: true + runAsUser: 1000 containers: - name: agent securityContext: - {} + readOnlyRootFilesystem: false image: woodpeckerci/woodpecker-agent:next@sha256:703480d98991bb80ee86aa081a7a9db7d4346b9d5bdeaa3f92688d195cd36800 ports: - name: http From 5df71506cfce3e9ee2cb9f4b5d240fbe0ff4af4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:11:05 +0300 Subject: [PATCH 30/77] etherpad: Switch to Passmower --- etherpad/application.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etherpad/application.yml b/etherpad/application.yml index abb4678..98d10b3 100644 --- a/etherpad/application.yml +++ b/etherpad/application.yml @@ -1,4 +1,12 @@ --- +apiVersion: codemowers.io/v1alpha1 +kind: OIDCGWMiddlewareClient +metadata: + name: sso +spec: + displayName: Etherpad + uri: 'https://pad.k-space.ee/' +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -32,6 +40,8 @@ spec: ports: - containerPort: 9001 env: + - name: MINIFY + value: 'false' - name: DB_TYPE value: mysql - name: DB_HOST @@ -82,6 +92,7 @@ metadata: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee + traefik.ingress.kubernetes.io/router.middlewares: etherpad-sso@kubernetescrd spec: rules: - host: pad.k-space.ee From d419ac56e1f0e629524a7d458c1ce2361bbfedb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:29:09 +0300 Subject: [PATCH 31/77] Add CloudNativePG --- cnpg-system/README.md | 8 + cnpg-system/application.yml | 13215 ++++++++++++++++++++++++++++++++++ 2 files changed, 13223 insertions(+) create mode 100644 cnpg-system/README.md create mode 100644 cnpg-system/application.yml diff --git a/cnpg-system/README.md b/cnpg-system/README.md new file mode 100644 index 0000000..84bead4 --- /dev/null +++ b/cnpg-system/README.md @@ -0,0 +1,8 @@ +# CloudNativePG + +To deploy: + +``` +wget https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.20/releases/cnpg-1.20.2.yaml -O application.yml +kubectl apply -f application.yml +``` diff --git a/cnpg-system/application.yml b/cnpg-system/application.yml new file mode 100644 index 0000000..a4d74e9 --- /dev/null +++ b/cnpg-system/application.yml @@ -0,0 +1,13215 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app.kubernetes.io/name: cloudnative-pg + name: cnpg-system +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.1 + name: backups.postgresql.cnpg.io +spec: + group: postgresql.cnpg.io + names: + kind: Backup + listKind: BackupList + plural: backups + singular: backup + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.cluster.name + name: Cluster + type: string + - jsonPath: .status.phase + name: Phase + type: string + - jsonPath: .status.error + name: Error + type: string + name: v1 + schema: + openAPIV3Schema: + description: Backup is the Schema for the backups API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: 'Specification of the desired behavior of the backup. More + info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + cluster: + description: The cluster to backup + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + target: + description: The policy to decide which instance should perform this + backup. If empty, it defaults to `cluster.spec.backup.target`. Available + options are empty string, `primary` and `prefer-standby`. `primary` + to have backups run always on primary instances, `prefer-standby` + to have backups run preferably on the most updated standby, if available. + enum: + - primary + - prefer-standby + type: string + type: object + status: + description: 'Most recently observed status of the backup. This data may + not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + azureCredentials: + description: The credentials to use to upload data to Azure Blob Storage + properties: + connectionString: + description: The connection string to be used + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromAzureAD: + description: Use the Azure AD based authentication without providing + explicitly the keys. + type: boolean + storageAccount: + description: The storage account where to upload data + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageKey: + description: The storage account key to be used in conjunction + with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageSasToken: + description: A shared-access-signature to be used in conjunction + with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + backupId: + description: The ID of the Barman backup + type: string + backupName: + description: The Name of the Barman backup + type: string + beginLSN: + description: The starting xlog + type: string + beginWal: + description: The starting WAL + type: string + commandError: + description: The backup command output in case of error + type: string + commandOutput: + description: Unused. Retained for compatibility with old versions. + type: string + destinationPath: + description: The path where to store the backup (i.e. s3://bucket/path/to/folder) + this path, with different destination folders, will be used for + WALs and for data. This may not be populated in case of errors. + type: string + encryption: + description: Encryption method required to S3 API + type: string + endLSN: + description: The ending xlog + type: string + endWal: + description: The ending WAL + type: string + endpointCA: + description: EndpointCA store the CA bundle of the barman endpoint. + Useful when using self-signed certificates to avoid errors with + certificate issuer and barman-cloud-wal-archive. + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + endpointURL: + description: Endpoint to be used to upload data to the cloud, overriding + the automatic endpoint discovery + type: string + error: + description: The detected error + type: string + googleCredentials: + description: The credentials to use to upload data to Google Cloud + Storage + properties: + applicationCredentials: + description: The secret containing the Google Cloud Storage JSON + file with the credentials + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + gkeEnvironment: + description: If set to true, will presume that it's running inside + a GKE environment, default to false. + type: boolean + type: object + instanceID: + description: Information to identify the instance where the backup + has been taken from + properties: + ContainerID: + description: The container ID + type: string + podName: + description: The pod name + type: string + type: object + phase: + description: The last backup status + type: string + s3Credentials: + description: The credentials to use to upload data to S3 + properties: + accessKeyId: + description: The reference to the access key id + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromIAMRole: + description: Use the role based authentication without providing + explicitly the keys. + type: boolean + region: + description: The reference to the secret containing the region + name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + secretAccessKey: + description: The reference to the secret access key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + sessionToken: + description: The references to the session key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + serverName: + description: The server name on S3, the cluster name is used if this + parameter is omitted + type: string + startedAt: + description: When the backup was started + format: date-time + type: string + stoppedAt: + description: When the backup was terminated + format: date-time + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.1 + name: clusters.postgresql.cnpg.io +spec: + group: postgresql.cnpg.io + names: + kind: Cluster + listKind: ClusterList + plural: clusters + singular: cluster + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Number of instances + jsonPath: .status.instances + name: Instances + type: integer + - description: Number of ready instances + jsonPath: .status.readyInstances + name: Ready + type: integer + - description: Cluster current status + jsonPath: .status.phase + name: Status + type: string + - description: Primary pod + jsonPath: .status.currentPrimary + name: Primary + type: string + name: v1 + schema: + openAPIV3Schema: + description: Cluster is the Schema for the PostgreSQL API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: 'Specification of the desired behavior of the cluster. More + info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + affinity: + description: Affinity/Anti-affinity rules for Pods + properties: + additionalPodAffinity: + description: AdditionalPodAffinity allows to specify pod affinity + terms to be passed to all the cluster's pods. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to + nodes that satisfy the affinity expressions specified by + this field, but it may choose a node that violates one or + more of the expressions. The node that is most preferred + is the one with the greatest sum of weights, i.e. for each + node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements of + this field and adding "weight" to the sum if the node has + pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: A label selector requirement + is a selector that contains values, a key, + and an operator that relates the key and + values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: operator represents a key's + relationship to a set of values. Valid + operators are In, NotIn, Exists and + DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. This + array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is + "In", and the values array contains only "value". + The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by this + field and the ones listed in the namespaces field. + null selector and null or empty namespaces list + means "this pod's namespace". An empty selector + ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: A label selector requirement + is a selector that contains values, a key, + and an operator that relates the key and + values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: operator represents a key's + relationship to a set of values. Valid + operators are In, NotIn, Exists and + DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. This + array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is + "In", and the values array contains only "value". + The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. The + term is applied to the union of the namespaces + listed in this field and the ones selected by + namespaceSelector. null or empty namespaces list + and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the pods + matching the labelSelector in the specified namespaces, + where co-located is defined as running on a node + whose value of the label with key topologyKey + matches that of any node on which any of the selected + pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching the corresponding + podAffinityTerm, in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this + field are not met at scheduling time, the pod will not be + scheduled onto the node. If the affinity requirements specified + by this field cease to be met at some point during pod execution + (e.g. due to a pod label update), the system may or may + not try to eventually evict the pod from its node. When + there are multiple elements, the lists of nodes corresponding + to each podAffinityTerm are intersected, i.e. all terms + must be satisfied. + items: + description: Defines a set of pods (namely those matching + the labelSelector relative to the given namespace(s)) + that this pod should be co-located (affinity) or not co-located + (anti-affinity) with, where co-located is defined as running + on a node whose value of the label with key + matches that of any node on which a pod of the set of + pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied to the + union of the namespaces selected by this field and + the ones listed in the namespaces field. null selector + and null or empty namespaces list means "this pod's + namespace". An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list of namespace + names that the term applies to. The term is applied + to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. null or + empty namespaces list and null namespaceSelector means + "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where + co-located is defined as running on a node whose value + of the label with key topologyKey matches that of + any node on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + additionalPodAntiAffinity: + description: AdditionalPodAntiAffinity allows to specify pod anti-affinity + terms to be added to the ones generated by the operator if EnablePodAntiAffinity + is set to true (default) or to be used exclusively if set to + false. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to + nodes that satisfy the anti-affinity expressions specified + by this field, but it may choose a node that violates one + or more of the expressions. The node that is most preferred + is the one with the greatest sum of weights, i.e. for each + node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, + etc.), compute a sum by iterating through the elements of + this field and adding "weight" to the sum if the node has + pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: A label selector requirement + is a selector that contains values, a key, + and an operator that relates the key and + values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: operator represents a key's + relationship to a set of values. Valid + operators are In, NotIn, Exists and + DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. This + array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is + "In", and the values array contains only "value". + The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by this + field and the ones listed in the namespaces field. + null selector and null or empty namespaces list + means "this pod's namespace". An empty selector + ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: A label selector requirement + is a selector that contains values, a key, + and an operator that relates the key and + values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: operator represents a key's + relationship to a set of values. Valid + operators are In, NotIn, Exists and + DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. This + array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is + "In", and the values array contains only "value". + The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. The + term is applied to the union of the namespaces + listed in this field and the ones selected by + namespaceSelector. null or empty namespaces list + and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the pods + matching the labelSelector in the specified namespaces, + where co-located is defined as running on a node + whose value of the label with key topologyKey + matches that of any node on which any of the selected + pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching the corresponding + podAffinityTerm, in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the anti-affinity requirements specified by + this field are not met at scheduling time, the pod will + not be scheduled onto the node. If the anti-affinity requirements + specified by this field cease to be met at some point during + pod execution (e.g. due to a pod label update), the system + may or may not try to eventually evict the pod from its + node. When there are multiple elements, the lists of nodes + corresponding to each podAffinityTerm are intersected, i.e. + all terms must be satisfied. + items: + description: Defines a set of pods (namely those matching + the labelSelector relative to the given namespace(s)) + that this pod should be co-located (affinity) or not co-located + (anti-affinity) with, where co-located is defined as running + on a node whose value of the label with key + matches that of any node on which a pod of the set of + pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied to the + union of the namespaces selected by this field and + the ones listed in the namespaces field. null selector + and null or empty namespaces list means "this pod's + namespace". An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list of namespace + names that the term applies to. The term is applied + to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. null or + empty namespaces list and null namespaceSelector means + "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where + co-located is defined as running on a node whose value + of the label with key topologyKey matches that of + any node on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + enablePodAntiAffinity: + description: Activates anti-affinity for the pods. The operator + will define pods anti-affinity unless this field is explicitly + set to false + type: boolean + nodeAffinity: + description: 'NodeAffinity describes node affinity scheduling + rules for the pod. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity' + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to + nodes that satisfy the affinity expressions specified by + this field, but it may choose a node that violates one or + more of the expressions. The node that is most preferred + is the one with the greatest sum of weights, i.e. for each + node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements of + this field and adding "weight" to the sum if the node matches + the corresponding matchExpressions; the node(s) with the + highest sum are the most preferred. + items: + description: An empty preferred scheduling term matches + all objects with implicit weight 0 (i.e. it's a no-op). + A null preferred scheduling term matches no objects (i.e. + is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this + field are not met at scheduling time, the pod will not be + scheduled onto the node. If the affinity requirements specified + by this field cease to be met at some point during pod execution + (e.g. due to an update), the system may or may not try to + eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: A null or empty node selector term matches + no objects. The requirements of them are ANDed. The + TopologySelectorTerm type implements a subset of the + NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + nodeSelector: + additionalProperties: + type: string + description: 'NodeSelector is map of key-value pairs used to define + the nodes on which the pods can run. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + type: object + podAntiAffinityType: + description: 'PodAntiAffinityType allows the user to decide whether + pod anti-affinity between cluster instance has to be considered + a strong requirement during scheduling or not. Allowed values + are: "preferred" (default if empty) or "required". Setting it + to "required", could lead to instances remaining pending until + new kubernetes nodes are added if all the existing nodes don''t + match the required pod anti-affinity rule. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity' + type: string + tolerations: + description: 'Tolerations is a list of Tolerations that should + be set for all the pods, in order to allow them to run on tainted + nodes. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/' + items: + description: The pod this Toleration is attached to tolerates + any taint that matches the triple using + the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. + Empty means match all taint effects. When specified, allowed + values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Key is the taint key that the toleration applies + to. Empty means match all taint keys. If the key is empty, + operator must be Exists; this combination means to match + all values and all keys. + type: string + operator: + description: Operator represents a key's relationship to + the value. Valid operators are Exists and Equal. Defaults + to Equal. Exists is equivalent to wildcard for value, + so that a pod can tolerate all taints of a particular + category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period of + time the toleration (which must be of effect NoExecute, + otherwise this field is ignored) tolerates the taint. + By default, it is not set, which means tolerate the taint + forever (do not evict). Zero and negative values will + be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration matches + to. If the operator is Exists, the value should be empty, + otherwise just a regular string. + type: string + type: object + type: array + topologyKey: + description: TopologyKey to use for anti-affinity configuration. + See k8s documentation for more info on that + type: string + type: object + backup: + description: The configuration to be used for backups + properties: + barmanObjectStore: + description: The configuration for the barman-cloud tool suite + properties: + azureCredentials: + description: The credentials to use to upload data to Azure + Blob Storage + properties: + connectionString: + description: The connection string to be used + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromAzureAD: + description: Use the Azure AD based authentication without + providing explicitly the keys. + type: boolean + storageAccount: + description: The storage account where to upload data + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageKey: + description: The storage account key to be used in conjunction + with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageSasToken: + description: A shared-access-signature to be used in conjunction + with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + data: + description: The configuration to be used to backup the data + files When not defined, base backups files will be stored + uncompressed and may be unencrypted in the object store, + according to the bucket default policy. + properties: + compression: + description: Compress a backup file (a tar file per tablespace) + while streaming it to the object store. Available options + are empty string (no compression, default), `gzip`, + `bzip2` or `snappy`. + enum: + - gzip + - bzip2 + - snappy + type: string + encryption: + description: Whenever to force the encryption of files + (if the bucket is not already configured for that). + Allowed options are empty string (use the bucket policy, + default), `AES256` and `aws:kms` + enum: + - AES256 + - aws:kms + type: string + immediateCheckpoint: + description: Control whether the I/O workload for the + backup initial checkpoint will be limited, according + to the `checkpoint_completion_target` setting on the + PostgreSQL server. If set to true, an immediate checkpoint + will be used, meaning PostgreSQL will complete the checkpoint + as soon as possible. `false` by default. + type: boolean + jobs: + description: The number of parallel jobs to be used to + upload the backup, defaults to 2 + format: int32 + minimum: 1 + type: integer + type: object + destinationPath: + description: The path where to store the backup (i.e. s3://bucket/path/to/folder) + this path, with different destination folders, will be used + for WALs and for data + minLength: 1 + type: string + endpointCA: + description: EndpointCA store the CA bundle of the barman + endpoint. Useful when using self-signed certificates to + avoid errors with certificate issuer and barman-cloud-wal-archive + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + endpointURL: + description: Endpoint to be used to upload data to the cloud, + overriding the automatic endpoint discovery + type: string + googleCredentials: + description: The credentials to use to upload data to Google + Cloud Storage + properties: + applicationCredentials: + description: The secret containing the Google Cloud Storage + JSON file with the credentials + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + gkeEnvironment: + description: If set to true, will presume that it's running + inside a GKE environment, default to false. + type: boolean + type: object + historyTags: + additionalProperties: + type: string + description: HistoryTags is a list of key value pairs that + will be passed to the Barman --history-tags option. + type: object + s3Credentials: + description: The credentials to use to upload data to S3 + properties: + accessKeyId: + description: The reference to the access key id + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromIAMRole: + description: Use the role based authentication without + providing explicitly the keys. + type: boolean + region: + description: The reference to the secret containing the + region name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + secretAccessKey: + description: The reference to the secret access key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + sessionToken: + description: The references to the session key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + serverName: + description: The server name on S3, the cluster name is used + if this parameter is omitted + type: string + tags: + additionalProperties: + type: string + description: Tags is a list of key value pairs that will be + passed to the Barman --tags option. + type: object + wal: + description: The configuration for the backup of the WAL stream. + When not defined, WAL files will be stored uncompressed + and may be unencrypted in the object store, according to + the bucket default policy. + properties: + compression: + description: Compress a WAL file before sending it to + the object store. Available options are empty string + (no compression, default), `gzip`, `bzip2` or `snappy`. + enum: + - gzip + - bzip2 + - snappy + type: string + encryption: + description: Whenever to force the encryption of files + (if the bucket is not already configured for that). + Allowed options are empty string (use the bucket policy, + default), `AES256` and `aws:kms` + enum: + - AES256 + - aws:kms + type: string + maxParallel: + description: Number of WAL files to be either archived + in parallel (when the PostgreSQL instance is archiving + to a backup object store) or restored in parallel (when + a PostgreSQL standby is fetching WAL files from a recovery + object store). If not specified, WAL files will be processed + one at a time. It accepts a positive integer as a value + - with 1 being the minimum accepted value. + minimum: 1 + type: integer + type: object + required: + - destinationPath + type: object + retentionPolicy: + description: RetentionPolicy is the retention policy to be used + for backups and WALs (i.e. '60d'). The retention policy is expressed + in the form of `XXu` where `XX` is a positive integer and `u` + is in `[dwm]` - days, weeks, months. + pattern: ^[1-9][0-9]*[dwm]$ + type: string + target: + default: prefer-standby + description: The policy to decide which instance should perform + backups. Available options are empty string, which will default + to `prefer-standby` policy, `primary` to have backups run always + on primary instances, `prefer-standby` to have backups run preferably + on the most updated standby, if available. + enum: + - primary + - prefer-standby + type: string + type: object + bootstrap: + description: Instructions to bootstrap this cluster + properties: + initdb: + description: Bootstrap the cluster via initdb + properties: + dataChecksums: + description: 'Whether the `-k` option should be passed to + initdb, enabling checksums on data pages (default: `false`)' + type: boolean + database: + description: 'Name of the database used by the application. + Default: `app`.' + type: string + encoding: + description: The value to be passed as option `--encoding` + for initdb (default:`UTF8`) + type: string + import: + description: Bootstraps the new cluster by importing data + from an existing PostgreSQL instance using logical backup + (`pg_dump` and `pg_restore`) + properties: + databases: + description: The databases to import + items: + type: string + type: array + postImportApplicationSQL: + description: List of SQL queries to be executed as a superuser + in the application database right after is imported + - to be used with extreme care (by default empty). Only + available in microservice type. + items: + type: string + type: array + roles: + description: The roles to import + items: + type: string + type: array + schemaOnly: + default: false + description: 'When set to true, only the `pre-data` and + `post-data` sections of `pg_restore` are invoked, avoiding + data import. Default: `false`.' + type: boolean + source: + description: The source of the import + properties: + externalCluster: + description: The name of the externalCluster used + for import + type: string + required: + - externalCluster + type: object + type: + description: The import type. Can be `microservice` or + `monolith`. + enum: + - microservice + - monolith + type: string + required: + - databases + - source + - type + type: object + localeCType: + description: The value to be passed as option `--lc-ctype` + for initdb (default:`C`) + type: string + localeCollate: + description: The value to be passed as option `--lc-collate` + for initdb (default:`C`) + type: string + options: + description: 'The list of options that must be passed to initdb + when creating the cluster. Deprecated: This could lead to + inconsistent configurations, please use the explicit provided + parameters instead. If defined, explicit values will be + ignored.' + items: + type: string + type: array + owner: + description: Name of the owner of the database in the instance + to be used by applications. Defaults to the value of the + `database` key. + type: string + postInitApplicationSQL: + description: List of SQL queries to be executed as a superuser + in the application database right after is created - to + be used with extreme care (by default empty) + items: + type: string + type: array + postInitApplicationSQLRefs: + description: PostInitApplicationSQLRefs points references + to ConfigMaps or Secrets which contain SQL files, the general + implementation order to these references is from all Secrets + to all ConfigMaps, and inside Secrets or ConfigMaps, the + implementation order is same as the order of each array + (by default empty) + properties: + configMapRefs: + description: ConfigMapRefs holds a list of references + to ConfigMaps + items: + description: ConfigMapKeySelector contains enough information + to let you locate the key of a ConfigMap + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: array + secretRefs: + description: SecretRefs holds a list of references to + Secrets + items: + description: SecretKeySelector contains enough information + to let you locate the key of a Secret + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: array + type: object + postInitSQL: + description: List of SQL queries to be executed as a superuser + immediately after the cluster has been created - to be used + with extreme care (by default empty) + items: + type: string + type: array + postInitTemplateSQL: + description: List of SQL queries to be executed as a superuser + in the `template1` after the cluster has been created - + to be used with extreme care (by default empty) + items: + type: string + type: array + secret: + description: Name of the secret containing the initial credentials + for the owner of the user database. If empty a new secret + will be created from scratch + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + walSegmentSize: + description: 'The value in megabytes (1 to 1024) to be passed + to the `--wal-segsize` option for initdb (default: empty, + resulting in PostgreSQL default: 16MB)' + maximum: 1024 + minimum: 1 + type: integer + type: object + pg_basebackup: + description: Bootstrap the cluster taking a physical backup of + another compatible PostgreSQL instance + properties: + database: + description: 'Name of the database used by the application. + Default: `app`.' + type: string + owner: + description: Name of the owner of the database in the instance + to be used by applications. Defaults to the value of the + `database` key. + type: string + secret: + description: Name of the secret containing the initial credentials + for the owner of the user database. If empty a new secret + will be created from scratch + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + source: + description: The name of the server of which we need to take + a physical backup + minLength: 1 + type: string + required: + - source + type: object + recovery: + description: Bootstrap the cluster from a backup + properties: + backup: + description: The backup object containing the physical base + backup from which to initiate the recovery procedure. Mutually + exclusive with `source` and `volumeSnapshots`. + properties: + endpointCA: + description: EndpointCA store the CA bundle of the barman + endpoint. Useful when using self-signed certificates + to avoid errors with certificate issuer and barman-cloud-wal-archive. + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + name: + description: Name of the referent. + type: string + required: + - name + type: object + database: + description: 'Name of the database used by the application. + Default: `app`.' + type: string + owner: + description: Name of the owner of the database in the instance + to be used by applications. Defaults to the value of the + `database` key. + type: string + recoveryTarget: + description: 'By default, the recovery process applies all + the available WAL files in the archive (full recovery). + However, you can also end the recovery as soon as a consistent + state is reached or recover to a point-in-time (PITR) by + specifying a `RecoveryTarget` object, as expected by PostgreSQL + (i.e., timestamp, transaction Id, LSN, ...). More info: + https://www.postgresql.org/docs/current/runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET' + properties: + backupID: + description: The ID of the backup from which to start + the recovery process. If empty (default) the operator + will automatically detect the backup based on targetTime + or targetLSN if specified. Otherwise use the latest + available backup in chronological order. + type: string + exclusive: + description: Set the target to be exclusive. If omitted, + defaults to false, so that in Postgres, `recovery_target_inclusive` + will be true + type: boolean + targetImmediate: + description: End recovery as soon as a consistent state + is reached + type: boolean + targetLSN: + description: The target LSN (Log Sequence Number) + type: string + targetName: + description: The target name (to be previously created + with `pg_create_restore_point`) + type: string + targetTLI: + description: The target timeline ("latest" or a positive + integer) + type: string + targetTime: + description: The target time as a timestamp in the RFC3339 + standard + type: string + targetXID: + description: The target transaction ID + type: string + type: object + secret: + description: Name of the secret containing the initial credentials + for the owner of the user database. If empty a new secret + will be created from scratch + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + source: + description: The external cluster whose backup we will restore. + This is also used as the name of the folder under which + the backup is stored, so it must be set to the name of the + source cluster Mutually exclusive with `backup` and `volumeSnapshots`. + type: string + volumeSnapshots: + description: The static PVC data source(s) from which to initiate + the recovery procedure. Currently supporting `VolumeSnapshot` + and `PersistentVolumeClaim` resources that map an existing + PVC group, compatible with CloudNativePG, and taken with + a cold backup copy on a fenced Postgres instance (limitation + which will be removed in the future when online backup will + be implemented). Mutually exclusive with `backup` and `source`. + properties: + storage: + description: Configuration of the storage of the instances + properties: + apiGroup: + description: APIGroup is the group for the resource + being referenced. If APIGroup is not specified, + the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + walStorage: + description: Configuration of the storage for PostgreSQL + WAL (Write-Ahead Log) + properties: + apiGroup: + description: APIGroup is the group for the resource + being referenced. If APIGroup is not specified, + the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + required: + - storage + type: object + type: object + type: object + certificates: + description: The configuration for the CA and related certificates + properties: + clientCASecret: + description: 'The secret containing the Client CA certificate. + If not defined, a new secret will be created with a self-signed + CA and will be used to generate all the client certificates.

Contains:

- `ca.crt`: CA that should + be used to validate the client certificates, used as `ssl_ca_file` + of all the instances.
- `ca.key`: key used to generate + client certificates, if ReplicationTLSSecret is provided, this + can be omitted.
' + type: string + replicationTLSSecret: + description: The secret of type kubernetes.io/tls containing the + client certificate to authenticate as the `streaming_replica` + user. If not defined, ClientCASecret must provide also `ca.key`, + and a new secret will be created using the provided CA. + type: string + serverAltDNSNames: + description: The list of the server alternative DNS names to be + added to the generated server TLS certificates, when required. + items: + type: string + type: array + serverCASecret: + description: 'The secret containing the Server CA certificate. + If not defined, a new secret will be created with a self-signed + CA and will be used to generate the TLS certificate ServerTLSSecret.

Contains:

- `ca.crt`: CA that should + be used to validate the server certificate, used as `sslrootcert` + in client connection strings.
- `ca.key`: key used to + generate Server SSL certs, if ServerTLSSecret is provided, this + can be omitted.
' + type: string + serverTLSSecret: + description: The secret of type kubernetes.io/tls containing the + server TLS certificate and key that will be set as `ssl_cert_file` + and `ssl_key_file` so that clients can connect to postgres securely. + If not defined, ServerCASecret must provide also `ca.key` and + a new secret will be created using the provided CA. + type: string + type: object + description: + description: Description of this PostgreSQL cluster + type: string + enableSuperuserAccess: + default: true + description: When this option is enabled, the operator will use the + `SuperuserSecret` to update the `postgres` user password (if the + secret is not present, the operator will automatically create one). + When this option is disabled, the operator will ignore the `SuperuserSecret` + content, delete it when automatically created, and then blank the + password of the `postgres` user by setting it to `NULL`. Enabled + by default. + type: boolean + env: + description: Env follows the Env format to pass environment variables + to the pods created in the cluster + items: + description: EnvVar represents an environment variable present in + a Container. + properties: + name: + description: Name of the environment variable. Must be a C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded using + the previously defined environment variables in the container + and any service environment variables. If a variable cannot + be resolved, the reference in the input string will be unchanged. + Double $$ are reduced to a single $, which allows for escaping + the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the + string literal "$(VAR_NAME)". Escaped references will never + be expanded, regardless of whether the variable exists or + not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. Cannot + be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, `metadata.annotations['''']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, + status.podIP, status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath is + written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified + API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed + resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: EnvFrom follows the EnvFrom format to pass environment + variables sources to the pods to be used by Env + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + externalClusters: + description: The list of external clusters which are used in the configuration + items: + description: ExternalCluster represents the connection parameters + to an external cluster which is used in the other sections of + the configuration + properties: + barmanObjectStore: + description: The configuration for the barman-cloud tool suite + properties: + azureCredentials: + description: The credentials to use to upload data to Azure + Blob Storage + properties: + connectionString: + description: The connection string to be used + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromAzureAD: + description: Use the Azure AD based authentication without + providing explicitly the keys. + type: boolean + storageAccount: + description: The storage account where to upload data + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageKey: + description: The storage account key to be used in conjunction + with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + storageSasToken: + description: A shared-access-signature to be used in + conjunction with the storage account name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + data: + description: The configuration to be used to backup the + data files When not defined, base backups files will be + stored uncompressed and may be unencrypted in the object + store, according to the bucket default policy. + properties: + compression: + description: Compress a backup file (a tar file per + tablespace) while streaming it to the object store. + Available options are empty string (no compression, + default), `gzip`, `bzip2` or `snappy`. + enum: + - gzip + - bzip2 + - snappy + type: string + encryption: + description: Whenever to force the encryption of files + (if the bucket is not already configured for that). + Allowed options are empty string (use the bucket policy, + default), `AES256` and `aws:kms` + enum: + - AES256 + - aws:kms + type: string + immediateCheckpoint: + description: Control whether the I/O workload for the + backup initial checkpoint will be limited, according + to the `checkpoint_completion_target` setting on the + PostgreSQL server. If set to true, an immediate checkpoint + will be used, meaning PostgreSQL will complete the + checkpoint as soon as possible. `false` by default. + type: boolean + jobs: + description: The number of parallel jobs to be used + to upload the backup, defaults to 2 + format: int32 + minimum: 1 + type: integer + type: object + destinationPath: + description: The path where to store the backup (i.e. s3://bucket/path/to/folder) + this path, with different destination folders, will be + used for WALs and for data + minLength: 1 + type: string + endpointCA: + description: EndpointCA store the CA bundle of the barman + endpoint. Useful when using self-signed certificates to + avoid errors with certificate issuer and barman-cloud-wal-archive + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + endpointURL: + description: Endpoint to be used to upload data to the cloud, + overriding the automatic endpoint discovery + type: string + googleCredentials: + description: The credentials to use to upload data to Google + Cloud Storage + properties: + applicationCredentials: + description: The secret containing the Google Cloud + Storage JSON file with the credentials + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + gkeEnvironment: + description: If set to true, will presume that it's + running inside a GKE environment, default to false. + type: boolean + type: object + historyTags: + additionalProperties: + type: string + description: HistoryTags is a list of key value pairs that + will be passed to the Barman --history-tags option. + type: object + s3Credentials: + description: The credentials to use to upload data to S3 + properties: + accessKeyId: + description: The reference to the access key id + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + inheritFromIAMRole: + description: Use the role based authentication without + providing explicitly the keys. + type: boolean + region: + description: The reference to the secret containing + the region name + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + secretAccessKey: + description: The reference to the secret access key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + sessionToken: + description: The references to the session key + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: object + serverName: + description: The server name on S3, the cluster name is + used if this parameter is omitted + type: string + tags: + additionalProperties: + type: string + description: Tags is a list of key value pairs that will + be passed to the Barman --tags option. + type: object + wal: + description: The configuration for the backup of the WAL + stream. When not defined, WAL files will be stored uncompressed + and may be unencrypted in the object store, according + to the bucket default policy. + properties: + compression: + description: Compress a WAL file before sending it to + the object store. Available options are empty string + (no compression, default), `gzip`, `bzip2` or `snappy`. + enum: + - gzip + - bzip2 + - snappy + type: string + encryption: + description: Whenever to force the encryption of files + (if the bucket is not already configured for that). + Allowed options are empty string (use the bucket policy, + default), `AES256` and `aws:kms` + enum: + - AES256 + - aws:kms + type: string + maxParallel: + description: Number of WAL files to be either archived + in parallel (when the PostgreSQL instance is archiving + to a backup object store) or restored in parallel + (when a PostgreSQL standby is fetching WAL files from + a recovery object store). If not specified, WAL files + will be processed one at a time. It accepts a positive + integer as a value - with 1 being the minimum accepted + value. + minimum: 1 + type: integer + type: object + required: + - destinationPath + type: object + connectionParameters: + additionalProperties: + type: string + description: The list of connection parameters, such as dbname, + host, username, etc + type: object + name: + description: The server name, required + type: string + password: + description: The reference to the password to be used to connect + to the server + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + sslCert: + description: The reference to an SSL certificate to be used + to connect to this instance + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + sslKey: + description: The reference to an SSL private key to be used + to connect to this instance + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + sslRootCert: + description: The reference to an SSL CA public key to be used + to connect to this instance + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - name + type: object + type: array + failoverDelay: + default: 0 + description: The amount of time (in seconds) to wait before triggering + a failover after the primary PostgreSQL instance in the cluster + was detected to be unhealthy + format: int32 + type: integer + imageName: + description: Name of the container image, supporting both tags (`:`) + and digests for deterministic and repeatable deployments (`:@sha256:`) + type: string + imagePullPolicy: + description: 'Image pull policy. One of `Always`, `Never` or `IfNotPresent`. + If not defined, it defaults to `IfNotPresent`. Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + imagePullSecrets: + description: The list of pull secrets to be used to pull the images + items: + description: LocalObjectReference contains enough information to + let you locate a local object with a known type inside the same + namespace + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + type: array + inheritedMetadata: + description: Metadata that will be inherited by all objects related + to the Cluster + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + instances: + default: 1 + description: Number of instances required in the cluster + minimum: 1 + type: integer + logLevel: + default: info + description: 'The instances'' log level, one of the following values: + error, warning, info (default), debug, trace' + enum: + - error + - warning + - info + - debug + - trace + type: string + managed: + description: The configuration that is used by the portions of PostgreSQL + that are managed by the instance manager + properties: + roles: + description: Database roles managed by the `Cluster` + items: + description: "RoleConfiguration is the representation, in Kubernetes, + of a PostgreSQL role with the additional field Ensure specifying + whether to ensure the presence or absence of the role in the + database \n The defaults of the CREATE ROLE command are applied + Reference: https://www.postgresql.org/docs/current/sql-createrole.html" + properties: + bypassrls: + description: Whether a role bypasses every row-level security + (RLS) policy. Default is `false`. + type: boolean + comment: + description: Description of the role + type: string + connectionLimit: + default: -1 + description: If the role can log in, this specifies how + many concurrent connections the role can make. `-1` (the + default) means no limit. + format: int64 + type: integer + createdb: + description: When set to `true`, the role being defined + will be allowed to create new databases. Specifying `false` + (default) will deny a role the ability to create databases. + type: boolean + createrole: + description: Whether the role will be permitted to create, + alter, drop, comment on, change the security label for, + and grant or revoke membership in other roles. Default + is `false`. + type: boolean + disablePassword: + description: DisablePassword indicates that a role's password + should be set to NULL in Postgres + type: boolean + ensure: + default: present + description: Ensure the role is `present` or `absent` - + defaults to "present" + enum: + - present + - absent + type: string + inRoles: + description: List of one or more existing roles to which + this role will be immediately added as a new member. Default + empty. + items: + type: string + type: array + inherit: + default: true + description: Whether a role "inherits" the privileges of + roles it is a member of. Defaults is `true`. + type: boolean + login: + description: Whether the role is allowed to log in. A role + having the `login` attribute can be thought of as a user. + Roles without this attribute are useful for managing database + privileges, but are not users in the usual sense of the + word. Default is `false`. + type: boolean + name: + description: Name of the role + type: string + passwordSecret: + description: Secret containing the password of the role + (if present) If null, the password will be ignored unless + DisablePassword is set + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + replication: + description: Whether a role is a replication role. A role + must have this attribute (or be a superuser) in order + to be able to connect to the server in replication mode + (physical or logical replication) and in order to be able + to create or drop replication slots. A role having the + `replication` attribute is a very highly privileged role, + and should only be used on roles actually used for replication. + Default is `false`. + type: boolean + superuser: + description: Whether the role is a `superuser` who can override + all access restrictions within the database - superuser + status is dangerous and should be used only when really + needed. You must yourself be a superuser to create a new + superuser. Defaults is `false`. + type: boolean + validUntil: + description: Date and time after which the role's password + is no longer valid. When omitted, the password will never + expire (default). + format: date-time + type: string + required: + - name + type: object + type: array + type: object + maxSyncReplicas: + default: 0 + description: The target value for the synchronous replication quorum, + that can be decreased if the number of ready standbys is lower than + this. Undefined or 0 disable synchronous replication. + minimum: 0 + type: integer + minSyncReplicas: + default: 0 + description: Minimum number of instances required in synchronous replication + with the primary. Undefined or 0 allow writes to complete when no + standby is available. + minimum: 0 + type: integer + monitoring: + description: The configuration of the monitoring infrastructure of + this cluster + properties: + customQueriesConfigMap: + description: The list of config maps containing the custom queries + items: + description: ConfigMapKeySelector contains enough information + to let you locate the key of a ConfigMap + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: array + customQueriesSecret: + description: The list of secrets containing the custom queries + items: + description: SecretKeySelector contains enough information to + let you locate the key of a Secret + properties: + key: + description: The key to select + type: string + name: + description: Name of the referent. + type: string + required: + - key + - name + type: object + type: array + disableDefaultQueries: + default: false + description: 'Whether the default queries should be injected. + Set it to `true` if you don''t want to inject default queries + into the cluster. Default: false.' + type: boolean + enablePodMonitor: + default: false + description: Enable or disable the `PodMonitor` + type: boolean + type: object + nodeMaintenanceWindow: + description: Define a maintenance window for the Kubernetes nodes + properties: + inProgress: + default: false + description: Is there a node maintenance activity in progress? + type: boolean + reusePVC: + default: true + description: Reuse the existing PVC (wait for the node to come + up again) or not (recreate it elsewhere - when `instances` >1) + type: boolean + required: + - inProgress + type: object + postgresGID: + default: 26 + description: The GID of the `postgres` user inside the image, defaults + to `26` + format: int64 + type: integer + postgresUID: + default: 26 + description: The UID of the `postgres` user inside the image, defaults + to `26` + format: int64 + type: integer + postgresql: + description: Configuration of the PostgreSQL server + properties: + ldap: + description: Options to specify LDAP configuration + properties: + bindAsAuth: + description: Bind as authentication configuration + properties: + prefix: + description: Prefix for the bind authentication option + type: string + suffix: + description: Suffix for the bind authentication option + type: string + type: object + bindSearchAuth: + description: Bind+Search authentication configuration + properties: + baseDN: + description: Root DN to begin the user search + type: string + bindDN: + description: DN of the user to bind to the directory + type: string + bindPassword: + description: Secret with the password for the user to + bind to the directory + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + searchAttribute: + description: Attribute to match against the username + type: string + searchFilter: + description: Search filter to use when doing the search+bind + authentication + type: string + type: object + port: + description: LDAP server port + type: integer + scheme: + description: LDAP schema to be used, possible options are + `ldap` and `ldaps` + enum: + - ldap + - ldaps + type: string + server: + description: LDAP hostname or IP address + type: string + tls: + description: Set to 'true' to enable LDAP over TLS. 'false' + is default + type: boolean + type: object + parameters: + additionalProperties: + type: string + description: PostgreSQL configuration options (postgresql.conf) + type: object + pg_hba: + description: PostgreSQL Host Based Authentication rules (lines + to be appended to the pg_hba.conf file) + items: + type: string + type: array + promotionTimeout: + description: Specifies the maximum number of seconds to wait when + promoting an instance to primary. Default value is 40000000, + greater than one year in seconds, big enough to simulate an + infinite timeout + format: int32 + type: integer + shared_preload_libraries: + description: Lists of shared preload libraries to add to the default + ones + items: + type: string + type: array + syncReplicaElectionConstraint: + description: Requirements to be met by sync replicas. This will + affect how the "synchronous_standby_names" parameter will be + set up. + properties: + enabled: + description: This flag enables the constraints for sync replicas + type: boolean + nodeLabelsAntiAffinity: + description: A list of node labels values to extract and compare + to evaluate if the pods reside in the same topology or not + items: + type: string + type: array + required: + - enabled + type: object + type: object + primaryUpdateMethod: + default: restart + description: 'Method to follow to upgrade the primary server during + a rolling update procedure, after all replicas have been successfully + updated: it can be with a switchover (`switchover`) or in-place + (`restart` - default)' + enum: + - switchover + - restart + type: string + primaryUpdateStrategy: + default: unsupervised + description: 'Deployment strategy to follow to upgrade the primary + server during a rolling update procedure, after all replicas have + been successfully updated: it can be automated (`unsupervised` - + default) or manual (`supervised`)' + enum: + - unsupervised + - supervised + type: string + priorityClassName: + description: Name of the priority class which will be used in every + generated Pod, if the PriorityClass specified does not exist, the + pod will not be able to schedule. Please refer to https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass + for more information + type: string + projectedVolumeTemplate: + description: Template to be used to define projected volumes, projected + volumes will be mounted under `/projected` base folder + properties: + defaultMode: + description: defaultMode are the mode bits used to set permissions + on created files by default. Must be an octal value between + 0000 and 0777 or a decimal value between 0 and 511. YAML accepts + both octal and decimal values, JSON requires decimal values + for mode bits. Directories within the path are not affected + by this setting. This might be in conflict with other options + that affect the file mode, like fsGroup, and the result can + be other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected along with other + supported volume types + properties: + configMap: + description: configMap information about the configMap data + to project + properties: + items: + description: items if unspecified, each key-value pair + in the Data field of the referenced ConfigMap will + be projected into the volume as a file whose name + is the key and content is the value. If specified, + the listed keys will be projected into the specified + paths, and unlisted keys will not be present. If a + key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. + Paths must be relative and may not contain the '..' + path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: mode bits used + to set permissions on this file. Must be an + octal value between 0000 and 0777 or a decimal + value between 0 and 511. YAML accepts both octal + and decimal values, JSON requires decimal values + for mode bits. If not specified, the volume + defaultMode will be used. This might be in conflict + with other options that affect the file mode, + like fsGroup, and the result can be other mode + bits set.' + format: int32 + type: integer + path: + description: path is the relative path of the + file to map the key to. May not be an absolute + path. May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the downwardAPI + data to project + properties: + items: + description: Items is a list of DownwardAPIVolume file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the + pod: only annotations, labels, name and namespace + are supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in + the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: 'Optional: mode bits used to set + permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between + 0 and 511. YAML accepts both octal and decimal + values, JSON requires decimal values for mode + bits. If not specified, the volume defaultMode + will be used. This might be in conflict with + other options that affect the file mode, like + fsGroup, and the result can be other mode bits + set.' + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must not + be absolute or contain the ''..'' path. Must + be utf-8 encoded. The first item of the relative + path must not start with ''..''' + type: string + resourceFieldRef: + description: 'Selects a resource of the container: + only resources limits and requests (limits.cpu, + limits.memory, requests.cpu and requests.memory) + are currently supported.' + properties: + containerName: + description: 'Container name: required for + volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of + the exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the secret data to + project + properties: + items: + description: items if unspecified, each key-value pair + in the Data field of the referenced Secret will be + projected into the volume as a file whose name is + the key and content is the value. If specified, the + listed keys will be projected into the specified paths, + and unlisted keys will not be present. If a key is + specified which is not present in the Secret, the + volume setup will error unless it is marked optional. + Paths must be relative and may not contain the '..' + path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: mode bits used + to set permissions on this file. Must be an + octal value between 0000 and 0777 or a decimal + value between 0 and 511. YAML accepts both octal + and decimal values, JSON requires decimal values + for mode bits. If not specified, the volume + defaultMode will be used. This might be in conflict + with other options that affect the file mode, + like fsGroup, and the result can be other mode + bits set.' + format: int32 + type: integer + path: + description: path is the relative path of the + file to map the key to. May not be an absolute + path. May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: optional field specify whether the Secret + or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information about the + serviceAccountToken data to project + properties: + audience: + description: audience is the intended audience of the + token. A recipient of a token must identify itself + with an identifier specified in the audience of the + token, and otherwise should reject the token. The + audience defaults to the identifier of the apiserver. + type: string + expirationSeconds: + description: expirationSeconds is the requested duration + of validity of the service account token. As the token + approaches expiration, the kubelet volume plugin will + proactively rotate the service account token. The + kubelet will start trying to rotate the token if the + token is older than 80 percent of its time to live + or if the token is older than 24 hours.Defaults to + 1 hour and must be at least 10 minutes. + format: int64 + type: integer + path: + description: path is the path relative to the mount + point of the file to project the token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + replica: + description: Replica cluster configuration + properties: + enabled: + description: If replica mode is enabled, this cluster will be + a replica of an existing cluster. Replica cluster can be created + from a recovery object store or via streaming through pg_basebackup. + Refer to the Replication page of the documentation for more + information. + type: boolean + source: + description: The name of the external cluster which is the replication + origin + minLength: 1 + type: string + required: + - source + type: object + replicationSlots: + description: Replication slots management configuration + properties: + highAvailability: + description: Replication slots for high availability configuration + properties: + enabled: + default: false + description: If enabled, the operator will automatically manage + replication slots on the primary instance and use them in + streaming replication connections with all the standby instances + that are part of the HA cluster. If disabled (default), + the operator will not take advantage of replication slots + in streaming connections with the replicas. This feature + also controls replication slots in replica cluster, from + the designated primary to its cascading replicas. This can + only be set at creation time. + type: boolean + slotPrefix: + default: _cnpg_ + description: Prefix for replication slots managed by the operator + for HA. It may only contain lower case letters, numbers, + and the underscore character. This can only be set at creation + time. By default set to `_cnpg_`. + pattern: ^[0-9a-z_]*$ + type: string + type: object + updateInterval: + default: 30 + description: Standby will update the status of the local replication + slots every `updateInterval` seconds (default 30). + minimum: 1 + type: integer + type: object + resources: + description: Resources requirements of every generated Pod. Please + refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + for more information. + properties: + claims: + description: "Claims lists the names of resources, defined in + spec.resourceClaims, that are used by this container. \n This + is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be set + for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in pod.spec.resourceClaims + of the Pod where this field is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + schedulerName: + description: 'If specified, the pod will be dispatched by specified + Kubernetes scheduler. If not specified, the pod will be dispatched + by the default scheduler. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/' + type: string + seccompProfile: + description: 'The SeccompProfile applied to every Pod and Container. + Defaults to: `RuntimeDefault`' + properties: + localhostProfile: + description: localhostProfile indicates a profile defined in a + file on the node should be used. The profile must be preconfigured + on the node to work. Must be a descending path, relative to + the kubelet's configured seccomp profile location. Must only + be set if type is "Localhost". + type: string + type: + description: "type indicates which kind of seccomp profile will + be applied. Valid options are: \n Localhost - a profile defined + in a file on the node should be used. RuntimeDefault - the container + runtime default profile should be used. Unconfined - no profile + should be applied." + type: string + required: + - type + type: object + serviceAccountTemplate: + description: Configure the generation of the service account + properties: + metadata: + description: Metadata are the metadata to be used for the generated + service account + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + type: object + required: + - metadata + type: object + startDelay: + default: 30 + description: The time in seconds that is allowed for a PostgreSQL + instance to successfully start up (default 30) + format: int32 + type: integer + stopDelay: + default: 30 + description: The time in seconds that is allowed for a PostgreSQL + instance to gracefully shutdown (default 30) + format: int32 + type: integer + storage: + description: Configuration of the storage of the instances + properties: + pvcTemplate: + description: Template to be used to generate the Persistent Volume + Claim + properties: + accessModes: + description: 'accessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) If the provisioner + or an external controller can support the specified data + source, it will create a new volume based on the contents + of the specified data source. When the AnyVolumeDataSource + feature gate is enabled, dataSource contents will be copied + to dataSourceRef, and dataSourceRef contents will be copied + to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not + be copied to dataSource.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: 'dataSourceRef specifies the object from which + to populate the volume with data, if a non-empty volume + is desired. This may be any object from a non-empty API + group (non core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed + if the type of the specified object matches some installed + volume populator or dynamic provisioner. This field will + replace the functionality of the dataSource field and as + such if both fields are non-empty, they must have the same + value. For backwards compatibility, when namespace isn''t + specified in dataSourceRef, both fields (dataSource and + dataSourceRef) will be set to the same value automatically + if one of them is empty and the other is non-empty. When + namespace is specified in dataSourceRef, dataSource isn''t + set to the same value and must be empty. There are three + important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, + dataSourceRef allows any non-core object, as well as PersistentVolumeClaim + objects. * While dataSource ignores disallowed values (dropping + them), dataSourceRef preserves all values, and generates + an error if a disallowed value is specified. * While dataSource + only allows local objects, dataSourceRef allows objects + in any namespaces. (Beta) Using this field requires the + AnyVolumeDataSource feature gate to be enabled. (Alpha) + Using the namespace field of dataSourceRef requires the + CrossNamespaceVolumeDataSource feature gate to be enabled.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + namespace: + description: Namespace is the namespace of resource being + referenced Note that when a namespace is specified, + a gateway.networking.k8s.io/ReferenceGrant object is + required in the referent namespace to allow that namespace's + owner to accept the reference. See the ReferenceGrant + documentation for details. (Alpha) This field requires + the CrossNamespaceVolumeDataSource feature gate to be + enabled. + type: string + required: + - kind + - name + type: object + resources: + description: 'resources represents the minimum resources the + volume should have. If RecoverVolumeExpansionFailure feature + is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher + than capacity recorded in the status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. \n This field + is immutable. It can only be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + selector: + description: selector is a label query over volumes to consider + for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: 'storageClassName is the name of the StorageClass + required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: volumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + resizeInUseVolumes: + default: true + description: Resize existent PVCs, defaults to true + type: boolean + size: + description: Size of the storage. Required if not already specified + in the PVC template. Changes to this field are automatically + reapplied to the created PVCs. Size cannot be decreased. + type: string + storageClass: + description: StorageClass to use for database data (`PGDATA`). + Applied after evaluating the PVC template, if available. If + not specified, generated PVCs will be satisfied by the default + storage class + type: string + type: object + superuserSecret: + description: The secret containing the superuser password. If not + defined a new secret will be created with a randomly generated password + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + switchoverDelay: + default: 40000000 + description: The time in seconds that is allowed for a primary PostgreSQL + instance to gracefully shutdown during a switchover. Default value + is 40000000, greater than one year in seconds, big enough to simulate + an infinite delay + format: int32 + type: integer + topologySpreadConstraints: + description: 'TopologySpreadConstraints specifies how to spread matching + pods among the given topology. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/' + items: + description: TopologySpreadConstraint specifies how to spread matching + pods among the given topology. + properties: + labelSelector: + description: LabelSelector is used to find matching pods. Pods + that match this label selector are counted to determine the + number of pods in their corresponding topology domain. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. This + array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: "MatchLabelKeys is a set of pod label keys to select + the pods over which spreading will be calculated. The keys + are used to lookup values from the incoming pod labels, those + key-value labels are ANDed with labelSelector to select the + group of existing pods over which spreading will be calculated + for the incoming pod. The same key is forbidden to exist in + both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot + be set when LabelSelector isn't set. Keys that don't exist + in the incoming pod labels will be ignored. A null or empty + list means only match against labelSelector. \n This is a + beta field and requires the MatchLabelKeysInPodTopologySpread + feature gate to be enabled (enabled by default)." + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + description: 'MaxSkew describes the degree to which pods may + be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, + it is the maximum permitted difference between the number + of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods + in an eligible domain or zero if the number of eligible domains + is less than MinDomains. For example, in a 3-zone cluster, + MaxSkew is set to 1, and pods with the same labelSelector + spread as 2/2/1: In this case, the global minimum is 1. | + zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew + is 1, incoming pod can only be scheduled to zone3 to become + 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) + on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming + pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, + it is used to give higher precedence to topologies that satisfy + it. It''s a required field. Default value is 1 and 0 is not + allowed.' + format: int32 + type: integer + minDomains: + description: "MinDomains indicates a minimum number of eligible + domains. When the number of eligible domains with matching + topology keys is less than minDomains, Pod Topology Spread + treats \"global minimum\" as 0, and then the calculation of + Skew is performed. And when the number of eligible domains + with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. As a result, when + the number of eligible domains is less than minDomains, scheduler + won't schedule more than maxSkew Pods to those domains. If + value is nil, the constraint behaves as if MinDomains is equal + to 1. Valid values are integers greater than 0. When value + is not nil, WhenUnsatisfiable must be DoNotSchedule. \n For + example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains + is set to 5 and pods with the same labelSelector spread as + 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | + The number of domains is less than 5(MinDomains), so \"global + minimum\" is treated as 0. In this situation, new pod with + the same labelSelector cannot be scheduled, because computed + skew will be 3(3 - 0) if new Pod is scheduled to any of the + three zones, it will violate MaxSkew. \n This is a beta field + and requires the MinDomainsInPodTopologySpread feature gate + to be enabled (enabled by default)." + format: int32 + type: integer + nodeAffinityPolicy: + description: "NodeAffinityPolicy indicates how we will treat + Pod's nodeAffinity/nodeSelector when calculating pod topology + spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector + are included in the calculations. - Ignore: nodeAffinity/nodeSelector + are ignored. All nodes are included in the calculations. \n + If this value is nil, the behavior is equivalent to the Honor + policy. This is a beta-level feature default enabled by the + NodeInclusionPolicyInPodTopologySpread feature flag." + type: string + nodeTaintsPolicy: + description: "NodeTaintsPolicy indicates how we will treat node + taints when calculating pod topology spread skew. Options + are: - Honor: nodes without taints, along with tainted nodes + for which the incoming pod has a toleration, are included. + - Ignore: node taints are ignored. All nodes are included. + \n If this value is nil, the behavior is equivalent to the + Ignore policy. This is a beta-level feature default enabled + by the NodeInclusionPolicyInPodTopologySpread feature flag." + type: string + topologyKey: + description: TopologyKey is the key of node labels. Nodes that + have a label with this key and identical values are considered + to be in the same topology. We consider each + as a "bucket", and try to put balanced number of pods into + each bucket. We define a domain as a particular instance of + a topology. Also, we define an eligible domain as a domain + whose nodes meet the requirements of nodeAffinityPolicy and + nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", + each Node is a domain of that topology. And, if TopologyKey + is "topology.kubernetes.io/zone", each zone is a domain of + that topology. It's a required field. + type: string + whenUnsatisfiable: + description: 'WhenUnsatisfiable indicates how to deal with a + pod if it doesn''t satisfy the spread constraint. - DoNotSchedule + (default) tells the scheduler not to schedule it. - ScheduleAnyway + tells the scheduler to schedule the pod in any location, but + giving higher precedence to topologies that would help reduce + the skew. A constraint is considered "Unsatisfiable" for an + incoming pod if and only if every possible node assignment + for that pod would violate "MaxSkew" on some topology. For + example, in a 3-zone cluster, MaxSkew is set to 1, and pods + with the same labelSelector spread as 3/1/1: | zone1 | zone2 + | zone3 | | P P P | P | P | If WhenUnsatisfiable is + set to DoNotSchedule, incoming pod can only be scheduled to + zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on + zone2(zone3) satisfies MaxSkew(1). In other words, the cluster + can still be imbalanced, but scheduler won''t make it *more* + imbalanced. It''s a required field.' + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + walStorage: + description: Configuration of the storage for PostgreSQL WAL (Write-Ahead + Log) + properties: + pvcTemplate: + description: Template to be used to generate the Persistent Volume + Claim + properties: + accessModes: + description: 'accessModes contains the desired access modes + the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) If the provisioner + or an external controller can support the specified data + source, it will create a new volume based on the contents + of the specified data source. When the AnyVolumeDataSource + feature gate is enabled, dataSource contents will be copied + to dataSourceRef, and dataSourceRef contents will be copied + to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not + be copied to dataSource.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: 'dataSourceRef specifies the object from which + to populate the volume with data, if a non-empty volume + is desired. This may be any object from a non-empty API + group (non core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed + if the type of the specified object matches some installed + volume populator or dynamic provisioner. This field will + replace the functionality of the dataSource field and as + such if both fields are non-empty, they must have the same + value. For backwards compatibility, when namespace isn''t + specified in dataSourceRef, both fields (dataSource and + dataSourceRef) will be set to the same value automatically + if one of them is empty and the other is non-empty. When + namespace is specified in dataSourceRef, dataSource isn''t + set to the same value and must be empty. There are three + important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, + dataSourceRef allows any non-core object, as well as PersistentVolumeClaim + objects. * While dataSource ignores disallowed values (dropping + them), dataSourceRef preserves all values, and generates + an error if a disallowed value is specified. * While dataSource + only allows local objects, dataSourceRef allows objects + in any namespaces. (Beta) Using this field requires the + AnyVolumeDataSource feature gate to be enabled. (Alpha) + Using the namespace field of dataSourceRef requires the + CrossNamespaceVolumeDataSource feature gate to be enabled.' + properties: + apiGroup: + description: APIGroup is the group for the resource being + referenced. If APIGroup is not specified, the specified + Kind must be in the core API group. For any other third-party + types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + namespace: + description: Namespace is the namespace of resource being + referenced Note that when a namespace is specified, + a gateway.networking.k8s.io/ReferenceGrant object is + required in the referent namespace to allow that namespace's + owner to accept the reference. See the ReferenceGrant + documentation for details. (Alpha) This field requires + the CrossNamespaceVolumeDataSource feature gate to be + enabled. + type: string + required: + - kind + - name + type: object + resources: + description: 'resources represents the minimum resources the + volume should have. If RecoverVolumeExpansionFailure feature + is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher + than capacity recorded in the status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. \n This field + is immutable. It can only be set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry + in pod.spec.resourceClaims of the Pod where this + field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of + compute resources required. If Requests is omitted for + a container, it defaults to Limits if that is explicitly + specified, otherwise to an implementation-defined value. + Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + selector: + description: selector is a label query over volumes to consider + for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: 'storageClassName is the name of the StorageClass + required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type of volume is required + by the claim. Value of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: volumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + resizeInUseVolumes: + default: true + description: Resize existent PVCs, defaults to true + type: boolean + size: + description: Size of the storage. Required if not already specified + in the PVC template. Changes to this field are automatically + reapplied to the created PVCs. Size cannot be decreased. + type: string + storageClass: + description: StorageClass to use for database data (`PGDATA`). + Applied after evaluating the PVC template, if available. If + not specified, generated PVCs will be satisfied by the default + storage class + type: string + type: object + required: + - instances + type: object + status: + description: 'Most recently observed status of the cluster. This data + may not be up to date. Populated by the system. Read-only. More info: + https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + azurePVCUpdateEnabled: + description: AzurePVCUpdateEnabled shows if the PVC online upgrade + is enabled for this cluster + type: boolean + certificates: + description: The configuration for the CA and related certificates, + initialized with defaults. + properties: + clientCASecret: + description: 'The secret containing the Client CA certificate. + If not defined, a new secret will be created with a self-signed + CA and will be used to generate all the client certificates.

Contains:

- `ca.crt`: CA that should + be used to validate the client certificates, used as `ssl_ca_file` + of all the instances.
- `ca.key`: key used to generate + client certificates, if ReplicationTLSSecret is provided, this + can be omitted.
' + type: string + expirations: + additionalProperties: + type: string + description: Expiration dates for all certificates. + type: object + replicationTLSSecret: + description: The secret of type kubernetes.io/tls containing the + client certificate to authenticate as the `streaming_replica` + user. If not defined, ClientCASecret must provide also `ca.key`, + and a new secret will be created using the provided CA. + type: string + serverAltDNSNames: + description: The list of the server alternative DNS names to be + added to the generated server TLS certificates, when required. + items: + type: string + type: array + serverCASecret: + description: 'The secret containing the Server CA certificate. + If not defined, a new secret will be created with a self-signed + CA and will be used to generate the TLS certificate ServerTLSSecret.

Contains:

- `ca.crt`: CA that should + be used to validate the server certificate, used as `sslrootcert` + in client connection strings.
- `ca.key`: key used to + generate Server SSL certs, if ServerTLSSecret is provided, this + can be omitted.
' + type: string + serverTLSSecret: + description: The secret of type kubernetes.io/tls containing the + server TLS certificate and key that will be set as `ssl_cert_file` + and `ssl_key_file` so that clients can connect to postgres securely. + If not defined, ServerCASecret must provide also `ca.key` and + a new secret will be created using the provided CA. + type: string + type: object + cloudNativePGCommitHash: + description: The commit hash number of which this operator running + type: string + cloudNativePGOperatorHash: + description: The hash of the binary of the operator + type: string + conditions: + description: Conditions for cluster object + items: + description: "Condition contains details for one aspect of the current + state of this API Resource. --- This struct is intended for direct + use as an array at the field path .status.conditions. For example, + \n type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge + // +listType=map // +listMapKey=type Conditions []metav1.Condition + `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" + protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition + transitioned from one status to another. This should be when + the underlying condition changed. If that is not known, then + using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: message is a human readable message indicating + details about the transition. This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: observedGeneration represents the .metadata.generation + that the condition was set based upon. For instance, if .metadata.generation + is currently 12, but the .status.conditions[x].observedGeneration + is 9, the condition is out of date with respect to the current + state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: reason contains a programmatic identifier indicating + the reason for the condition's last transition. Producers + of specific condition types may define expected values and + meanings for this field, and whether the values are considered + a guaranteed API. The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + --- Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + configMapResourceVersion: + description: The list of resource versions of the configmaps, managed + by the operator. Every change here is done in the interest of the + instance manager, which will refresh the configmap data + properties: + metrics: + additionalProperties: + type: string + description: A map with the versions of all the config maps used + to pass metrics. Map keys are the config map names, map values + are the versions + type: object + type: object + currentPrimary: + description: Current primary instance + type: string + currentPrimaryFailingSinceTimestamp: + description: The timestamp when the primary was detected to be unhealthy + This field is reported when spec.failoverDelay is populated or during + online upgrades + type: string + currentPrimaryTimestamp: + description: The timestamp when the last actual promotion to primary + has occurred + type: string + danglingPVC: + description: List of all the PVCs created by this cluster and still + available which are not attached to a Pod + items: + type: string + type: array + firstRecoverabilityPoint: + description: The first recoverability point, stored as a date in RFC3339 + format + type: string + healthyPVC: + description: List of all the PVCs not dangling nor initializing + items: + type: string + type: array + initializingPVC: + description: List of all the PVCs that are being initialized by this + cluster + items: + type: string + type: array + instanceNames: + description: List of instance names in the cluster + items: + type: string + type: array + instances: + description: The total number of PVC Groups detected in the cluster. + It may differ from the number of existing instance pods. + type: integer + instancesReportedState: + additionalProperties: + description: InstanceReportedState describes the last reported state + of an instance during a reconciliation loop + properties: + isPrimary: + description: indicates if an instance is the primary one + type: boolean + timeLineID: + description: indicates on which TimelineId the instance is + type: integer + required: + - isPrimary + type: object + description: The reported state of the instances during the last reconciliation + loop + type: object + instancesStatus: + additionalProperties: + items: + type: string + type: array + description: InstancesStatus indicates in which status the instances + are + type: object + jobCount: + description: How many Jobs have been created by this cluster + format: int32 + type: integer + lastFailedBackup: + description: Stored as a date in RFC3339 format + type: string + lastSuccessfulBackup: + description: Stored as a date in RFC3339 format + type: string + latestGeneratedNode: + description: ID of the latest generated node (used to avoid node name + clashing) + type: integer + managedRolesStatus: + description: ManagedRolesStatus reports the state of the managed roles + in the cluster + properties: + byStatus: + additionalProperties: + items: + type: string + type: array + description: ByStatus gives the list of roles in each state + type: object + cannotReconcile: + additionalProperties: + items: + type: string + type: array + description: CannotReconcile lists roles that cannot be reconciled + in PostgreSQL, with an explanation of the cause + type: object + passwordStatus: + additionalProperties: + description: PasswordState represents the state of the password + of a managed RoleConfiguration + properties: + resourceVersion: + description: the resource version of the password secret + type: string + transactionID: + description: the last transaction ID to affect the role + definition in PostgreSQL + format: int64 + type: integer + type: object + description: PasswordStatus gives the last transaction id and + password secret version for each managed role + type: object + type: object + onlineUpdateEnabled: + description: OnlineUpdateEnabled shows if the online upgrade is enabled + inside the cluster + type: boolean + phase: + description: Current phase of the cluster + type: string + phaseReason: + description: Reason for the current phase + type: string + poolerIntegrations: + description: The integration needed by poolers referencing the cluster + properties: + pgBouncerIntegration: + description: PgBouncerIntegrationStatus encapsulates the needed + integration for the pgbouncer poolers referencing the cluster + properties: + secrets: + items: + type: string + type: array + type: object + type: object + pvcCount: + description: How many PVCs have been created by this cluster + format: int32 + type: integer + readService: + description: Current list of read pods + type: string + readyInstances: + description: The total number of ready instances in the cluster. It + is equal to the number of ready instance pods. + type: integer + resizingPVC: + description: List of all the PVCs that have ResizingPVC condition. + items: + type: string + type: array + secretsResourceVersion: + description: The list of resource versions of the secrets managed + by the operator. Every change here is done in the interest of the + instance manager, which will refresh the secret data + properties: + applicationSecretVersion: + description: The resource version of the "app" user secret + type: string + barmanEndpointCA: + description: The resource version of the Barman Endpoint CA if + provided + type: string + caSecretVersion: + description: Unused. Retained for compatibility with old versions. + type: string + clientCaSecretVersion: + description: The resource version of the PostgreSQL client-side + CA secret version + type: string + managedRoleSecretVersion: + additionalProperties: + type: string + description: The resource versions of the managed roles secrets + type: object + metrics: + additionalProperties: + type: string + description: A map with the versions of all the secrets used to + pass metrics. Map keys are the secret names, map values are + the versions + type: object + replicationSecretVersion: + description: The resource version of the "streaming_replica" user + secret + type: string + serverCaSecretVersion: + description: The resource version of the PostgreSQL server-side + CA secret version + type: string + serverSecretVersion: + description: The resource version of the PostgreSQL server-side + secret version + type: string + superuserSecretVersion: + description: The resource version of the "postgres" user secret + type: string + type: object + targetPrimary: + description: Target primary instance, this is different from the previous + one during a switchover or a failover + type: string + targetPrimaryTimestamp: + description: The timestamp when the last request for a new primary + has occurred + type: string + timelineID: + description: The timeline of the Postgres cluster + type: integer + topology: + description: Instances topology. + properties: + instances: + additionalProperties: + additionalProperties: + type: string + description: PodTopologyLabels represent the topology of a Pod. + map[labelName]labelValue + type: object + description: Instances contains the pod topology of the instances + type: object + nodesUsed: + description: NodesUsed represents the count of distinct nodes + accommodating the instances. A value of '1' suggests that all + instances are hosted on a single node, implying the absence + of High Availability (HA). Ideally, this value should be the + same as the number of instances in the Postgres HA cluster, + implying shared nothing architecture on the compute side. + format: int32 + type: integer + successfullyExtracted: + description: SuccessfullyExtracted indicates if the topology data + was extract. It is useful to enact fallback behaviors in synchronous + replica election in case of failures + type: boolean + type: object + unusablePVC: + description: List of all the PVCs that are unusable because another + PVC is missing + items: + type: string + type: array + writeService: + description: Current write pod + type: string + type: object + type: object + served: true + storage: true + subresources: + scale: + specReplicasPath: .spec.instances + statusReplicasPath: .status.instances + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.1 + name: poolers.postgresql.cnpg.io +spec: + group: postgresql.cnpg.io + names: + kind: Pooler + listKind: PoolerList + plural: poolers + singular: pooler + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.cluster.name + name: Cluster + type: string + - jsonPath: .spec.type + name: Type + type: string + name: v1 + schema: + openAPIV3Schema: + description: Pooler is the Schema for the poolers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PoolerSpec defines the desired state of Pooler + properties: + cluster: + description: This is the cluster reference on which the Pooler will + work. Pooler name should never match with any cluster name within + the same namespace. + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + deploymentStrategy: + description: The deployment strategy to use for pgbouncer to replace + existing pods with new ones + properties: + rollingUpdate: + description: 'Rolling update config params. Present only if DeploymentStrategyType + = RollingUpdate. --- TODO: Update this to follow our convention + for oneOf, whatever we decide it to be.' + properties: + maxSurge: + anyOf: + - type: integer + - type: string + description: 'The maximum number of pods that can be scheduled + above the desired number of pods. Value can be an absolute + number (ex: 5) or a percentage of desired pods (ex: 10%). + This can not be 0 if MaxUnavailable is 0. Absolute number + is calculated from percentage by rounding up. Defaults to + 25%. Example: when this is set to 30%, the new ReplicaSet + can be scaled up immediately when the rolling update starts, + such that the total number of old and new pods do not exceed + 130% of desired pods. Once old pods have been killed, new + ReplicaSet can be scaled up further, ensuring that total + number of pods running at any time during the update is + at most 130% of desired pods.' + x-kubernetes-int-or-string: true + maxUnavailable: + anyOf: + - type: integer + - type: string + description: 'The maximum number of pods that can be unavailable + during the update. Value can be an absolute number (ex: + 5) or a percentage of desired pods (ex: 10%). Absolute number + is calculated from percentage by rounding down. This can + not be 0 if MaxSurge is 0. Defaults to 25%. Example: when + this is set to 30%, the old ReplicaSet can be scaled down + to 70% of desired pods immediately when the rolling update + starts. Once new pods are ready, old ReplicaSet can be scaled + down further, followed by scaling up the new ReplicaSet, + ensuring that the total number of pods available at all + times during the update is at least 70% of desired pods.' + x-kubernetes-int-or-string: true + type: object + type: + description: Type of deployment. Can be "Recreate" or "RollingUpdate". + Default is RollingUpdate. + type: string + type: object + instances: + default: 1 + description: The number of replicas we want + format: int32 + type: integer + monitoring: + description: The configuration of the monitoring infrastructure of + this pooler. + properties: + enablePodMonitor: + default: false + description: Enable or disable the `PodMonitor` + type: boolean + type: object + pgbouncer: + description: The PgBouncer configuration + properties: + authQuery: + description: 'The query that will be used to download the hash + of the password of a certain user. Default: "SELECT usename, + passwd FROM user_search($1)". In case it is specified, also + an AuthQuerySecret has to be specified and no automatic CNPG + Cluster integration will be triggered.' + type: string + authQuerySecret: + description: The credentials of the user that need to be used + for the authentication query. In case it is specified, also + an AuthQuery (e.g. "SELECT usename, passwd FROM pg_shadow WHERE + usename=$1") has to be specified and no automatic CNPG Cluster + integration will be triggered. + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + parameters: + additionalProperties: + type: string + description: Additional parameters to be passed to PgBouncer - + please check the CNPG documentation for a list of options you + can configure + type: object + paused: + default: false + description: When set to `true`, PgBouncer will disconnect from + the PostgreSQL server, first waiting for all queries to complete, + and pause all new client connections until this value is set + to `false` (default). Internally, the operator calls PgBouncer's + `PAUSE` and `RESUME` commands. + type: boolean + pg_hba: + description: PostgreSQL Host Based Authentication rules (lines + to be appended to the pg_hba.conf file) + items: + type: string + type: array + poolMode: + default: session + description: The pool mode + enum: + - session + - transaction + type: string + required: + - poolMode + type: object + template: + description: The template of the Pod to be created + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + type: object + spec: + description: 'Specification of the desired behavior of the pod. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + activeDeadlineSeconds: + description: Optional duration in seconds the pod may be active + on the node relative to StartTime before the system will + actively try to mark it failed and kill associated containers. + Value must be a positive integer. + format: int64 + type: integer + affinity: + description: If specified, the pod's scheduling constraints + properties: + nodeAffinity: + description: Describes node affinity scheduling rules + for the pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements + of this field and adding "weight" to the sum if + the node matches the corresponding matchExpressions; + the node(s) with the highest sum are the most preferred. + items: + description: An empty preferred scheduling term + matches all objects with implicit weight 0 (i.e. + it's a no-op). A null preferred scheduling term + matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated + with the corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching + the corresponding nodeSelectorTerm, in the + range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + affinity requirements specified by this field cease + to be met at some point during pod execution (e.g. + due to an update), the system may or may not try + to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector + terms. The terms are ORed. + items: + description: A null or empty node selector term + matches no objects. The requirements of them + are ANDed. The TopologySelectorTerm type implements + a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. + co-locate this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements + of this field and adding "weight" to the sum if + the node has pods which matches the corresponding + podAffinityTerm; the node(s) with the highest sum + are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, + associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of + resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set + of namespaces that the term applies to. + The term is applied to the union of the + namespaces selected by this field and + the ones listed in the namespaces field. + null selector and null or empty namespaces + list means "this pod's namespace". An + empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static + list of namespace names that the term + applies to. The term is applied to the + union of the namespaces listed in this + field and the ones selected by namespaceSelector. + null or empty namespaces list and null + namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located + (affinity) or not co-located (anti-affinity) + with the pods matching the labelSelector + in the specified namespaces, where co-located + is defined as running on a node whose + value of the label with key topologyKey + matches that of any node on which any + of the selected pods is running. Empty + topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching + the corresponding podAffinityTerm, in the + range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + affinity requirements specified by this field cease + to be met at some point during pod execution (e.g. + due to a pod label update), the system may or may + not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes + corresponding to each podAffinityTerm are intersected, + i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those + matching the labelSelector relative to the given + namespace(s)) that this pod should be co-located + (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node + whose value of the label with key + matches that of any node on which a pod of the + set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by + this field and the ones listed in the namespaces + field. null selector and null or empty namespaces + list means "this pod's namespace". An empty + selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. + The term is applied to the union of the namespaces + listed in this field and the ones selected + by namespaceSelector. null or empty namespaces + list and null namespaceSelector means "this + pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the + pods matching the labelSelector in the specified + namespaces, where co-located is defined as + running on a node whose value of the label + with key topologyKey matches that of any node + on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules + (e.g. avoid putting this pod in the same node, zone, + etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the anti-affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity + expressions, etc.), compute a sum by iterating through + the elements of this field and adding "weight" to + the sum if the node has pods which matches the corresponding + podAffinityTerm; the node(s) with the highest sum + are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, + associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of + resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set + of namespaces that the term applies to. + The term is applied to the union of the + namespaces selected by this field and + the ones listed in the namespaces field. + null selector and null or empty namespaces + list means "this pod's namespace". An + empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static + list of namespace names that the term + applies to. The term is applied to the + union of the namespaces listed in this + field and the ones selected by namespaceSelector. + null or empty namespaces list and null + namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located + (affinity) or not co-located (anti-affinity) + with the pods matching the labelSelector + in the specified namespaces, where co-located + is defined as running on a node whose + value of the label with key topologyKey + matches that of any node on which any + of the selected pods is running. Empty + topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching + the corresponding podAffinityTerm, in the + range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the anti-affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + anti-affinity requirements specified by this field + cease to be met at some point during pod execution + (e.g. due to a pod label update), the system may + or may not try to eventually evict the pod from + its node. When there are multiple elements, the + lists of nodes corresponding to each podAffinityTerm + are intersected, i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those + matching the labelSelector relative to the given + namespace(s)) that this pod should be co-located + (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node + whose value of the label with key + matches that of any node on which a pod of the + set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by + this field and the ones listed in the namespaces + field. null selector and null or empty namespaces + list means "this pod's namespace". An empty + selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. + The term is applied to the union of the namespaces + listed in this field and the ones selected + by namespaceSelector. null or empty namespaces + list and null namespaceSelector means "this + pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the + pods matching the labelSelector in the specified + namespaces, where co-located is defined as + running on a node whose value of the label + with key topologyKey matches that of any node + on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + automountServiceAccountToken: + description: AutomountServiceAccountToken indicates whether + a service account token should be automatically mounted. + type: boolean + containers: + description: List of containers belonging to the pod. Containers + cannot currently be added or removed. There must be at least + one container in a Pod. Cannot be updated. + items: + description: A single application container that you want + to run within a pod. + properties: + args: + description: 'Arguments to the entrypoint. The container + image''s CMD is used if this is not provided. Variable + references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the + reference in the input string will be unchanged. Double + $$ are reduced to a single $, which allows for escaping + the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce + the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the + variable exists or not. Cannot be updated. More info: + https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within + a shell. The container image''s ENTRYPOINT is used + if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If + a variable cannot be resolved, the reference in the + input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) + syntax: i.e. "$$(VAR_NAME)" will produce the string + literal "$(VAR_NAME)". Escaped references will never + be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in + the container. Cannot be updated. + items: + description: EnvVar represents an environment variable + present in a Container. + properties: + name: + description: Name of the environment variable. + Must be a C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) + are expanded using the previously defined environment + variables in the container and any service environment + variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. + Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" + will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults + to "".' + type: string + valueFrom: + description: Source for the environment variable's + value. Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: + supports metadata.name, metadata.namespace, + `metadata.labels['''']`, `metadata.annotations['''']`, + spec.nodeName, spec.serviceAccountName, + status.hostIP, status.podIP, status.podIPs.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, defaults + to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: + only resources limits and requests (limits.cpu, + limits.memory, limits.ephemeral-storage, + requests.cpu, requests.memory and requests.ephemeral-storage) + are currently supported.' + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults to + "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in + the pod's namespace + properties: + key: + description: The key of the secret to + select from. Must be a valid secret + key. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment + variables in the container. The keys defined within + a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is + starting. When a key exists in multiple sources, the + value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of + a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend + to each key in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret must + be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config + management to default or override container images + in workload controllers like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, + IfNotPresent. Defaults to Always if :latest tag is + specified, or IfNotPresent otherwise. Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should + take in response to container lifecycle events. Cannot + be updated. + properties: + postStart: + description: 'PostStart is called immediately after + a container is created. If the handler fails, + the container is terminated and restarted according + to its restart policy. Other management of the + container blocks until the hook completes. More + info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before + a container is terminated due to an API request + or management event such as liveness/startup probe + failure, preemption, resource contention, etc. + The handler is not called if the container crashes + or exits. The Pod''s termination grace period + countdown begins before the PreStop hook is executed. + Regardless of the outcome of the handler, the + container will eventually terminate within the + Pod''s termination grace period (unless delayed + by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. + Container will be restarted if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. + Each container in a pod must have a unique name (DNS_LABEL). + Cannot be updated. + type: string + ports: + description: List of ports to expose from the container. + Not specifying a port here DOES NOT prevent that port + from being exposed. Any port which is listening on + the default "0.0.0.0" address inside a container will + be accessible from the network. Modifying this array + with strategic merge patch may corrupt the data. For + more information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port + in a single container. + properties: + containerPort: + description: Number of port to expose on the pod's + IP address. This must be a valid port number, + 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external + port to. + type: string + hostPort: + description: Number of port to expose on the host. + If specified, this must be a valid port number, + 0 < x < 65536. If HostNetwork is specified, + this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in + a pod must have a unique name. Name for the + port that can be referred to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, + or SCTP. Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. + Container will be removed from service endpoints if + the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource + resize policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this + resource resize policy applies. Supported values: + cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified + resource is resized. If not specified, it defaults + to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. + Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, + defined in spec.resourceClaims, that are used + by this container. \n This is an alpha field and + requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can + only be set for containers." + items: + description: ResourceClaim references one entry + in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one + entry in pod.spec.resourceClaims of the + Pod where this field is used. It makes that + resource available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount + of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount + of compute resources required. If Requests is + omitted for a container, it defaults to Limits + if that is explicitly specified, otherwise to + an implementation-defined value. Requests cannot + exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + securityContext: + description: 'SecurityContext defines the security options + the container should be run with. If set, the fields + of SecurityContext override the equivalent fields + of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls + whether a process can gain more privileges than + its parent process. This bool directly controls + if the no_new_privs flag will be set on the container + process. AllowPrivilegeEscalation is true always + when the container is: 1) run as Privileged 2) + has CAP_SYS_ADMIN Note that this field cannot + be set when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running + containers. Defaults to the default set of capabilities + granted by the container runtime. Note that this + field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes + in privileged containers are essentially equivalent + to root on the host. Defaults to false. Note that + this field cannot be set when spec.os.name is + windows. + type: boolean + procMount: + description: procMount denotes the type of proc + mount to use for the containers. The default is + DefaultProcMount which uses the container runtime + defaults for readonly paths and masked paths. + This requires the ProcMountType feature flag to + be enabled. Note that this field cannot be set + when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only + root filesystem. Default is false. Note that this + field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the + container process. Uses runtime default if unset. + May also be set in PodSecurityContext. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run + as a non-root user. If true, the Kubelet will + validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start + the container if it does. If unset or false, no + such validation will be performed. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the + container process. Defaults to user specified + in image metadata if unspecified. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. Note that this + field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to + the container. If unspecified, the container runtime + will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + properties: + level: + description: Level is SELinux level label that + applies to the container. + type: string + role: + description: Role is a SELinux role label that + applies to the container. + type: string + type: + description: Type is a SELinux type label that + applies to the container. + type: string + user: + description: User is a SELinux user label that + applies to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this + container. If seccomp options are provided at + both the pod & container level, the container + options override the pod options. Note that this + field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile + defined in a file on the node should be used. + The profile must be preconfigured on the node + to work. Must be a descending path, relative + to the kubelet's configured seccomp profile + location. Must only be set if type is "Localhost". + type: string + type: + description: "type indicates which kind of seccomp + profile will be applied. Valid options are: + \n Localhost - a profile defined in a file + on the node should be used. RuntimeDefault + - the container runtime default profile should + be used. Unconfined - no profile should be + applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied + to all containers. If unspecified, the options + from the PodSecurityContext will be used. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the + GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential + spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name + of the GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container + should be run as a 'Host Process' container. + This field is alpha-level and will only be + honored by components that enable the WindowsHostProcessContainers + feature flag. Setting this field without the + feature flag will result in errors when validating + the Pod. All of a Pod's containers must have + the same effective HostProcess value (it is + not allowed to have a mix of HostProcess containers + and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must + also be set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run + the entrypoint of the container process. Defaults + to the user specified in image metadata if + unspecified. May also be set in PodSecurityContext. + If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes + precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has + successfully initialized. If specified, no other probes + are executed until this completes successfully. If + this probe fails, the Pod will be restarted, just + as if the livenessProbe failed. This can be used to + provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time + to load data or warm a cache, than during steady-state + operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate + a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will + always result in EOF. Default is false. + type: boolean + stdinOnce: + description: Whether the container runtime should close + the stdin channel after it has been opened by a single + attach. When stdin is true the stdin stream will remain + open across multiple attach sessions. If stdinOnce + is set to true, stdin is opened on container start, + is empty until the first client attaches to stdin, + and then remains open and accepts data until the client + disconnects, at which time stdin is closed and remains + closed until the container is restarted. If this flag + is false, a container processes that reads from stdin + will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which + the container''s termination message will be written + is mounted into the container''s filesystem. Message + written is intended to be brief final status, such + as an assertion failure message. Will be truncated + by the node if greater than 4096 bytes. The total + message length across all containers will be limited + to 12kb. Defaults to /dev/termination-log. Cannot + be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should + be populated. File will use the contents of terminationMessagePath + to populate the container status message on both success + and failure. FallbackToLogsOnError will use the last + chunk of container log output if the termination message + file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, + whichever is smaller. Defaults to File. Cannot be + updated. + type: string + tty: + description: Whether this container should allocate + a TTY for itself, also requires 'stdin' to be true. + Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices + to be used by the container. + items: + description: volumeDevice describes a mapping of a + raw block device within a container. + properties: + devicePath: + description: devicePath is the path inside of + the container that the device will be mapped + to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's + filesystem. Cannot be updated. + items: + description: VolumeMount describes a mounting of a + Volume within a container. + properties: + mountPath: + description: Path within the container at which + the volume should be mounted. Must not contain + ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts + are propagated from the host to container and + the other way around. When not set, MountPropagationNone + is used. This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write + otherwise (false or unspecified). Defaults to + false. + type: boolean + subPath: + description: Path within the volume from which + the container's volume should be mounted. Defaults + to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from + which the container's volume should be mounted. + Behaves similarly to SubPath but environment + variable references $(VAR_NAME) are expanded + using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath + are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which + might be configured in the container image. Cannot + be updated. + type: string + required: + - name + type: object + type: array + dnsConfig: + description: Specifies the DNS parameters of a pod. Parameters + specified here will be merged to the generated DNS configuration + based on DNSPolicy. + properties: + nameservers: + description: A list of DNS name server IP addresses. This + will be appended to the base nameservers generated from + DNSPolicy. Duplicated nameservers will be removed. + items: + type: string + type: array + options: + description: A list of DNS resolver options. This will + be merged with the base options generated from DNSPolicy. + Duplicated entries will be removed. Resolution options + given in Options will override those that appear in + the base DNSPolicy. + items: + description: PodDNSConfigOption defines DNS resolver + options of a pod. + properties: + name: + description: Required. + type: string + value: + type: string + type: object + type: array + searches: + description: A list of DNS search domains for host-name + lookup. This will be appended to the base search paths + generated from DNSPolicy. Duplicated search paths will + be removed. + items: + type: string + type: array + type: object + dnsPolicy: + description: Set DNS policy for the pod. Defaults to "ClusterFirst". + Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', + 'Default' or 'None'. DNS parameters given in DNSConfig will + be merged with the policy selected with DNSPolicy. To have + DNS options set along with hostNetwork, you have to specify + DNS policy explicitly to 'ClusterFirstWithHostNet'. + type: string + enableServiceLinks: + description: 'EnableServiceLinks indicates whether information + about services should be injected into pod''s environment + variables, matching the syntax of Docker links. Optional: + Defaults to true.' + type: boolean + ephemeralContainers: + description: List of ephemeral containers run in this pod. + Ephemeral containers may be run in an existing pod to perform + user-initiated actions such as debugging. This list cannot + be specified when creating a pod, and it cannot be modified + by updating the pod spec. In order to add an ephemeral container + to an existing pod, use the pod's ephemeralcontainers subresource. + items: + description: "An EphemeralContainer is a temporary container + that you may add to an existing Pod for user-initiated + activities such as debugging. Ephemeral containers have + no resource or scheduling guarantees, and they will not + be restarted when they exit or when a Pod is removed or + restarted. The kubelet may evict a Pod if an ephemeral + container causes the Pod to exceed its resource allocation. + \n To add an ephemeral container, use the ephemeralcontainers + subresource of an existing Pod. Ephemeral containers may + not be removed or restarted." + properties: + args: + description: 'Arguments to the entrypoint. The image''s + CMD is used if this is not provided. Variable references + $(VAR_NAME) are expanded using the container''s environment. + If a variable cannot be resolved, the reference in + the input string will be unchanged. Double $$ are + reduced to a single $, which allows for escaping the + $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce + the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the + variable exists or not. Cannot be updated. More info: + https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within + a shell. The image''s ENTRYPOINT is used if this is + not provided. Variable references $(VAR_NAME) are + expanded using the container''s environment. If a + variable cannot be resolved, the reference in the + input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) + syntax: i.e. "$$(VAR_NAME)" will produce the string + literal "$(VAR_NAME)". Escaped references will never + be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in + the container. Cannot be updated. + items: + description: EnvVar represents an environment variable + present in a Container. + properties: + name: + description: Name of the environment variable. + Must be a C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) + are expanded using the previously defined environment + variables in the container and any service environment + variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. + Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" + will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults + to "".' + type: string + valueFrom: + description: Source for the environment variable's + value. Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: + supports metadata.name, metadata.namespace, + `metadata.labels['''']`, `metadata.annotations['''']`, + spec.nodeName, spec.serviceAccountName, + status.hostIP, status.podIP, status.podIPs.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, defaults + to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: + only resources limits and requests (limits.cpu, + limits.memory, limits.ephemeral-storage, + requests.cpu, requests.memory and requests.ephemeral-storage) + are currently supported.' + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults to + "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in + the pod's namespace + properties: + key: + description: The key of the secret to + select from. Must be a valid secret + key. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment + variables in the container. The keys defined within + a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is + starting. When a key exists in multiple sources, the + value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of + a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend + to each key in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret must + be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, + IfNotPresent. Defaults to Always if :latest tag is + specified, or IfNotPresent otherwise. Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Lifecycle is not allowed for ephemeral + containers. + properties: + postStart: + description: 'PostStart is called immediately after + a container is created. If the handler fails, + the container is terminated and restarted according + to its restart policy. Other management of the + container blocks until the hook completes. More + info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before + a container is terminated due to an API request + or management event such as liveness/startup probe + failure, preemption, resource contention, etc. + The handler is not called if the container crashes + or exits. The Pod''s termination grace period + countdown begins before the PreStop hook is executed. + Regardless of the outcome of the handler, the + container will eventually terminate within the + Pod''s termination grace period (unless delayed + by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: Probes are not allowed for ephemeral containers. + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the ephemeral container specified + as a DNS_LABEL. This name must be unique among all + containers, init containers and ephemeral containers. + type: string + ports: + description: Ports are not allowed for ephemeral containers. + items: + description: ContainerPort represents a network port + in a single container. + properties: + containerPort: + description: Number of port to expose on the pod's + IP address. This must be a valid port number, + 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external + port to. + type: string + hostPort: + description: Number of port to expose on the host. + If specified, this must be a valid port number, + 0 < x < 65536. If HostNetwork is specified, + this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in + a pod must have a unique name. Name for the + port that can be referred to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, + or SCTP. Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: Probes are not allowed for ephemeral containers. + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource + resize policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this + resource resize policy applies. Supported values: + cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified + resource is resized. If not specified, it defaults + to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: Resources are not allowed for ephemeral + containers. Ephemeral containers use spare resources + already allocated to the pod. + properties: + claims: + description: "Claims lists the names of resources, + defined in spec.resourceClaims, that are used + by this container. \n This is an alpha field and + requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can + only be set for containers." + items: + description: ResourceClaim references one entry + in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one + entry in pod.spec.resourceClaims of the + Pod where this field is used. It makes that + resource available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount + of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount + of compute resources required. If Requests is + omitted for a container, it defaults to Limits + if that is explicitly specified, otherwise to + an implementation-defined value. Requests cannot + exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + securityContext: + description: 'Optional: SecurityContext defines the + security options the ephemeral container should be + run with. If set, the fields of SecurityContext override + the equivalent fields of PodSecurityContext.' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls + whether a process can gain more privileges than + its parent process. This bool directly controls + if the no_new_privs flag will be set on the container + process. AllowPrivilegeEscalation is true always + when the container is: 1) run as Privileged 2) + has CAP_SYS_ADMIN Note that this field cannot + be set when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running + containers. Defaults to the default set of capabilities + granted by the container runtime. Note that this + field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes + in privileged containers are essentially equivalent + to root on the host. Defaults to false. Note that + this field cannot be set when spec.os.name is + windows. + type: boolean + procMount: + description: procMount denotes the type of proc + mount to use for the containers. The default is + DefaultProcMount which uses the container runtime + defaults for readonly paths and masked paths. + This requires the ProcMountType feature flag to + be enabled. Note that this field cannot be set + when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only + root filesystem. Default is false. Note that this + field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the + container process. Uses runtime default if unset. + May also be set in PodSecurityContext. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run + as a non-root user. If true, the Kubelet will + validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start + the container if it does. If unset or false, no + such validation will be performed. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the + container process. Defaults to user specified + in image metadata if unspecified. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. Note that this + field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to + the container. If unspecified, the container runtime + will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + properties: + level: + description: Level is SELinux level label that + applies to the container. + type: string + role: + description: Role is a SELinux role label that + applies to the container. + type: string + type: + description: Type is a SELinux type label that + applies to the container. + type: string + user: + description: User is a SELinux user label that + applies to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this + container. If seccomp options are provided at + both the pod & container level, the container + options override the pod options. Note that this + field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile + defined in a file on the node should be used. + The profile must be preconfigured on the node + to work. Must be a descending path, relative + to the kubelet's configured seccomp profile + location. Must only be set if type is "Localhost". + type: string + type: + description: "type indicates which kind of seccomp + profile will be applied. Valid options are: + \n Localhost - a profile defined in a file + on the node should be used. RuntimeDefault + - the container runtime default profile should + be used. Unconfined - no profile should be + applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied + to all containers. If unspecified, the options + from the PodSecurityContext will be used. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the + GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential + spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name + of the GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container + should be run as a 'Host Process' container. + This field is alpha-level and will only be + honored by components that enable the WindowsHostProcessContainers + feature flag. Setting this field without the + feature flag will result in errors when validating + the Pod. All of a Pod's containers must have + the same effective HostProcess value (it is + not allowed to have a mix of HostProcess containers + and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must + also be set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run + the entrypoint of the container process. Defaults + to the user specified in image metadata if + unspecified. May also be set in PodSecurityContext. + If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes + precedence. + type: string + type: object + type: object + startupProbe: + description: Probes are not allowed for ephemeral containers. + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate + a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will + always result in EOF. Default is false. + type: boolean + stdinOnce: + description: Whether the container runtime should close + the stdin channel after it has been opened by a single + attach. When stdin is true the stdin stream will remain + open across multiple attach sessions. If stdinOnce + is set to true, stdin is opened on container start, + is empty until the first client attaches to stdin, + and then remains open and accepts data until the client + disconnects, at which time stdin is closed and remains + closed until the container is restarted. If this flag + is false, a container processes that reads from stdin + will never receive an EOF. Default is false + type: boolean + targetContainerName: + description: "If set, the name of the container from + PodSpec that this ephemeral container targets. The + ephemeral container will be run in the namespaces + (IPC, PID, etc) of this container. If not set then + the ephemeral container uses the namespaces configured + in the Pod spec. \n The container runtime must implement + support for this feature. If the runtime does not + support namespace targeting then the result of setting + this field is undefined." + type: string + terminationMessagePath: + description: 'Optional: Path at which the file to which + the container''s termination message will be written + is mounted into the container''s filesystem. Message + written is intended to be brief final status, such + as an assertion failure message. Will be truncated + by the node if greater than 4096 bytes. The total + message length across all containers will be limited + to 12kb. Defaults to /dev/termination-log. Cannot + be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should + be populated. File will use the contents of terminationMessagePath + to populate the container status message on both success + and failure. FallbackToLogsOnError will use the last + chunk of container log output if the termination message + file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, + whichever is smaller. Defaults to File. Cannot be + updated. + type: string + tty: + description: Whether this container should allocate + a TTY for itself, also requires 'stdin' to be true. + Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices + to be used by the container. + items: + description: volumeDevice describes a mapping of a + raw block device within a container. + properties: + devicePath: + description: devicePath is the path inside of + the container that the device will be mapped + to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's + filesystem. Subpath mounts are not allowed for ephemeral + containers. Cannot be updated. + items: + description: VolumeMount describes a mounting of a + Volume within a container. + properties: + mountPath: + description: Path within the container at which + the volume should be mounted. Must not contain + ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts + are propagated from the host to container and + the other way around. When not set, MountPropagationNone + is used. This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write + otherwise (false or unspecified). Defaults to + false. + type: boolean + subPath: + description: Path within the volume from which + the container's volume should be mounted. Defaults + to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from + which the container's volume should be mounted. + Behaves similarly to SubPath but environment + variable references $(VAR_NAME) are expanded + using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath + are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which + might be configured in the container image. Cannot + be updated. + type: string + required: + - name + type: object + type: array + hostAliases: + description: HostAliases is an optional list of hosts and + IPs that will be injected into the pod's hosts file if specified. + This is only valid for non-hostNetwork pods. + items: + description: HostAlias holds the mapping between IP and + hostnames that will be injected as an entry in the pod's + hosts file. + properties: + hostnames: + description: Hostnames for the above IP address. + items: + type: string + type: array + ip: + description: IP address of the host file entry. + type: string + type: object + type: array + hostIPC: + description: 'Use the host''s ipc namespace. Optional: Default + to false.' + type: boolean + hostNetwork: + description: Host networking requested for this pod. Use the + host's network namespace. If this option is set, the ports + that will be used must be specified. Default to false. + type: boolean + hostPID: + description: 'Use the host''s pid namespace. Optional: Default + to false.' + type: boolean + hostUsers: + description: 'Use the host''s user namespace. Optional: Default + to true. If set to true or not present, the pod will be + run in the host user namespace, useful for when the pod + needs a feature only available to the host user namespace, + such as loading a kernel module with CAP_SYS_MODULE. When + set to false, a new userns is created for the pod. Setting + false is useful for mitigating container breakout vulnerabilities + even allowing users to run their containers as root without + actually having root privileges on the host. This field + is alpha-level and is only honored by servers that enable + the UserNamespacesSupport feature.' + type: boolean + hostname: + description: Specifies the hostname of the Pod If not specified, + the pod's hostname will be set to a system-defined value. + type: string + imagePullSecrets: + description: 'ImagePullSecrets is an optional list of references + to secrets in the same namespace to use for pulling any + of the images used by this PodSpec. If specified, these + secrets will be passed to individual puller implementations + for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod' + items: + description: LocalObjectReference contains enough information + to let you locate the referenced object inside the same + namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array + initContainers: + description: 'List of initialization containers belonging + to the pod. Init containers are executed in order prior + to containers being started. If any init container fails, + the pod is considered to have failed and is handled according + to its restartPolicy. The name for an init container or + normal container must be unique among all containers. Init + containers may not have Lifecycle actions, Readiness probes, + Liveness probes, or Startup probes. The resourceRequirements + of an init container are taken into account during scheduling + by finding the highest request/limit for each resource type, + and then using the max of of that value or the sum of the + normal containers. Limits are applied to init containers + in a similar fashion. Init containers cannot currently be + added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/' + items: + description: A single application container that you want + to run within a pod. + properties: + args: + description: 'Arguments to the entrypoint. The container + image''s CMD is used if this is not provided. Variable + references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the + reference in the input string will be unchanged. Double + $$ are reduced to a single $, which allows for escaping + the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce + the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the + variable exists or not. Cannot be updated. More info: + https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within + a shell. The container image''s ENTRYPOINT is used + if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If + a variable cannot be resolved, the reference in the + input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) + syntax: i.e. "$$(VAR_NAME)" will produce the string + literal "$(VAR_NAME)". Escaped references will never + be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in + the container. Cannot be updated. + items: + description: EnvVar represents an environment variable + present in a Container. + properties: + name: + description: Name of the environment variable. + Must be a C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) + are expanded using the previously defined environment + variables in the container and any service environment + variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. + Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" + will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults + to "".' + type: string + valueFrom: + description: Source for the environment variable's + value. Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: + supports metadata.name, metadata.namespace, + `metadata.labels['''']`, `metadata.annotations['''']`, + spec.nodeName, spec.serviceAccountName, + status.hostIP, status.podIP, status.podIPs.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, defaults + to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: + only resources limits and requests (limits.cpu, + limits.memory, limits.ephemeral-storage, + requests.cpu, requests.memory and requests.ephemeral-storage) + are currently supported.' + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults to + "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in + the pod's namespace + properties: + key: + description: The key of the secret to + select from. Must be a valid secret + key. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment + variables in the container. The keys defined within + a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is + starting. When a key exists in multiple sources, the + value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of + a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap + must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend + to each key in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret must + be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config + management to default or override container images + in workload controllers like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, + IfNotPresent. Defaults to Always if :latest tag is + specified, or IfNotPresent otherwise. Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should + take in response to container lifecycle events. Cannot + be updated. + properties: + postStart: + description: 'PostStart is called immediately after + a container is created. If the handler fails, + the container is terminated and restarted according + to its restart policy. Other management of the + container blocks until the hook completes. More + info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before + a container is terminated due to an API request + or management event such as liveness/startup probe + failure, preemption, resource contention, etc. + The handler is not called if the container crashes + or exits. The Pod''s termination grace period + countdown begins before the PreStop hook is executed. + Regardless of the outcome of the handler, the + container will eventually terminate within the + Pod''s termination grace period (unless delayed + by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line + to execute inside the container, the working + directory for the command is root ('/') + in the container's filesystem. The command + is simply exec'd, it is not run inside + a shell, so traditional shell instructions + ('|', etc) won't work. To use a shell, + you need to explicitly call out to that + shell. Exit status of 0 is treated as + live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the + request. HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. + This will be canonicalized upon + output, so case-variant names will + be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP + server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting + to the host. Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported + as a LifecycleHandler and kept for the backward + compatibility. There are no validation of + this field and lifecycle hooks will fail in + runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port + to access on the container. Number must + be in the range 1 to 65535. Name must + be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. + Container will be restarted if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. + Each container in a pod must have a unique name (DNS_LABEL). + Cannot be updated. + type: string + ports: + description: List of ports to expose from the container. + Not specifying a port here DOES NOT prevent that port + from being exposed. Any port which is listening on + the default "0.0.0.0" address inside a container will + be accessible from the network. Modifying this array + with strategic merge patch may corrupt the data. For + more information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port + in a single container. + properties: + containerPort: + description: Number of port to expose on the pod's + IP address. This must be a valid port number, + 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external + port to. + type: string + hostPort: + description: Number of port to expose on the host. + If specified, this must be a valid port number, + 0 < x < 65536. If HostNetwork is specified, + this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in + a pod must have a unique name. Name for the + port that can be referred to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, + or SCTP. Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. + Container will be removed from service endpoints if + the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource + resize policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this + resource resize policy applies. Supported values: + cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified + resource is resized. If not specified, it defaults + to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. + Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, + defined in spec.resourceClaims, that are used + by this container. \n This is an alpha field and + requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can + only be set for containers." + items: + description: ResourceClaim references one entry + in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one + entry in pod.spec.resourceClaims of the + Pod where this field is used. It makes that + resource available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount + of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount + of compute resources required. If Requests is + omitted for a container, it defaults to Limits + if that is explicitly specified, otherwise to + an implementation-defined value. Requests cannot + exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + securityContext: + description: 'SecurityContext defines the security options + the container should be run with. If set, the fields + of SecurityContext override the equivalent fields + of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls + whether a process can gain more privileges than + its parent process. This bool directly controls + if the no_new_privs flag will be set on the container + process. AllowPrivilegeEscalation is true always + when the container is: 1) run as Privileged 2) + has CAP_SYS_ADMIN Note that this field cannot + be set when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running + containers. Defaults to the default set of capabilities + granted by the container runtime. Note that this + field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes + in privileged containers are essentially equivalent + to root on the host. Defaults to false. Note that + this field cannot be set when spec.os.name is + windows. + type: boolean + procMount: + description: procMount denotes the type of proc + mount to use for the containers. The default is + DefaultProcMount which uses the container runtime + defaults for readonly paths and masked paths. + This requires the ProcMountType feature flag to + be enabled. Note that this field cannot be set + when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only + root filesystem. Default is false. Note that this + field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the + container process. Uses runtime default if unset. + May also be set in PodSecurityContext. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run + as a non-root user. If true, the Kubelet will + validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start + the container if it does. If unset or false, no + such validation will be performed. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the + container process. Defaults to user specified + in image metadata if unspecified. May also be + set in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in + SecurityContext takes precedence. Note that this + field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to + the container. If unspecified, the container runtime + will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is windows. + properties: + level: + description: Level is SELinux level label that + applies to the container. + type: string + role: + description: Role is a SELinux role label that + applies to the container. + type: string + type: + description: Type is a SELinux type label that + applies to the container. + type: string + user: + description: User is a SELinux user label that + applies to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this + container. If seccomp options are provided at + both the pod & container level, the container + options override the pod options. Note that this + field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile + defined in a file on the node should be used. + The profile must be preconfigured on the node + to work. Must be a descending path, relative + to the kubelet's configured seccomp profile + location. Must only be set if type is "Localhost". + type: string + type: + description: "type indicates which kind of seccomp + profile will be applied. Valid options are: + \n Localhost - a profile defined in a file + on the node should be used. RuntimeDefault + - the container runtime default profile should + be used. Unconfined - no profile should be + applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied + to all containers. If unspecified, the options + from the PodSecurityContext will be used. If set + in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name + is linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the + GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential + spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name + of the GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container + should be run as a 'Host Process' container. + This field is alpha-level and will only be + honored by components that enable the WindowsHostProcessContainers + feature flag. Setting this field without the + feature flag will result in errors when validating + the Pod. All of a Pod's containers must have + the same effective HostProcess value (it is + not allowed to have a mix of HostProcess containers + and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must + also be set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run + the entrypoint of the container process. Defaults + to the user specified in image metadata if + unspecified. May also be set in PodSecurityContext. + If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes + precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has + successfully initialized. If specified, no other probes + are executed until this completes successfully. If + this probe fails, the Pod will be restarted, just + as if the livenessProbe failed. This can be used to + provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time + to load data or warm a cache, than during steady-state + operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to + execute inside the container, the working + directory for the command is root ('/') in + the container's filesystem. The command is + simply exec'd, it is not run inside a shell, + so traditional shell instructions ('|', etc) + won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is + treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the + probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving + a GRPC port. + properties: + port: + description: Port number of the gRPC service. + Number must be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service + to place in the gRPC HealthCheckRequest (see + https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior + is defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request + to perform. + properties: + host: + description: Host name to connect to, defaults + to the pod IP. You probably want to set "Host" + in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom + header to be used in HTTP probes + properties: + name: + description: The header field name. This + will be canonicalized upon output, so + case-variant names will be understood + as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to + the host. Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container + has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the + probe. Default to 10 seconds. Minimum value is + 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the + probe to be considered successful after having + failed. Defaults to 1. Must be 1 for liveness + and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving + a TCP port. + properties: + host: + description: 'Optional: Host name to connect + to, defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod + needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after + the processes running in the pod are sent a termination + signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer + than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides + the value provided by the pod spec. Value must + be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity + to shut down). This is a beta field and requires + enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds + is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the + probe times out. Defaults to 1 second. Minimum + value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate + a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will + always result in EOF. Default is false. + type: boolean + stdinOnce: + description: Whether the container runtime should close + the stdin channel after it has been opened by a single + attach. When stdin is true the stdin stream will remain + open across multiple attach sessions. If stdinOnce + is set to true, stdin is opened on container start, + is empty until the first client attaches to stdin, + and then remains open and accepts data until the client + disconnects, at which time stdin is closed and remains + closed until the container is restarted. If this flag + is false, a container processes that reads from stdin + will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which + the container''s termination message will be written + is mounted into the container''s filesystem. Message + written is intended to be brief final status, such + as an assertion failure message. Will be truncated + by the node if greater than 4096 bytes. The total + message length across all containers will be limited + to 12kb. Defaults to /dev/termination-log. Cannot + be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should + be populated. File will use the contents of terminationMessagePath + to populate the container status message on both success + and failure. FallbackToLogsOnError will use the last + chunk of container log output if the termination message + file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, + whichever is smaller. Defaults to File. Cannot be + updated. + type: string + tty: + description: Whether this container should allocate + a TTY for itself, also requires 'stdin' to be true. + Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices + to be used by the container. + items: + description: volumeDevice describes a mapping of a + raw block device within a container. + properties: + devicePath: + description: devicePath is the path inside of + the container that the device will be mapped + to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's + filesystem. Cannot be updated. + items: + description: VolumeMount describes a mounting of a + Volume within a container. + properties: + mountPath: + description: Path within the container at which + the volume should be mounted. Must not contain + ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts + are propagated from the host to container and + the other way around. When not set, MountPropagationNone + is used. This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write + otherwise (false or unspecified). Defaults to + false. + type: boolean + subPath: + description: Path within the volume from which + the container's volume should be mounted. Defaults + to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from + which the container's volume should be mounted. + Behaves similarly to SubPath but environment + variable references $(VAR_NAME) are expanded + using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath + are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which + might be configured in the container image. Cannot + be updated. + type: string + required: + - name + type: object + type: array + nodeName: + description: NodeName is a request to schedule this pod onto + a specific node. If it is non-empty, the scheduler simply + schedules this pod onto that node, assuming that it fits + resource requirements. + type: string + nodeSelector: + additionalProperties: + type: string + description: 'NodeSelector is a selector which must be true + for the pod to fit on a node. Selector which must match + a node''s labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + type: object + x-kubernetes-map-type: atomic + os: + description: "Specifies the OS of the containers in the pod. + Some pod and container fields are restricted if this is + set. \n If the OS field is set to linux, the following fields + must be unset: -securityContext.windowsOptions \n If the + OS field is set to windows, following fields must be unset: + - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.seLinuxOptions + - spec.securityContext.seccompProfile - spec.securityContext.fsGroup + - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls + - spec.shareProcessNamespace - spec.securityContext.runAsUser + - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups + - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile + - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem + - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation + - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser + - spec.containers[*].securityContext.runAsGroup" + properties: + name: + description: 'Name is the name of the operating system. + The currently supported values are linux and windows. + Additional value may be defined in future and can be + one of: https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration + Clients should expect to handle additional values and + treat unrecognized values in this field as os: null' + type: string + required: + - name + type: object + overhead: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Overhead represents the resource overhead associated + with running a pod for a given RuntimeClass. This field + will be autopopulated at admission time by the RuntimeClass + admission controller. If the RuntimeClass admission controller + is enabled, overhead must not be set in Pod create requests. + The RuntimeClass admission controller will reject Pod create + requests which have the overhead already set. If RuntimeClass + is configured and selected in the PodSpec, Overhead will + be set to the value defined in the corresponding RuntimeClass, + otherwise it will remain unset and treated as zero. More + info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md' + type: object + preemptionPolicy: + description: PreemptionPolicy is the Policy for preempting + pods with lower priority. One of Never, PreemptLowerPriority. + Defaults to PreemptLowerPriority if unset. + type: string + priority: + description: The priority value. Various system components + use this field to find the priority of the pod. When Priority + Admission Controller is enabled, it prevents users from + setting this field. The admission controller populates this + field from PriorityClassName. The higher the value, the + higher the priority. + format: int32 + type: integer + priorityClassName: + description: If specified, indicates the pod's priority. "system-node-critical" + and "system-cluster-critical" are two special keywords which + indicate the highest priorities with the former being the + highest priority. Any other name must be defined by creating + a PriorityClass object with that name. If not specified, + the pod priority will be default or zero if there is no + default. + type: string + readinessGates: + description: 'If specified, all readiness gates will be evaluated + for pod readiness. A pod is ready when all its containers + are ready AND all conditions specified in the readiness + gates have status equal to "True" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates' + items: + description: PodReadinessGate contains the reference to + a pod condition + properties: + conditionType: + description: ConditionType refers to a condition in + the pod's condition list with matching type. + type: string + required: + - conditionType + type: object + type: array + resourceClaims: + description: "ResourceClaims defines which ResourceClaims + must be allocated and reserved before the Pod is allowed + to start. The resources will be made available to those + containers which consume them by name. \n This is an alpha + field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable." + items: + description: PodResourceClaim references exactly one ResourceClaim + through a ClaimSource. It adds a name to it that uniquely + identifies the ResourceClaim inside the Pod. Containers + that need access to the ResourceClaim reference it with + this name. + properties: + name: + description: Name uniquely identifies this resource + claim inside the pod. This must be a DNS_LABEL. + type: string + source: + description: Source describes where to find the ResourceClaim. + properties: + resourceClaimName: + description: ResourceClaimName is the name of a + ResourceClaim object in the same namespace as + this pod. + type: string + resourceClaimTemplateName: + description: "ResourceClaimTemplateName is the name + of a ResourceClaimTemplate object in the same + namespace as this pod. \n The template will be + used to create a new ResourceClaim, which will + be bound to this pod. When this pod is deleted, + the ResourceClaim will also be deleted. The name + of the ResourceClaim will be -, where is the PodResourceClaim.Name. + Pod validation will reject the pod if the concatenated + name is not valid for a ResourceClaim (e.g. too + long). \n An existing ResourceClaim with that + name that is not owned by the pod will not be + used for the pod to avoid using an unrelated resource + by mistake. Scheduling and pod startup are then + blocked until the unrelated ResourceClaim is removed. + \n This field is immutable and no changes will + be made to the corresponding ResourceClaim by + the control plane after creating the ResourceClaim." + type: string + type: object + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + restartPolicy: + description: 'Restart policy for all containers within the + pod. One of Always, OnFailure, Never. In some contexts, + only a subset of those values may be permitted. Default + to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy' + type: string + runtimeClassName: + description: 'RuntimeClassName refers to a RuntimeClass object + in the node.k8s.io group, which should be used to run this + pod. If no RuntimeClass resource matches the named class, + the pod will not be run. If unset or empty, the "legacy" + RuntimeClass will be used, which is an implicit class with + an empty definition that uses the default runtime handler. + More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class' + type: string + schedulerName: + description: If specified, the pod will be dispatched by specified + scheduler. If not specified, the pod will be dispatched + by default scheduler. + type: string + schedulingGates: + description: "SchedulingGates is an opaque list of values + that if specified will block scheduling the pod. If schedulingGates + is not empty, the pod will stay in the SchedulingGated state + and the scheduler will not attempt to schedule the pod. + \n SchedulingGates can only be set at pod creation time, + and be removed only afterwards. \n This is a beta feature + enabled by the PodSchedulingReadiness feature gate." + items: + description: PodSchedulingGate is associated to a Pod to + guard its scheduling. + properties: + name: + description: Name of the scheduling gate. Each scheduling + gate must have a unique name field. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + securityContext: + description: 'SecurityContext holds pod-level security attributes + and common container settings. Optional: Defaults to empty. See + type description for default values of each field.' + properties: + fsGroup: + description: "A special supplemental group that applies + to all containers in a pod. Some volume types allow + the Kubelet to change the ownership of that volume to + be owned by the pod: \n 1. The owning GID will be the + FSGroup 2. The setgid bit is set (new files created + in the volume will be owned by FSGroup) 3. The permission + bits are OR'd with rw-rw---- \n If unset, the Kubelet + will not modify the ownership and permissions of any + volume. Note that this field cannot be set when spec.os.name + is windows." + format: int64 + type: integer + fsGroupChangePolicy: + description: 'fsGroupChangePolicy defines behavior of + changing ownership and permission of the volume before + being exposed inside Pod. This field will only apply + to volume types which support fsGroup based ownership(and + permissions). It will have no effect on ephemeral volume + types such as: secret, configmaps and emptydir. Valid + values are "OnRootMismatch" and "Always". If not specified, + "Always" is used. Note that this field cannot be set + when spec.os.name is windows.' + type: string + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be + set in SecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in SecurityContext + takes precedence for that container. Note that this + field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as + a non-root user. If true, the Kubelet will validate + the image at runtime to ensure that it does not run + as UID 0 (root) and fail to start the container if it + does. If unset or false, no such validation will be + performed. May also be set in SecurityContext. If set + in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata + if unspecified. May also be set in SecurityContext. If + set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence + for that container. Note that this field cannot be set + when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to all + containers. If unspecified, the container runtime will + allocate a random SELinux context for each container. May + also be set in SecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in SecurityContext + takes precedence for that container. Note that this + field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by the containers + in this pod. Note that this field cannot be set when + spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile + defined in a file on the node should be used. The + profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's + configured seccomp profile location. Must only be + set if type is "Localhost". + type: string + type: + description: "type indicates which kind of seccomp + profile will be applied. Valid options are: \n Localhost + - a profile defined in a file on the node should + be used. RuntimeDefault - the container runtime + default profile should be used. Unconfined - no + profile should be applied." + type: string + required: + - type + type: object + supplementalGroups: + description: A list of groups applied to the first process + run in each container, in addition to the container's + primary GID, the fsGroup (if specified), and group memberships + defined in the container image for the uid of the container + process. If unspecified, no additional groups are added + to any container. Note that group memberships defined + in the container image for the uid of the container + process are still effective, even if they are not included + in this list. Note that this field cannot be set when + spec.os.name is windows. + items: + format: int64 + type: integer + type: array + sysctls: + description: Sysctls hold a list of namespaced sysctls + used for the pod. Pods with unsupported sysctls (by + the container runtime) might fail to launch. Note that + this field cannot be set when spec.os.name is windows. + items: + description: Sysctl defines a kernel parameter to be + set + properties: + name: + description: Name of a property to set + type: string + value: + description: Value of a property to set + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + description: The Windows specific settings applied to + all containers. If unspecified, the options within a + container's SecurityContext will be used. If set in + both SecurityContext and PodSecurityContext, the value + specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA + admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec + named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of + the GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container + should be run as a 'Host Process' container. This + field is alpha-level and will only be honored by + components that enable the WindowsHostProcessContainers + feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. + All of a Pod's containers must have the same effective + HostProcess value (it is not allowed to have a mix + of HostProcess containers and non-HostProcess containers). In + addition, if HostProcess is true then HostNetwork + must also be set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set + in PodSecurityContext. If set in both SecurityContext + and PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + serviceAccount: + description: 'DeprecatedServiceAccount is a depreciated alias + for ServiceAccountName. Deprecated: Use serviceAccountName + instead.' + type: string + serviceAccountName: + description: 'ServiceAccountName is the name of the ServiceAccount + to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/' + type: string + setHostnameAsFQDN: + description: If true the pod's hostname will be configured + as the pod's FQDN, rather than the leaf name (the default). + In Linux containers, this means setting the FQDN in the + hostname field of the kernel (the nodename field of struct + utsname). In Windows containers, this means setting the + registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters + to FQDN. If a pod does not have FQDN, this has no effect. + Default to false. + type: boolean + shareProcessNamespace: + description: 'Share a single process namespace between all + of the containers in a pod. When this is set containers + will be able to view and signal processes from other containers + in the same pod, and the first process in each container + will not be assigned PID 1. HostPID and ShareProcessNamespace + cannot both be set. Optional: Default to false.' + type: boolean + subdomain: + description: If specified, the fully qualified Pod hostname + will be "...svc.". If not specified, the pod will not have a domainname + at all. + type: string + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully. May be decreased in delete request. + Value must be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity to + shut down). If this value is nil, the default grace period + will be used instead. The grace period is the duration in + seconds after the processes running in the pod are sent + a termination signal and the time when the processes are + forcibly halted with a kill signal. Set this value longer + than the expected cleanup time for your process. Defaults + to 30 seconds. + format: int64 + type: integer + tolerations: + description: If specified, the pod's tolerations. + items: + description: The pod this Toleration is attached to tolerates + any taint that matches the triple using + the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. + Empty means match all taint effects. When specified, + allowed values are NoSchedule, PreferNoSchedule and + NoExecute. + type: string + key: + description: Key is the taint key that the toleration + applies to. Empty means match all taint keys. If the + key is empty, operator must be Exists; this combination + means to match all values and all keys. + type: string + operator: + description: Operator represents a key's relationship + to the value. Valid operators are Exists and Equal. + Defaults to Equal. Exists is equivalent to wildcard + for value, so that a pod can tolerate all taints of + a particular category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period + of time the toleration (which must be of effect NoExecute, + otherwise this field is ignored) tolerates the taint. + By default, it is not set, which means tolerate the + taint forever (do not evict). Zero and negative values + will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration + matches to. If the operator is Exists, the value should + be empty, otherwise just a regular string. + type: string + type: object + type: array + topologySpreadConstraints: + description: TopologySpreadConstraints describes how a group + of pods ought to spread across topology domains. Scheduler + will schedule pods in a way which abides by the constraints. + All topologySpreadConstraints are ANDed. + items: + description: TopologySpreadConstraint specifies how to spread + matching pods among the given topology. + properties: + labelSelector: + description: LabelSelector is used to find matching + pods. Pods that match this label selector are counted + to determine the number of pods in their corresponding + topology domain. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: "MatchLabelKeys is a set of pod label keys + to select the pods over which spreading will be calculated. + The keys are used to lookup values from the incoming + pod labels, those key-value labels are ANDed with + labelSelector to select the group of existing pods + over which spreading will be calculated for the incoming + pod. The same key is forbidden to exist in both MatchLabelKeys + and LabelSelector. MatchLabelKeys cannot be set when + LabelSelector isn't set. Keys that don't exist in + the incoming pod labels will be ignored. A null or + empty list means only match against labelSelector. + \n This is a beta field and requires the MatchLabelKeysInPodTopologySpread + feature gate to be enabled (enabled by default)." + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + description: 'MaxSkew describes the degree to which + pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, + it is the maximum permitted difference between the + number of matching pods in the target topology and + the global minimum. The global minimum is the minimum + number of matching pods in an eligible domain or zero + if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to + 1, and pods with the same labelSelector spread as + 2/2/1: In this case, the global minimum is 1. | zone1 + | zone2 | zone3 | | P P | P P | P | - if MaxSkew + is 1, incoming pod can only be scheduled to zone3 + to become 2/2/2; scheduling it onto zone1(zone2) would + make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto + any zone. When `whenUnsatisfiable=ScheduleAnyway`, + it is used to give higher precedence to topologies + that satisfy it. It''s a required field. Default value + is 1 and 0 is not allowed.' + format: int32 + type: integer + minDomains: + description: "MinDomains indicates a minimum number + of eligible domains. When the number of eligible domains + with matching topology keys is less than minDomains, + Pod Topology Spread treats \"global minimum\" as 0, + and then the calculation of Skew is performed. And + when the number of eligible domains with matching + topology keys equals or greater than minDomains, this + value has no effect on scheduling. As a result, when + the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to + those domains. If value is nil, the constraint behaves + as if MinDomains is equal to 1. Valid values are integers + greater than 0. When value is not nil, WhenUnsatisfiable + must be DoNotSchedule. \n For example, in a 3-zone + cluster, MaxSkew is set to 2, MinDomains is set to + 5 and pods with the same labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | | P P | P P | P P | + The number of domains is less than 5(MinDomains), + so \"global minimum\" is treated as 0. In this situation, + new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod + is scheduled to any of the three zones, it will violate + MaxSkew. \n This is a beta field and requires the + MinDomainsInPodTopologySpread feature gate to be enabled + (enabled by default)." + format: int32 + type: integer + nodeAffinityPolicy: + description: "NodeAffinityPolicy indicates how we will + treat Pod's nodeAffinity/nodeSelector when calculating + pod topology spread skew. Options are: - Honor: only + nodes matching nodeAffinity/nodeSelector are included + in the calculations. - Ignore: nodeAffinity/nodeSelector + are ignored. All nodes are included in the calculations. + \n If this value is nil, the behavior is equivalent + to the Honor policy. This is a beta-level feature + default enabled by the NodeInclusionPolicyInPodTopologySpread + feature flag." + type: string + nodeTaintsPolicy: + description: "NodeTaintsPolicy indicates how we will + treat node taints when calculating pod topology spread + skew. Options are: - Honor: nodes without taints, + along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints + are ignored. All nodes are included. \n If this value + is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the + NodeInclusionPolicyInPodTopologySpread feature flag." + type: string + topologyKey: + description: TopologyKey is the key of node labels. + Nodes that have a label with this key and identical + values are considered to be in the same topology. + We consider each as a "bucket", and try + to put balanced number of pods into each bucket. We + define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose + nodes meet the requirements of nodeAffinityPolicy + and nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", + each Node is a domain of that topology. And, if TopologyKey + is "topology.kubernetes.io/zone", each zone is a domain + of that topology. It's a required field. + type: string + whenUnsatisfiable: + description: 'WhenUnsatisfiable indicates how to deal + with a pod if it doesn''t satisfy the spread constraint. + - DoNotSchedule (default) tells the scheduler not + to schedule it. - ScheduleAnyway tells the scheduler + to schedule the pod in any location, but giving higher + precedence to topologies that would help reduce the + skew. A constraint is considered "Unsatisfiable" for + an incoming pod if and only if every possible node + assignment for that pod would violate "MaxSkew" on + some topology. For example, in a 3-zone cluster, MaxSkew + is set to 1, and pods with the same labelSelector + spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P + | P | P | If WhenUnsatisfiable is set to DoNotSchedule, + incoming pod can only be scheduled to zone2(zone3) + to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) + satisfies MaxSkew(1). In other words, the cluster + can still be imbalanced, but scheduler won''t make + it *more* imbalanced. It''s a required field.' + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + - whenUnsatisfiable + x-kubernetes-list-type: map + volumes: + description: 'List of volumes that can be mounted by containers + belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes' + items: + description: Volume represents a named volume in a pod that + may be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: 'awsElasticBlockStore represents an AWS + Disk resource that is attached to a kubelet''s host + machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + properties: + fsType: + description: 'fsType is the filesystem type of the + volume that you want to mount. Tip: Ensure that + the filesystem type is supported by the host operating + system. Examples: "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. More info: + https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + TODO: how do we prevent errors in the filesystem + from compromising the machine' + type: string + partition: + description: 'partition is the partition in the + volume that you want to mount. If omitted, the + default is to mount by volume name. Examples: + For volume /dev/sda1, you specify the partition + as "1". Similarly, the volume partition for /dev/sda + is "0" (or you can leave the property empty).' + format: int32 + type: integer + readOnly: + description: 'readOnly value true will force the + readOnly setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + type: boolean + volumeID: + description: 'volumeID is unique ID of the persistent + disk resource in AWS (Amazon EBS volume). More + info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + type: string + required: + - volumeID + type: object + azureDisk: + description: azureDisk represents an Azure Data Disk + mount on the host and bind mount to the pod. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: + None, Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk + in the blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in + the blob storage + type: string + fsType: + description: fsType is Filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single + blob disk per storage account Managed: azure + managed data disk (only in managed availability + set). defaults to shared' + type: string + readOnly: + description: readOnly Defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: azureFile represents an Azure File Service + mount on the host and bind mount to the pod. + properties: + readOnly: + description: readOnly defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that + contains Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: cephFS represents a Ceph FS mount on the + host that shares a pod's lifetime + properties: + monitors: + description: 'monitors is Required: Monitors is + a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + items: + type: string + type: array + path: + description: 'path is Optional: Used as the mounted + root, rather than the full Ceph tree, default + is /' + type: string + readOnly: + description: 'readOnly is Optional: Defaults to + false (read/write). ReadOnly here will force the + ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: boolean + secretFile: + description: 'secretFile is Optional: SecretFile + is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: string + secretRef: + description: 'secretRef is Optional: SecretRef is + reference to the authentication secret for User, + default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: 'user is optional: User is the rados + user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: string + required: + - monitors + type: object + cinder: + description: 'cinder represents a cinder volume attached + and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + properties: + fsType: + description: 'fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Examples: "ext4", "xfs", "ntfs". + Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: string + readOnly: + description: 'readOnly defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: boolean + secretRef: + description: 'secretRef is optional: points to a + secret object containing parameters used to connect + to OpenStack.' + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: 'volumeID used to identify the volume + in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should + populate this volume + properties: + defaultMode: + description: 'defaultMode is optional: mode bits + used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or + a decimal value between 0 and 511. YAML accepts + both octal and decimal values, JSON requires decimal + values for mode bits. Defaults to 0644. Directories + within the path are not affected by this setting. + This might be in conflict with other options that + affect the file mode, like fsGroup, and the result + can be other mode bits set.' + format: int32 + type: integer + items: + description: items if unspecified, each key-value + pair in the Data field of the referenced ConfigMap + will be projected into the volume as a file whose + name is the key and content is the value. If specified, + the listed keys will be projected into the specified + paths, and unlisted keys will not be present. + If a key is specified which is not present in + the ConfigMap, the volume setup will error unless + it is marked optional. Paths must be relative + and may not contain the '..' path or start with + '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: mode bits + used to set permissions on this file. Must + be an octal value between 0000 and 0777 + or a decimal value between 0 and 511. YAML + accepts both octal and decimal values, JSON + requires decimal values for mode bits. If + not specified, the volume defaultMode will + be used. This might be in conflict with + other options that affect the file mode, + like fsGroup, and the result can be other + mode bits set.' + format: int32 + type: integer + path: + description: path is the relative path of + the file to map the key to. May not be an + absolute path. May not contain the path + element '..'. May not start with the string + '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents + ephemeral storage that is handled by certain external + CSI drivers (Beta feature). + properties: + driver: + description: driver is the name of the CSI driver + that handles this volume. Consult with your admin + for the correct name as registered in the cluster. + type: string + fsType: + description: fsType to mount. Ex. "ext4", "xfs", + "ntfs". If not provided, the empty value is passed + to the associated CSI driver which will determine + the default filesystem to apply. + type: string + nodePublishSecretRef: + description: nodePublishSecretRef is a reference + to the secret object containing sensitive information + to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no + secret is required. If the secret object contains + more than one secret, all secret references are + passed. + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: readOnly specifies a read-only configuration + for the volume. Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: volumeAttributes stores driver-specific + properties that are passed to the CSI driver. + Consult your driver's documentation for supported + values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about + the pod that should populate this volume + properties: + defaultMode: + description: 'Optional: mode bits to use on created + files by default. Must be a Optional: mode bits + used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or + a decimal value between 0 and 511. YAML accepts + both octal and decimal values, JSON requires decimal + values for mode bits. Defaults to 0644. Directories + within the path are not affected by this setting. + This might be in conflict with other options that + affect the file mode, like fsGroup, and the result + can be other mode bits set.' + format: int32 + type: integer + items: + description: Items is a list of downward API volume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing the + pod field + properties: + fieldRef: + description: 'Required: Selects a field of + the pod: only annotations, labels, name + and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, defaults + to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: 'Optional: mode bits used to + set permissions on this file, must be an + octal value between 0000 and 0777 or a decimal + value between 0 and 511. YAML accepts both + octal and decimal values, JSON requires + decimal values for mode bits. If not specified, + the volume defaultMode will be used. This + might be in conflict with other options + that affect the file mode, like fsGroup, + and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must + not be absolute or contain the ''..'' path. + Must be utf-8 encoded. The first item of + the relative path must not start with ''..''' + type: string + resourceFieldRef: + description: 'Selects a resource of the container: + only resources limits and requests (limits.cpu, + limits.memory, requests.cpu and requests.memory) + are currently supported.' + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults to + "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + description: 'emptyDir represents a temporary directory + that shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + properties: + medium: + description: 'medium represents what type of storage + medium should back this directory. The default + is "" which means to use the node''s default medium. + Must be an empty string (default) or Memory. More + info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: 'sizeLimit is the total amount of local + storage required for this EmptyDir volume. The + size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would + be the minimum value between the SizeLimit specified + here and the sum of memory limits of all containers + in a pod. The default is nil which means that + the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: "ephemeral represents a volume that is + handled by a cluster storage driver. The volume's + lifecycle is tied to the pod that defines it - it + will be created before the pod starts, and deleted + when the pod is removed. \n Use this if: a) the volume + is only needed while the pod runs, b) features of + normal volumes like restoring from snapshot or capacity + tracking are needed, c) the storage driver is specified + through a storage class, and d) the storage driver + supports dynamic volume provisioning through a PersistentVolumeClaim + (see EphemeralVolumeSource for more information on + the connection between this volume type and PersistentVolumeClaim). + \n Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the + lifecycle of an individual pod. \n Use CSI for light-weight + local ephemeral volumes if the CSI driver is meant + to be used that way - see the documentation of the + driver for more information. \n A pod can use both + types of ephemeral volumes and persistent volumes + at the same time." + properties: + volumeClaimTemplate: + description: "Will be used to create a stand-alone + PVC to provision the volume. The pod in which + this EphemeralVolumeSource is embedded will be + the owner of the PVC, i.e. the PVC will be deleted + together with the pod. The name of the PVC will + be `-` where `` + is the name from the `PodSpec.Volumes` array entry. + Pod validation will reject the pod if the concatenated + name is not valid for a PVC (for example, too + long). \n An existing PVC with that name that + is not owned by the pod will *not* be used for + the pod to avoid using an unrelated volume by + mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created + PVC is meant to be used by the pod, the PVC has + to updated with an owner reference to the pod + once the pod exists. Normally this should not + be necessary, but it may be useful when manually + reconstructing a broken cluster. \n This field + is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. \n Required, + must not be nil." + properties: + metadata: + description: May contain labels and annotations + that will be copied into the PVC when creating + it. No other fields are allowed and will be + rejected during validation. + type: object + spec: + description: The specification for the PersistentVolumeClaim. + The entire content is copied unchanged into + the PVC that gets created from this template. + The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: 'accessModes contains the desired + access modes the volume should have. More + info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + items: + type: string + type: array + dataSource: + description: 'dataSource field can be used + to specify either: * An existing VolumeSnapshot + object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller + can support the specified data source, + it will create a new volume based on the + contents of the specified data source. + When the AnyVolumeDataSource feature gate + is enabled, dataSource contents will be + copied to dataSourceRef, and dataSourceRef + contents will be copied to dataSource + when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef + will not be copied to dataSource.' + properties: + apiGroup: + description: APIGroup is the group for + the resource being referenced. If + APIGroup is not specified, the specified + Kind must be in the core API group. + For any other third-party types, APIGroup + is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: 'dataSourceRef specifies the + object from which to populate the volume + with data, if a non-empty volume is desired. + This may be any object from a non-empty + API group (non core object) or a PersistentVolumeClaim + object. When this field is specified, + volume binding will only succeed if the + type of the specified object matches some + installed volume populator or dynamic + provisioner. This field will replace the + functionality of the dataSource field + and as such if both fields are non-empty, + they must have the same value. For backwards + compatibility, when namespace isn''t specified + in dataSourceRef, both fields (dataSource + and dataSourceRef) will be set to the + same value automatically if one of them + is empty and the other is non-empty. When + namespace is specified in dataSourceRef, + dataSource isn''t set to the same value + and must be empty. There are three important + differences between dataSource and dataSourceRef: + * While dataSource only allows two specific + types of objects, dataSourceRef allows + any non-core object, as well as PersistentVolumeClaim + objects. * While dataSource ignores disallowed + values (dropping them), dataSourceRef + preserves all values, and generates an + error if a disallowed value is specified. + * While dataSource only allows local objects, + dataSourceRef allows objects in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource + feature gate to be enabled. (Alpha) Using + the namespace field of dataSourceRef requires + the CrossNamespaceVolumeDataSource feature + gate to be enabled.' + properties: + apiGroup: + description: APIGroup is the group for + the resource being referenced. If + APIGroup is not specified, the specified + Kind must be in the core API group. + For any other third-party types, APIGroup + is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + namespace: + description: Namespace is the namespace + of resource being referenced Note + that when a namespace is specified, + a gateway.networking.k8s.io/ReferenceGrant + object is required in the referent + namespace to allow that namespace's + owner to accept the reference. See + the ReferenceGrant documentation for + details. (Alpha) This field requires + the CrossNamespaceVolumeDataSource + feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: 'resources represents the minimum + resources the volume should have. If RecoverVolumeExpansionFailure + feature is enabled users are allowed to + specify resource requirements that are + lower than previous value but must still + be higher than capacity recorded in the + status field of the claim. More info: + https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + properties: + claims: + description: "Claims lists the names + of resources, defined in spec.resourceClaims, + that are used by this container. \n + This is an alpha field and requires + enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. + It can only be set for containers." + items: + description: ResourceClaim references + one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the + name of one entry in pod.spec.resourceClaims + of the Pod where this field + is used. It makes that resource + available inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum + amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the + minimum amount of compute resources + required. If Requests is omitted for + a container, it defaults to Limits + if that is explicitly specified, otherwise + to an implementation-defined value. + Requests cannot exceed Limits. More + info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + selector: + description: selector is a label query over + volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: 'storageClassName is the name + of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + type: string + volumeMode: + description: volumeMode defines what type + of volume is required by the claim. Value + of Filesystem is implied when not included + in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource + that is attached to a kubelet's host machine and then + exposed to the pod. + properties: + fsType: + description: 'fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. TODO: how + do we prevent errors in the filesystem from compromising + the machine' + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: 'readOnly is Optional: Defaults to + false (read/write). ReadOnly here will force the + ReadOnly setting in VolumeMounts.' + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target + worldwide names (WWNs)' + items: + type: string + type: array + wwids: + description: 'wwids Optional: FC volume world wide + identifiers (wwids) Either wwids or combination + of targetWWNs and lun must be set, but not both + simultaneously.' + items: + type: string + type: array + type: object + flexVolume: + description: flexVolume represents a generic volume + resource that is provisioned/attached using an exec + based plugin. + properties: + driver: + description: driver is the name of the driver to + use for this volume. + type: string + fsType: + description: fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". The + default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds + extra command options if any.' + type: object + readOnly: + description: 'readOnly is Optional: defaults to + false (read/write). ReadOnly here will force the + ReadOnly setting in VolumeMounts.' + type: boolean + secretRef: + description: 'secretRef is Optional: secretRef is + reference to the secret object containing sensitive + information to pass to the plugin scripts. This + may be empty if no secret object is specified. + If the secret object contains more than one secret, + all secrets are passed to the plugin scripts.' + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: flocker represents a Flocker volume attached + to a kubelet's host machine. This depends on the Flocker + control service being running + properties: + datasetName: + description: datasetName is Name of the dataset + stored as metadata -> name on the dataset for + Flocker should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. + This is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: 'gcePersistentDisk represents a GCE Disk + resource that is attached to a kubelet''s host machine + and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + properties: + fsType: + description: 'fsType is filesystem type of the volume + that you want to mount. Tip: Ensure that the filesystem + type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred + to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + TODO: how do we prevent errors in the filesystem + from compromising the machine' + type: string + partition: + description: 'partition is the partition in the + volume that you want to mount. If omitted, the + default is to mount by volume name. Examples: + For volume /dev/sda1, you specify the partition + as "1". Similarly, the volume partition for /dev/sda + is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + format: int32 + type: integer + pdName: + description: 'pdName is unique name of the PD resource + in GCE. Used to identify the disk in GCE. More + info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + type: string + readOnly: + description: 'readOnly here will force the ReadOnly + setting in VolumeMounts. Defaults to false. More + info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + type: boolean + required: + - pdName + type: object + gitRepo: + description: 'gitRepo represents a git repository at + a particular revision. DEPRECATED: GitRepo is deprecated. + To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo + using git, then mount the EmptyDir into the Pod''s + container.' + properties: + directory: + description: directory is the target directory name. + Must not contain or start with '..'. If '.' is + supplied, the volume directory will be the git + repository. Otherwise, if specified, the volume + will contain the git repository in the subdirectory + with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the + specified revision. + type: string + required: + - repository + type: object + glusterfs: + description: 'glusterfs represents a Glusterfs mount + on the host that shares a pod''s lifetime. More info: + https://examples.k8s.io/volumes/glusterfs/README.md' + properties: + endpoints: + description: 'endpoints is the endpoint name that + details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: string + path: + description: 'path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: string + readOnly: + description: 'readOnly here will force the Glusterfs + volume to be mounted with read-only permissions. + Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: 'hostPath represents a pre-existing file + or directory on the host machine that is directly + exposed to the container. This is generally used for + system agents or other privileged things that are + allowed to see the host machine. Most containers will + NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + --- TODO(jonesdl) We need to restrict who can use + host directory mounts and who can/can not mount host + directories as read/write.' + properties: + path: + description: 'path of the directory on the host. + If the path is a symlink, it will follow the link + to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + type: string + type: + description: 'type for HostPath Volume Defaults + to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + type: string + required: + - path + type: object + iscsi: + description: 'iscsi represents an ISCSI Disk resource + that is attached to a kubelet''s host machine and + then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support + iSCSI Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support + iSCSI Session CHAP authentication + type: boolean + fsType: + description: 'fsType is the filesystem type of the + volume that you want to mount. Tip: Ensure that + the filesystem type is supported by the host operating + system. Examples: "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. More info: + https://kubernetes.io/docs/concepts/storage/volumes#iscsi + TODO: how do we prevent errors in the filesystem + from compromising the machine' + type: string + initiatorName: + description: initiatorName is the custom iSCSI Initiator + Name. If initiatorName is specified with iscsiInterface + simultaneously, new iSCSI interface : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + description: iscsiInterface is the interface Name + that uses an iSCSI transport. Defaults to 'default' + (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: portals is the iSCSI Target Portal + List. The portal is either an IP or ip_addr:port + if the port is other than default (typically TCP + ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: readOnly here will force the ReadOnly + setting in VolumeMounts. Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI + target and initiator authentication + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: targetPortal is iSCSI Target Portal. + The Portal is either an IP or ip_addr:port if + the port is other than default (typically TCP + ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: 'name of the volume. Must be a DNS_LABEL + and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + nfs: + description: 'nfs represents an NFS mount on the host + that shares a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + properties: + path: + description: 'path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: string + readOnly: + description: 'readOnly here will force the NFS export + to be mounted with read-only permissions. Defaults + to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: boolean + server: + description: 'server is the hostname or IP address + of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: 'persistentVolumeClaimVolumeSource represents + a reference to a PersistentVolumeClaim in the same + namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + claimName: + description: 'claimName is the name of a PersistentVolumeClaim + in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + type: string + readOnly: + description: readOnly Will force the ReadOnly setting + in VolumeMounts. Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: photonPersistentDisk represents a PhotonController + persistent disk attached and mounted on kubelets host + machine + properties: + fsType: + description: fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon + Controller persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: portworxVolume represents a portworx volume + attached and mounted on kubelets host machine + properties: + fsType: + description: fSType represents the filesystem type + to mount Must be a filesystem type supported by + the host operating system. Ex. "ext4", "xfs". + Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: readOnly defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx + volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources + secrets, configmaps, and downward API + properties: + defaultMode: + description: defaultMode are the mode bits used + to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or + a decimal value between 0 and 511. YAML accepts + both octal and decimal values, JSON requires decimal + values for mode bits. Directories within the path + are not affected by this setting. This might be + in conflict with other options that affect the + file mode, like fsGroup, and the result can be + other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected + along with other supported volume types + properties: + configMap: + description: configMap information about the + configMap data to project + properties: + items: + description: items if unspecified, each + key-value pair in the Data field of + the referenced ConfigMap will be projected + into the volume as a file whose name + is the key and content is the value. + If specified, the listed keys will be + projected into the specified paths, + and unlisted keys will not be present. + If a key is specified which is not present + in the ConfigMap, the volume setup will + error unless it is marked optional. + Paths must be relative and may not contain + the '..' path or start with '..'. + items: + description: Maps a string key to a + path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: + mode bits used to set permissions + on this file. Must be an octal + value between 0000 and 0777 or + a decimal value between 0 and + 511. YAML accepts both octal and + decimal values, JSON requires + decimal values for mode bits. + If not specified, the volume defaultMode + will be used. This might be in + conflict with other options that + affect the file mode, like fsGroup, + and the result can be other mode + bits set.' + format: int32 + type: integer + path: + description: path is the relative + path of the file to map the key + to. May not be an absolute path. + May not contain the path element + '..'. May not start with the string + '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: optional specify whether + the ConfigMap or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about + the downwardAPI data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects + a field of the pod: only annotations, + labels, name and namespace are + supported.' + properties: + apiVersion: + description: Version of the + schema the FieldPath is written + in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field + to select in the specified + API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: 'Optional: mode bits + used to set permissions on this + file, must be an octal value between + 0000 and 0777 or a decimal value + between 0 and 511. YAML accepts + both octal and decimal values, + JSON requires decimal values for + mode bits. If not specified, the + volume defaultMode will be used. + This might be in conflict with + other options that affect the + file mode, like fsGroup, and the + result can be other mode bits + set.' + format: int32 + type: integer + path: + description: 'Required: Path is the + relative path name of the file + to be created. Must not be absolute + or contain the ''..'' path. Must + be utf-8 encoded. The first item + of the relative path must not + start with ''..''' + type: string + resourceFieldRef: + description: 'Selects a resource + of the container: only resources + limits and requests (limits.cpu, + limits.memory, requests.cpu and + requests.memory) are currently + supported.' + properties: + containerName: + description: 'Container name: + required for volumes, optional + for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output + format of the exposed resources, + defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource + to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the + secret data to project + properties: + items: + description: items if unspecified, each + key-value pair in the Data field of + the referenced Secret will be projected + into the volume as a file whose name + is the key and content is the value. + If specified, the listed keys will be + projected into the specified paths, + and unlisted keys will not be present. + If a key is specified which is not present + in the Secret, the volume setup will + error unless it is marked optional. + Paths must be relative and may not contain + the '..' path or start with '..'. + items: + description: Maps a string key to a + path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: + mode bits used to set permissions + on this file. Must be an octal + value between 0000 and 0777 or + a decimal value between 0 and + 511. YAML accepts both octal and + decimal values, JSON requires + decimal values for mode bits. + If not specified, the volume defaultMode + will be used. This might be in + conflict with other options that + affect the file mode, like fsGroup, + and the result can be other mode + bits set.' + format: int32 + type: integer + path: + description: path is the relative + path of the file to map the key + to. May not be an absolute path. + May not contain the path element + '..'. May not start with the string + '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: optional field specify whether + the Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information + about the serviceAccountToken data to project + properties: + audience: + description: audience is the intended + audience of the token. A recipient of + a token must identify itself with an + identifier specified in the audience + of the token, and otherwise should reject + the token. The audience defaults to + the identifier of the apiserver. + type: string + expirationSeconds: + description: expirationSeconds is the + requested duration of validity of the + service account token. As the token + approaches expiration, the kubelet volume + plugin will proactively rotate the service + account token. The kubelet will start + trying to rotate the token if the token + is older than 80 percent of its time + to live or if the token is older than + 24 hours.Defaults to 1 hour and must + be at least 10 minutes. + format: int64 + type: integer + path: + description: path is the path relative + to the mount point of the file to project + the token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + description: quobyte represents a Quobyte mount on the + host that shares a pod's lifetime + properties: + group: + description: group to map volume access to Default + is no group + type: string + readOnly: + description: readOnly here will force the Quobyte + volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: registry represents a single or multiple + Quobyte Registry services specified as a string + as host:port pair (multiple entries are separated + with commas) which acts as the central registry + for volumes + type: string + tenant: + description: tenant owning the given Quobyte volume + in the Backend Used with dynamically provisioned + Quobyte volumes, value is set by the plugin + type: string + user: + description: user to map volume access to Defaults + to serivceaccount user + type: string + volume: + description: volume is a string that references + an already created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: 'rbd represents a Rados Block Device mount + on the host that shares a pod''s lifetime. More info: + https://examples.k8s.io/volumes/rbd/README.md' + properties: + fsType: + description: 'fsType is the filesystem type of the + volume that you want to mount. Tip: Ensure that + the filesystem type is supported by the host operating + system. Examples: "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. More info: + https://kubernetes.io/docs/concepts/storage/volumes#rbd + TODO: how do we prevent errors in the filesystem + from compromising the machine' + type: string + image: + description: 'image is the rados image name. More + info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + keyring: + description: 'keyring is the path to key ring for + RBDUser. Default is /etc/ceph/keyring. More info: + https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + monitors: + description: 'monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + items: + type: string + type: array + pool: + description: 'pool is the rados pool name. Default + is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + readOnly: + description: 'readOnly here will force the ReadOnly + setting in VolumeMounts. Defaults to false. More + info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: boolean + secretRef: + description: 'secretRef is name of the authentication + secret for RBDUser. If provided overrides keyring. + Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: 'user is the rados user name. Default + is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + required: + - image + - monitors + type: object + scaleIO: + description: scaleIO represents a ScaleIO persistent + volume attached and mounted on Kubernetes nodes. + properties: + fsType: + description: fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Default + is "xfs". + type: string + gateway: + description: gateway is the host address of the + ScaleIO API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the + ScaleIO Protection Domain for the configured storage. + type: string + readOnly: + description: readOnly Defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. + type: boolean + secretRef: + description: secretRef references to the secret + for ScaleIO user and other sensitive information. + If this is not provided, Login operation will + fail. + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL + communication with Gateway, default false + type: boolean + storageMode: + description: storageMode indicates whether the storage + for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage + Pool associated with the protection domain. + type: string + system: + description: system is the name of the storage system + as configured in ScaleIO. + type: string + volumeName: + description: volumeName is the name of a volume + already created in the ScaleIO system that is + associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: 'secret represents a secret that should + populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + properties: + defaultMode: + description: 'defaultMode is Optional: mode bits + used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or + a decimal value between 0 and 511. YAML accepts + both octal and decimal values, JSON requires decimal + values for mode bits. Defaults to 0644. Directories + within the path are not affected by this setting. + This might be in conflict with other options that + affect the file mode, like fsGroup, and the result + can be other mode bits set.' + format: int32 + type: integer + items: + description: items If unspecified, each key-value + pair in the Data field of the referenced Secret + will be projected into the volume as a file whose + name is the key and content is the value. If specified, + the listed keys will be projected into the specified + paths, and unlisted keys will not be present. + If a key is specified which is not present in + the Secret, the volume setup will error unless + it is marked optional. Paths must be relative + and may not contain the '..' path or start with + '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: 'mode is Optional: mode bits + used to set permissions on this file. Must + be an octal value between 0000 and 0777 + or a decimal value between 0 and 511. YAML + accepts both octal and decimal values, JSON + requires decimal values for mode bits. If + not specified, the volume defaultMode will + be used. This might be in conflict with + other options that affect the file mode, + like fsGroup, and the result can be other + mode bits set.' + format: int32 + type: integer + path: + description: path is the relative path of + the file to map the key to. May not be an + absolute path. May not contain the path + element '..'. May not start with the string + '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: optional field specify whether the + Secret or its keys must be defined + type: boolean + secretName: + description: 'secretName is the name of the secret + in the pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + type: string + type: object + storageos: + description: storageOS represents a StorageOS volume + attached and mounted on Kubernetes nodes. + properties: + fsType: + description: fsType is the filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. + type: string + readOnly: + description: readOnly defaults to false (read/write). + ReadOnly here will force the ReadOnly setting + in VolumeMounts. + type: boolean + secretRef: + description: secretRef specifies the secret to use + for obtaining the StorageOS API credentials. If + not specified, default values will be attempted. + properties: + name: + description: 'Name of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: volumeName is the human-readable name + of the StorageOS volume. Volume names are only + unique within a namespace. + type: string + volumeNamespace: + description: volumeNamespace specifies the scope + of the volume within StorageOS. If no namespace + is specified then the Pod's namespace will be + used. This allows the Kubernetes name scoping + to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default + behaviour. Set to "default" if you are not using + namespaces within StorageOS. Namespaces that do + not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: vsphereVolume represents a vSphere volume + attached and mounted on kubelets host machine + properties: + fsType: + description: fsType is filesystem type to mount. + Must be a filesystem type supported by the host + operating system. Ex. "ext4", "xfs", "ntfs". Implicitly + inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy + Based Management (SPBM) profile ID associated + with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy + Based Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies + vSphere volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + required: + - containers + type: object + type: object + type: + default: rw + description: Which instances we must forward traffic to? + enum: + - rw + - ro + type: string + required: + - cluster + - instances + - pgbouncer + - type + type: object + status: + description: PoolerStatus defines the observed state of Pooler + properties: + instances: + description: The number of pods trying to be scheduled + format: int32 + type: integer + secrets: + description: The resource version of the config object + properties: + clientCA: + description: The client CA secret version + properties: + name: + description: The name of the secret + type: string + version: + description: The ResourceVersion of the secret + type: string + type: object + pgBouncerSecrets: + description: The version of the secrets used by PgBouncer + properties: + authQuery: + description: The auth query secret version + properties: + name: + description: The name of the secret + type: string + version: + description: The ResourceVersion of the secret + type: string + type: object + type: object + serverCA: + description: The server CA secret version + properties: + name: + description: The name of the secret + type: string + version: + description: The ResourceVersion of the secret + type: string + type: object + serverTLS: + description: The server TLS secret version + properties: + name: + description: The name of the secret + type: string + version: + description: The ResourceVersion of the secret + type: string + type: object + type: object + type: object + type: object + served: true + storage: true + subresources: + scale: + specReplicasPath: .spec.instances + statusReplicasPath: .status.instances + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.1 + name: scheduledbackups.postgresql.cnpg.io +spec: + group: postgresql.cnpg.io + names: + kind: ScheduledBackup + listKind: ScheduledBackupList + plural: scheduledbackups + singular: scheduledbackup + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.cluster.name + name: Cluster + type: string + - jsonPath: .status.lastScheduleTime + name: Last Backup + type: date + name: v1 + schema: + openAPIV3Schema: + description: ScheduledBackup is the Schema for the scheduledbackups API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: 'Specification of the desired behavior of the ScheduledBackup. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + backupOwnerReference: + default: none + description: 'Indicates which ownerReference should be put inside + the created backup resources.
- none: no owner reference for + created backup objects (same behavior as before the field was introduced)
- self: sets the Scheduled backup object as owner of the backup
- cluster: set the cluster as owner of the backup
' + enum: + - none + - self + - cluster + type: string + cluster: + description: The cluster to backup + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + immediate: + description: If the first backup has to be immediately start after + creation or not + type: boolean + schedule: + description: The schedule does not follow the same format used in + Kubernetes CronJobs as it includes an additional seconds specifier, + see https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format + type: string + suspend: + description: If this backup is suspended or not + type: boolean + target: + description: The policy to decide which instance should perform this + backup. If empty, it defaults to `cluster.spec.backup.target`. Available + options are empty string, `primary` and `prefer-standby`. `primary` + to have backups run always on primary instances, `prefer-standby` + to have backups run preferably on the most updated standby, if available. + enum: + - primary + - prefer-standby + type: string + required: + - schedule + type: object + status: + description: 'Most recently observed status of the ScheduledBackup. This + data may not be up to date. Populated by the system. Read-only. More + info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + lastCheckTime: + description: The latest time the schedule + format: date-time + type: string + lastScheduleTime: + description: Information when was the last time that backup was successfully + scheduled. + format: date-time + type: string + nextScheduleTime: + description: Next time we will run a backup + format: date-time + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: cnpg-manager + namespace: cnpg-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: cnpg-manager +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - configmaps/status + verbs: + - get + - patch + - update +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - persistentvolumeclaims + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - "" + resources: + - pods + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - "" + resources: + - pods/status + verbs: + - get +- apiGroups: + - "" + resources: + - secrets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - secrets/status + verbs: + - get + - patch + - update +- apiGroups: + - "" + resources: + - serviceaccounts + verbs: + - create + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - services + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - admissionregistration.k8s.io + resources: + - mutatingwebhookconfigurations + verbs: + - get + - list + - patch + - update +- apiGroups: + - admissionregistration.k8s.io + resources: + - validatingwebhookconfigurations + verbs: + - get + - list + - patch + - update +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - get + - list + - update +- apiGroups: + - apps + resources: + - deployments + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - batch + resources: + - jobs + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - update +- apiGroups: + - monitoring.coreos.com + resources: + - podmonitors + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - policy + resources: + - poddisruptionbudgets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - backups + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - backups/status + verbs: + - get + - patch + - update +- apiGroups: + - postgresql.cnpg.io + resources: + - clusters + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - clusters/finalizers + verbs: + - update +- apiGroups: + - postgresql.cnpg.io + resources: + - clusters/status + verbs: + - get + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - poolers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - poolers/finalizers + verbs: + - update +- apiGroups: + - postgresql.cnpg.io + resources: + - poolers/status + verbs: + - get + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - scheduledbackups + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - postgresql.cnpg.io + resources: + - scheduledbackups/status + verbs: + - get + - patch + - update +- apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + verbs: + - create + - get + - list + - patch + - update + - watch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + verbs: + - create + - get + - list + - patch + - update + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cnpg-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cnpg-manager +subjects: +- kind: ServiceAccount + name: cnpg-manager + namespace: cnpg-system +--- +apiVersion: v1 +data: + queries: | + backends: + query: | + SELECT sa.datname + , sa.usename + , sa.application_name + , states.state + , COALESCE(sa.count, 0) AS total + , COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds + FROM ( VALUES ('active') + , ('idle') + , ('idle in transaction') + , ('idle in transaction (aborted)') + , ('fastpath function call') + , ('disabled') + ) AS states(state) + LEFT JOIN ( + SELECT datname + , state + , usename + , COALESCE(application_name, '') AS application_name + , COUNT(*) + , COALESCE(EXTRACT (EPOCH FROM (max(now() - xact_start))), 0) AS max_tx_secs + FROM pg_catalog.pg_stat_activity + GROUP BY datname, state, usename, application_name + ) sa ON states.state = sa.state + WHERE sa.usename IS NOT NULL + metrics: + - datname: + usage: "LABEL" + description: "Name of the database" + - usename: + usage: "LABEL" + description: "Name of the user" + - application_name: + usage: "LABEL" + description: "Name of the application" + - state: + usage: "LABEL" + description: "State of the backend" + - total: + usage: "GAUGE" + description: "Number of backends" + - max_tx_duration_seconds: + usage: "GAUGE" + description: "Maximum duration of a transaction in seconds" + + backends_waiting: + query: | + SELECT count(*) AS total + FROM pg_catalog.pg_locks blocked_locks + JOIN pg_catalog.pg_locks blocking_locks + ON blocking_locks.locktype = blocked_locks.locktype + AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database + AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation + AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page + AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple + AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid + AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid + AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid + AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid + AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid + AND blocking_locks.pid != blocked_locks.pid + JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid = blocking_locks.pid + WHERE NOT blocked_locks.granted + metrics: + - total: + usage: "GAUGE" + description: "Total number of backends that are currently waiting on other queries" + + pg_database: + query: | + SELECT datname + , pg_catalog.pg_database_size(datname) AS size_bytes + , pg_catalog.age(datfrozenxid) AS xid_age + , pg_catalog.mxid_age(datminmxid) AS mxid_age + FROM pg_catalog.pg_database + metrics: + - datname: + usage: "LABEL" + description: "Name of the database" + - size_bytes: + usage: "GAUGE" + description: "Disk space used by the database" + - xid_age: + usage: "GAUGE" + description: "Number of transactions from the frozen XID to the current one" + - mxid_age: + usage: "GAUGE" + description: "Number of multiple transactions (Multixact) from the frozen XID to the current one" + + pg_postmaster: + query: | + SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time + FROM pg_catalog.pg_postmaster_start_time() + metrics: + - start_time: + usage: "GAUGE" + description: "Time at which postgres started (based on epoch)" + + pg_replication: + query: "SELECT CASE WHEN NOT pg_catalog.pg_is_in_recovery() + THEN 0 + ELSE GREATEST (0, + EXTRACT(EPOCH FROM (now() - pg_catalog.pg_last_xact_replay_timestamp()))) + END AS lag, + pg_catalog.pg_is_in_recovery() AS in_recovery, + EXISTS (TABLE pg_stat_wal_receiver) AS is_wal_receiver_up, + (SELECT count(*) FROM pg_stat_replication) AS streaming_replicas" + metrics: + - lag: + usage: "GAUGE" + description: "Replication lag behind primary in seconds" + - in_recovery: + usage: "GAUGE" + description: "Whether the instance is in recovery" + - is_wal_receiver_up: + usage: "GAUGE" + description: "Whether the instance wal_receiver is up" + - streaming_replicas: + usage: "GAUGE" + description: "Number of streaming replicas connected to the instance" + + pg_replication_slots: + query: | + SELECT slot_name, + slot_type, + database, + active, + pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn) + FROM pg_catalog.pg_replication_slots + WHERE NOT temporary + metrics: + - slot_name: + usage: "LABEL" + description: "Name of the replication slot" + - slot_type: + usage: "LABEL" + description: "Type of the replication slot" + - database: + usage: "LABEL" + description: "Name of the database" + - active: + usage: "GAUGE" + description: "Flag indicating whether the slot is active" + - pg_wal_lsn_diff: + usage: "GAUGE" + description: "Replication lag in bytes" + + pg_stat_archiver: + query: | + SELECT archived_count + , failed_count + , COALESCE(EXTRACT(EPOCH FROM (now() - last_archived_time)), -1) AS seconds_since_last_archival + , COALESCE(EXTRACT(EPOCH FROM (now() - last_failed_time)), -1) AS seconds_since_last_failure + , COALESCE(EXTRACT(EPOCH FROM last_archived_time), -1) AS last_archived_time + , COALESCE(EXTRACT(EPOCH FROM last_failed_time), -1) AS last_failed_time + , COALESCE(CAST(CAST('x'||pg_catalog.right(pg_catalog.split_part(last_archived_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_archived_wal_start_lsn + , COALESCE(CAST(CAST('x'||pg_catalog.right(pg_catalog.split_part(last_failed_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_failed_wal_start_lsn + , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time + FROM pg_catalog.pg_stat_archiver + metrics: + - archived_count: + usage: "COUNTER" + description: "Number of WAL files that have been successfully archived" + - failed_count: + usage: "COUNTER" + description: "Number of failed attempts for archiving WAL files" + - seconds_since_last_archival: + usage: "GAUGE" + description: "Seconds since the last successful archival operation" + - seconds_since_last_failure: + usage: "GAUGE" + description: "Seconds since the last failed archival operation" + - last_archived_time: + usage: "GAUGE" + description: "Epoch of the last time WAL archiving succeeded" + - last_failed_time: + usage: "GAUGE" + description: "Epoch of the last time WAL archiving failed" + - last_archived_wal_start_lsn: + usage: "GAUGE" + description: "Archived WAL start LSN" + - last_failed_wal_start_lsn: + usage: "GAUGE" + description: "Last failed WAL LSN" + - stats_reset_time: + usage: "GAUGE" + description: "Time at which these statistics were last reset" + + pg_stat_bgwriter: + query: | + SELECT checkpoints_timed + , checkpoints_req + , checkpoint_write_time + , checkpoint_sync_time + , buffers_checkpoint + , buffers_clean + , maxwritten_clean + , buffers_backend + , buffers_backend_fsync + , buffers_alloc + FROM pg_catalog.pg_stat_bgwriter + metrics: + - checkpoints_timed: + usage: "COUNTER" + description: "Number of scheduled checkpoints that have been performed" + - checkpoints_req: + usage: "COUNTER" + description: "Number of requested checkpoints that have been performed" + - checkpoint_write_time: + usage: "COUNTER" + description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds" + - checkpoint_sync_time: + usage: "COUNTER" + description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds" + - buffers_checkpoint: + usage: "COUNTER" + description: "Number of buffers written during checkpoints" + - buffers_clean: + usage: "COUNTER" + description: "Number of buffers written by the background writer" + - maxwritten_clean: + usage: "COUNTER" + description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers" + - buffers_backend: + usage: "COUNTER" + description: "Number of buffers written directly by a backend" + - buffers_backend_fsync: + usage: "COUNTER" + description: "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)" + - buffers_alloc: + usage: "COUNTER" + description: "Number of buffers allocated" + + pg_stat_database: + query: | + SELECT datname + , xact_commit + , xact_rollback + , blks_read + , blks_hit + , tup_returned + , tup_fetched + , tup_inserted + , tup_updated + , tup_deleted + , conflicts + , temp_files + , temp_bytes + , deadlocks + , blk_read_time + , blk_write_time + FROM pg_catalog.pg_stat_database + metrics: + - datname: + usage: "LABEL" + description: "Name of this database" + - xact_commit: + usage: "COUNTER" + description: "Number of transactions in this database that have been committed" + - xact_rollback: + usage: "COUNTER" + description: "Number of transactions in this database that have been rolled back" + - blks_read: + usage: "COUNTER" + description: "Number of disk blocks read in this database" + - blks_hit: + usage: "COUNTER" + description: "Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)" + - tup_returned: + usage: "COUNTER" + description: "Number of rows returned by queries in this database" + - tup_fetched: + usage: "COUNTER" + description: "Number of rows fetched by queries in this database" + - tup_inserted: + usage: "COUNTER" + description: "Number of rows inserted by queries in this database" + - tup_updated: + usage: "COUNTER" + description: "Number of rows updated by queries in this database" + - tup_deleted: + usage: "COUNTER" + description: "Number of rows deleted by queries in this database" + - conflicts: + usage: "COUNTER" + description: "Number of queries canceled due to conflicts with recovery in this database" + - temp_files: + usage: "COUNTER" + description: "Number of temporary files created by queries in this database" + - temp_bytes: + usage: "COUNTER" + description: "Total amount of data written to temporary files by queries in this database" + - deadlocks: + usage: "COUNTER" + description: "Number of deadlocks detected in this database" + - blk_read_time: + usage: "COUNTER" + description: "Time spent reading data file blocks by backends in this database, in milliseconds" + - blk_write_time: + usage: "COUNTER" + description: "Time spent writing data file blocks by backends in this database, in milliseconds" + + pg_stat_replication: + primary: true + query: | + SELECT usename + , COALESCE(application_name, '') AS application_name + , COALESCE(client_addr::text, '') AS client_addr + , EXTRACT(EPOCH FROM backend_start) AS backend_start + , COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age + , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes + , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes + , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes + , COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes + , COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds + , COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds + , COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds + FROM pg_catalog.pg_stat_replication + metrics: + - usename: + usage: "LABEL" + description: "Name of the replication user" + - application_name: + usage: "LABEL" + description: "Name of the application" + - client_addr: + usage: "LABEL" + description: "Client IP address" + - backend_start: + usage: "COUNTER" + description: "Time when this process was started" + - backend_xmin_age: + usage: "COUNTER" + description: "The age of this standby's xmin horizon" + - sent_diff_bytes: + usage: "GAUGE" + description: "Difference in bytes from the last write-ahead log location sent on this connection" + - write_diff_bytes: + usage: "GAUGE" + description: "Difference in bytes from the last write-ahead log location written to disk by this standby server" + - flush_diff_bytes: + usage: "GAUGE" + description: "Difference in bytes from the last write-ahead log location flushed to disk by this standby server" + - replay_diff_bytes: + usage: "GAUGE" + description: "Difference in bytes from the last write-ahead log location replayed into the database on this standby server" + - write_lag_seconds: + usage: "GAUGE" + description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it" + - flush_lag_seconds: + usage: "GAUGE" + description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it" + - replay_lag_seconds: + usage: "GAUGE" + description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it" + + pg_settings: + query: | + SELECT name, + CASE setting WHEN 'on' THEN '1' WHEN 'off' THEN '0' ELSE setting END AS setting + FROM pg_catalog.pg_settings + WHERE vartype IN ('integer', 'real', 'bool') + ORDER BY 1 + metrics: + - name: + usage: "LABEL" + description: "Name of the setting" + - setting: + usage: "GAUGE" + description: "Setting value" +kind: ConfigMap +metadata: + labels: + cnpg.io/reload: "" + name: cnpg-default-monitoring + namespace: cnpg-system +--- +apiVersion: v1 +kind: Service +metadata: + name: cnpg-webhook-service + namespace: cnpg-system +spec: + ports: + - port: 443 + targetPort: 9443 + selector: + app.kubernetes.io/name: cloudnative-pg +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: cloudnative-pg + name: cnpg-controller-manager + namespace: cnpg-system +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: cloudnative-pg + template: + metadata: + labels: + app.kubernetes.io/name: cloudnative-pg + spec: + containers: + - args: + - controller + - --leader-elect + - --config-map-name=cnpg-controller-manager-config + - --secret-name=cnpg-controller-manager-config + - --webhook-port=9443 + command: + - /manager + env: + - name: OPERATOR_IMAGE_NAME + value: ghcr.io/cloudnative-pg/cloudnative-pg:1.20.2 + - name: OPERATOR_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: MONITORING_QUERIES_CONFIGMAP + value: cnpg-default-monitoring + image: ghcr.io/cloudnative-pg/cloudnative-pg:1.20.2 + livenessProbe: + httpGet: + path: /readyz + port: 9443 + scheme: HTTPS + name: manager + ports: + - containerPort: 8080 + name: metrics + protocol: TCP + - containerPort: 9443 + name: webhook-server + protocol: TCP + readinessProbe: + httpGet: + path: /readyz + port: 9443 + scheme: HTTPS + resources: + limits: + cpu: 100m + memory: 200Mi + requests: + cpu: 100m + memory: 100Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsGroup: 10001 + runAsUser: 10001 + volumeMounts: + - mountPath: /controller + name: scratch-data + - mountPath: /run/secrets/cnpg.io/webhook + name: webhook-certificates + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + serviceAccountName: cnpg-manager + terminationGracePeriodSeconds: 10 + volumes: + - emptyDir: {} + name: scratch-data + - name: webhook-certificates + secret: + defaultMode: 420 + optional: true + secretName: cnpg-webhook-cert +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: cnpg-mutating-webhook-configuration +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /mutate-postgresql-cnpg-io-v1-backup + failurePolicy: Fail + name: mbackup.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - backups + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /mutate-postgresql-cnpg-io-v1-cluster + failurePolicy: Fail + name: mcluster.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - clusters + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /mutate-postgresql-cnpg-io-v1-scheduledbackup + failurePolicy: Fail + name: mscheduledbackup.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - scheduledbackups + sideEffects: None +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: cnpg-validating-webhook-configuration +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /validate-postgresql-cnpg-io-v1-backup + failurePolicy: Fail + name: vbackup.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - backups + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /validate-postgresql-cnpg-io-v1-cluster + failurePolicy: Fail + name: vcluster.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - clusters + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /validate-postgresql-cnpg-io-v1-pooler + failurePolicy: Fail + name: vpooler.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - poolers + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: cnpg-webhook-service + namespace: cnpg-system + path: /validate-postgresql-cnpg-io-v1-scheduledbackup + failurePolicy: Fail + name: vscheduledbackup.kb.io + rules: + - apiGroups: + - postgresql.cnpg.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - scheduledbackups + sideEffects: None From 49412781ea0863eab67719a0b5caeb69f91719e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:35:57 +0300 Subject: [PATCH 32/77] openebs: Pin specific image --- openebs/rawfile.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openebs/rawfile.yaml b/openebs/rawfile.yaml index 1e85378..4c75d39 100644 --- a/openebs/rawfile.yaml +++ b/openebs/rawfile.yaml @@ -199,8 +199,8 @@ spec: type: DirectoryOrCreate containers: - name: csi-driver - image: "harbor.k-space.ee/k-space/rawfile-localpv:latest" - imagePullPolicy: Always + image: "harbor.k-space.ee/k-space/rawfile-localpv@sha256:03452efdac5bccb9bfc0d4b9c371d17588c24b075d7d34fa01f63d7e262eecd8" + imagePullPolicy: IfNotPresent securityContext: privileged: true env: @@ -211,7 +211,7 @@ spec: - name: IMAGE_REPOSITORY value: "harbor.k-space.ee/k-space/rawfile-localpv" - name: IMAGE_TAG - value: "latest" + value: "latest@sha256:03452efdac5bccb9bfc0d4b9c371d17588c24b075d7d34fa01f63d7e262eecd8" - name: NODE_ID valueFrom: fieldRef: @@ -329,8 +329,8 @@ spec: emptyDir: {} containers: - name: csi-driver - image: "harbor.k-space.ee/k-space/rawfile-localpv" - imagePullPolicy: Always + image: "harbor.k-space.ee/k-space/rawfile-localpv@sha256:03452efdac5bccb9bfc0d4b9c371d17588c24b075d7d34fa01f63d7e262eecd8" + imagePullPolicy: IfNotPresent args: - csi-driver - --disable-metrics @@ -342,7 +342,7 @@ spec: - name: IMAGE_REPOSITORY value: "harbor.k-space.ee/k-space/rawfile-localpv" - name: IMAGE_TAG - value: "latest" + value: "latest@sha256:03452efdac5bccb9bfc0d4b9c371d17588c24b075d7d34fa01f63d7e262eecd8" volumeMounts: - name: socket-dir mountPath: /csi From af83e1783bca7cc0fcee2562c3f586efb74423c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:39:20 +0300 Subject: [PATCH 33/77] Clean up operatorlib related stuff --- minio-clusters/README.md | 5 +- minio-clusters/cert.yaml | 13 ++++ minio-clusters/dedicated.yaml | 50 +++----------- minio-clusters/external.yaml | 23 ++++--- minio-clusters/shared.yaml | 60 +++++------------ mysql-clusters/README.md | 6 +- mysql-clusters/application.yaml | 67 +------------------ mysql-clusters/dedicated.yaml | 24 +++++++ mysql-clusters/external.yaml | 22 ++++++ mysql-clusters/shared.yaml | 25 +++++++ mysql-clusters/storageclass.yaml | 11 +++ mysql-operator/README.md | 7 +- postgres-clusters/README.md | 4 +- postgres-clusters/dedicated.yaml | 23 +++++++ .../{application.yaml => pgweb.yaml} | 51 +++----------- postgres-clusters/shared.yaml | 24 +++++++ postgres-clusters/storageclass.yaml | 11 +++ redis-clusters/README.md | 5 +- redis-clusters/application.yaml | 43 ------------ redis-clusters/cache.yaml | 18 +++++ redis-clusters/ephemeral.yaml | 22 ++++++ redis-clusters/persistent.yaml | 25 +++++++ redis-clusters/session.yaml | 0 redis-clusters/storageclass.yaml | 11 +++ storage-class.yaml | 33 --------- 25 files changed, 301 insertions(+), 282 deletions(-) create mode 100644 minio-clusters/cert.yaml create mode 100644 mysql-clusters/dedicated.yaml create mode 100644 mysql-clusters/external.yaml create mode 100644 mysql-clusters/shared.yaml create mode 100644 mysql-clusters/storageclass.yaml create mode 100644 postgres-clusters/dedicated.yaml rename postgres-clusters/{application.yaml => pgweb.yaml} (60%) create mode 100644 postgres-clusters/shared.yaml create mode 100644 postgres-clusters/storageclass.yaml delete mode 100644 redis-clusters/application.yaml create mode 100644 redis-clusters/cache.yaml create mode 100644 redis-clusters/ephemeral.yaml create mode 100644 redis-clusters/persistent.yaml create mode 100644 redis-clusters/session.yaml create mode 100644 redis-clusters/storageclass.yaml diff --git a/minio-clusters/README.md b/minio-clusters/README.md index 973f0b2..d657a13 100644 --- a/minio-clusters/README.md +++ b/minio-clusters/README.md @@ -1,7 +1,8 @@ # minio-clusters -This namespace houses Minio clusters managed by -[Codemowers' Operator Bundle](https://github.com/codemowers/operator-bundle) +This is namespace for Minio clusters managed by Codemowers' sample +[minio-bucket-operator](https://github.com/codemowers/operatorlib/tree/main/samples/minio-bucket-operator) +which is deployed via [ArgoCD](https://argocd.k-space.ee/applications/argocd/minio-bucket-operator) To update bump the `image` tag for the classes and issue: diff --git a/minio-clusters/cert.yaml b/minio-clusters/cert.yaml new file mode 100644 index 0000000..9f2cd2c --- /dev/null +++ b/minio-clusters/cert.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: wildcard-tls + namespace: minio-clusters +spec: + dnsNames: + - "*.minio-clusters.k-space.ee" + issuerRef: + kind: ClusterIssuer + name: default + secretName: wildcard-tls diff --git a/minio-clusters/dedicated.yaml b/minio-clusters/dedicated.yaml index 33b5095..8e9e3a1 100644 --- a/minio-clusters/dedicated.yaml +++ b/minio-clusters/dedicated.yaml @@ -1,51 +1,23 @@ --- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterBucketClass +apiVersion: codemowers.cloud/v1beta1 +kind: MinioBucketClass metadata: name: dedicated + annotations: + kubernetes.io/description: "Dedicated Minio cluster" spec: - targetNamespace: minio-clusters - description: "Dedicated Minio clusters" + reclaimPolicy: Retain replicas: 4 storageClass: minio podSpec: containers: - name: minio - env: - - name: MINIO_PROMETHEUS_AUTH_TYPE - value: public - image: minio/minio:RELEASE.2023-02-17T17-52-43Z - args: - - server - - --address - - 0.0.0.0:9000 - - --console-address - - 0.0.0.0:9001 - ports: - - containerPort: 9000 - name: http - - containerPort: 9001 - name: console - readinessProbe: - httpGet: - path: /minio/health/ready - port: 9000 - initialDelaySeconds: 2 - periodSeconds: 5 - resources: - requests: - cpu: 300m - memory: 1Gi - limits: - cpu: 4000m - memory: 2Gi - volumeMounts: - - name: data - mountPath: /data + image: docker.io/minio/minio:RELEASE.2023-07-18T17-49-40Z@sha256:8879cd0b0c4087817430e21be3ad909d60e9da62fac3e8d9368d9fde51279229 + imagePullPolicy: IfNotPresent nodeSelector: dedicated: storage tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/minio-clusters/external.yaml b/minio-clusters/external.yaml index cd9a614..1acc030 100644 --- a/minio-clusters/external.yaml +++ b/minio-clusters/external.yaml @@ -1,12 +1,13 @@ --- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterBucketClass +apiVersion: codemowers.cloud/v1beta1 +kind: MinioBucketClass metadata: name: external + annotations: + kubernetes.io/description: "External Minio cluster" spec: - description: "Minio instance running on the ZFS storage box" - targetNamespace: minio-clusters - targetCluster: external + reclaimPolicy: Retain + shared: true --- apiVersion: v1 kind: Service @@ -18,8 +19,7 @@ spec: ports: - name: http protocol: TCP - port: 80 - targetPort: 9000 + port: 9000 type: ExternalName --- apiVersion: v1 @@ -32,8 +32,7 @@ spec: ports: - name: http protocol: TCP - port: 80 - targetPort: 9001 + port: 9001 type: ExternalName --- apiVersion: networking.k8s.io/v1 @@ -48,7 +47,7 @@ metadata: external-dns.alpha.kubernetes.io/target: traefik.k-space.ee spec: rules: - - host: minio-cluster-external.k-space.ee + - host: external.minio-clusters.k-space.ee http: paths: - pathType: Prefix @@ -61,6 +60,7 @@ spec: tls: - hosts: - "*.k-space.ee" + secretName: wildcard-tls --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -74,7 +74,7 @@ metadata: external-dns.alpha.kubernetes.io/target: traefik.k-space.ee spec: rules: - - host: minio-cluster-external-console.k-space.ee + - host: external-console.minio-clusters.k-space.ee http: paths: - pathType: Prefix @@ -87,3 +87,4 @@ spec: tls: - hosts: - "*.k-space.ee" + secretName: wildcard-tls diff --git a/minio-clusters/shared.yaml b/minio-clusters/shared.yaml index 16b6a1b..8207dc3 100644 --- a/minio-clusters/shared.yaml +++ b/minio-clusters/shared.yaml @@ -1,55 +1,27 @@ --- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterBucketClass +apiVersion: codemowers.cloud/v1beta1 +kind: MinioBucketClass metadata: name: shared + annotations: + kubernetes.io/description: "Shared Minio cluster" spec: - description: "Shared Minio cluster" - targetNamespace: minio-clusters - targetCluster: shared - storageClass: minio + reclaimPolicy: Retain + shared: true replicas: 4 + storageClass: minio podSpec: containers: - name: minio - env: - - name: MINIO_PROMETHEUS_AUTH_TYPE - value: public - image: minio/minio:RELEASE.2023-02-17T17-52-43Z - args: - - server - - --address - - 0.0.0.0:9000 - - --console-address - - 0.0.0.0:9001 - ports: - - containerPort: 9000 - name: http - - containerPort: 9001 - name: console - readinessProbe: - httpGet: - path: /minio/health/ready - port: 9000 - initialDelaySeconds: 2 - periodSeconds: 5 - resources: - requests: - cpu: 300m - memory: 1Gi - limits: - cpu: 4000m - memory: 2Gi - volumeMounts: - - name: data - mountPath: /data + image: docker.io/minio/minio:RELEASE.2023-07-18T17-49-40Z@sha256:8879cd0b0c4087817430e21be3ad909d60e9da62fac3e8d9368d9fde51279229 + imagePullPolicy: IfNotPresent nodeSelector: dedicated: storage tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -63,7 +35,7 @@ metadata: external-dns.alpha.kubernetes.io/target: traefik.k-space.ee spec: rules: - - host: minio-cluster-shared.k-space.ee + - host: shared.minio-clusters.k-space.ee http: paths: - pathType: Prefix @@ -76,6 +48,7 @@ spec: tls: - hosts: - "*.k-space.ee" + secretName: wildcard-tls --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -89,7 +62,7 @@ metadata: external-dns.alpha.kubernetes.io/target: traefik.k-space.ee spec: rules: - - host: minio-cluster-shared-console.k-space.ee + - host: shared-console.minio-clusters.k-space.ee http: paths: - pathType: Prefix @@ -102,3 +75,4 @@ spec: tls: - hosts: - "*.k-space.ee" + secretName: wildcard-tls diff --git a/mysql-clusters/README.md b/mysql-clusters/README.md index 303f8b4..4c8875b 100644 --- a/mysql-clusters/README.md +++ b/mysql-clusters/README.md @@ -1,6 +1,8 @@ -# MySQL clusters +# MariaDB clusters -This is namespace for MySQL clusters managed by [operatorlib](https://github.com/codemowers/operatorlib/tree/main/samples/mysql-database-operator) +This is namespace for MariaDB clusters managed by Codemowers' sample +[mysql-database-operator](https://github.com/codemowers/operatorlib/tree/main/samples/mysql-database-operator) +which is deployed via [ArgoCD](https://argocd.k-space.ee/applications/argocd/mysql-database-operator) ``` kubectl create namespace mysql-clusters diff --git a/mysql-clusters/application.yaml b/mysql-clusters/application.yaml index 4f3335b..eb93ff6 100644 --- a/mysql-clusters/application.yaml +++ b/mysql-clusters/application.yaml @@ -1,63 +1,4 @@ --- -apiVersion: codemowers.cloud/v1beta1 -kind: MysqlDatabaseClass -metadata: - name: shared - annotations: - kubernetes.io/description: "Shared MySQL cluster" -spec: - reclaimPolicy: Retain - shared: true - replicas: 3 - routers: 2 - storageClass: mysql - podSpec: - containers: - - name: mariadb - image: mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b - imagePullPolicy: IfNotPresent - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- -apiVersion: codemowers.cloud/v1beta1 -kind: MysqlDatabaseClass -metadata: - name: dedicated - annotations: - kubernetes.io/description: "Dedicated MySQL cluster" -spec: - reclaimPolicy: Retain - replicas: 3 - routers: 2 - storageClass: mysql - podSpec: - containers: - - name: mariadb - image: mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b - imagePullPolicy: IfNotPresent - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- -apiVersion: codemowers.cloud/v1beta1 -kind: MysqlDatabaseClass -metadata: - name: external - annotations: - kubernetes.io/description: "External MySQL cluster" -spec: - reclaimPolicy: Retain - shared: true ---- apiVersion: v1 kind: ConfigMap metadata: @@ -89,19 +30,15 @@ spec: containers: - name: phpmyadmin image: phpmyadmin/phpmyadmin - volumeMounts: - - name: config - mountPath: /etc/phpmyadmin/config.user.inc.php - subPath: config.user.inc.php ports: - name: web containerPort: 80 protocol: TCP env: - name: PMA_HOSTS - value: mysql-cluster-shared.mysql-clusters,mysql-cluster.authelia,mysql-cluster.etherpad,mariadb.authelia,mariadb.nextcloud,172.20.36.1 + value: shared.mysql-clusters.svc.cluster.local,external.mysql-clusters.svc.cluster.local - name: PMA_PORTS - value: 6446,6446,6446,3306,3306,3306 + value: 3306,3306 - name: PMA_ABSOLUTE_URI value: https://phpmyadmin.k-space.ee/ - name: UPLOAD_LIMIT diff --git a/mysql-clusters/dedicated.yaml b/mysql-clusters/dedicated.yaml new file mode 100644 index 0000000..b5bbfda --- /dev/null +++ b/mysql-clusters/dedicated.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: MysqlDatabaseClass +metadata: + name: dedicated + annotations: + kubernetes.io/description: "Dedicated MySQL cluster" +spec: + reclaimPolicy: Retain + replicas: 3 + routers: 2 + storageClass: mysql + podSpec: + containers: + - name: mariadb + image: mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b + imagePullPolicy: IfNotPresent + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/mysql-clusters/external.yaml b/mysql-clusters/external.yaml new file mode 100644 index 0000000..43af6e2 --- /dev/null +++ b/mysql-clusters/external.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: MysqlDatabaseClass +metadata: + name: external + annotations: + kubernetes.io/description: "External MySQL cluster" +spec: + reclaimPolicy: Retain + shared: true +--- +apiVersion: v1 +kind: Service +metadata: + name: external +spec: + type: ExternalName + externalName: 172.20.36.1 + ports: + - name: mysql + port: 3306 + protocol: TCP diff --git a/mysql-clusters/shared.yaml b/mysql-clusters/shared.yaml new file mode 100644 index 0000000..2b010dd --- /dev/null +++ b/mysql-clusters/shared.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: MysqlDatabaseClass +metadata: + name: shared + annotations: + kubernetes.io/description: "Shared MySQL cluster" +spec: + reclaimPolicy: Retain + shared: true + replicas: 3 + routers: 2 + storageClass: mysql + podSpec: + containers: + - name: mariadb + image: mariadb:10.9.7@sha256:198c7a5fea3d7285762042a628fe8f83f0a7ccef559605b4cc9502e65210880b + imagePullPolicy: IfNotPresent + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/mysql-clusters/storageclass.yaml b/mysql-clusters/storageclass.yaml new file mode 100644 index 0000000..3af0f6d --- /dev/null +++ b/mysql-clusters/storageclass.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: mysql +provisioner: rawfile.csi.openebs.io +reclaimPolicy: Retain +volumeBindingMode: WaitForFirstConsumer +allowVolumeExpansion: true +parameters: + fsType: "xfs" diff --git a/mysql-operator/README.md b/mysql-operator/README.md index 58cfe77..1b96cba 100644 --- a/mysql-operator/README.md +++ b/mysql-operator/README.md @@ -1,3 +1,8 @@ +# Oracle MySQL operator + +We have switched to MariaDB operator and this is not actually deployed in the cluster anymore + +``` helm template mysql-operator mysql-operator/mysql-operator --namespace mysql-operator --include-crds > application.yml kubectl apply -n mysql-operator -f application.yml -f application-extras.yml -f networkpolicy-base.yml - +``` diff --git a/postgres-clusters/README.md b/postgres-clusters/README.md index 5731ec5..2da8c43 100644 --- a/postgres-clusters/README.md +++ b/postgres-clusters/README.md @@ -1,6 +1,8 @@ # Postgres clusters -This is namespace for Postgres clusters managed by operator-bundle +This is namespace for Postgres clusters managed by Codemowers' sample +[postgres-database-operator](https://github.com/codemowers/operatorlib/tree/main/samples/postgres-database-operator) +which is deployed via [ArgoCD](https://argocd.k-space.ee/applications/argocd/postgres-database-operator) ``` kubectl create namespace postgres-clusters diff --git a/postgres-clusters/dedicated.yaml b/postgres-clusters/dedicated.yaml new file mode 100644 index 0000000..cc30eff --- /dev/null +++ b/postgres-clusters/dedicated.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: PostgresDatabaseClass +metadata: + name: dedicated + annotations: + kubernetes.io/description: "Dedicated Postgres cluster" +spec: + reclaimPolicy: Retain + replicas: 3 + storageClass: postgres + podSpec: + containers: + - name: postgres + image: postgres:13.11@sha256:0f18de936266e03891e186db616e530e0e4365ef5fb300d4bb27318538b80604 + imagePullPolicy: IfNotPresent + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/postgres-clusters/application.yaml b/postgres-clusters/pgweb.yaml similarity index 60% rename from postgres-clusters/application.yaml rename to postgres-clusters/pgweb.yaml index 21c5cc5..99f7fdd 100644 --- a/postgres-clusters/application.yaml +++ b/postgres-clusters/pgweb.yaml @@ -1,43 +1,4 @@ --- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterPostgresDatabaseClass -metadata: - name: dedicated -spec: - targetNamespace: postgres-clusters - description: "Dedicated Postgres cluster" - replicas: 3 - routers: 2 - storageClass: postgres - podSpec: - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterPostgresDatabaseClass -metadata: - name: shared -spec: - targetCluster: shared - targetNamespace: postgres-clusters - description: "Shared Postgres cluster" - replicas: 3 - routers: 2 - storageClass: postgres - podSpec: - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -74,6 +35,16 @@ spec: port: 8081 targetPort: 8081 --- +apiVersion: codemowers.io/v1alpha1 +kind: OIDCGWMiddlewareClient +metadata: + name: pgweb +spec: + displayName: pgweb + uri: 'https://pgweb.k-space.ee' + allowedGroups: + - k-space:floor +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -84,7 +55,7 @@ metadata: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee - traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd + traefik.ingress.kubernetes.io/router.middlewares: postgres-clusters-pgweb@kubernetescrd spec: rules: - host: pgweb.k-space.ee diff --git a/postgres-clusters/shared.yaml b/postgres-clusters/shared.yaml new file mode 100644 index 0000000..cde6330 --- /dev/null +++ b/postgres-clusters/shared.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: PostgresDatabaseClass +metadata: + name: shared + annotations: + kubernetes.io/description: "Shared Postgres cluster" +spec: + reclaimPolicy: Retain + shared: true + replicas: 3 + storageClass: postgres + podSpec: + containers: + - name: postgres + image: postgres:13.11@sha256:0f18de936266e03891e186db616e530e0e4365ef5fb300d4bb27318538b80604 + imagePullPolicy: IfNotPresent + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/postgres-clusters/storageclass.yaml b/postgres-clusters/storageclass.yaml new file mode 100644 index 0000000..68ca31f --- /dev/null +++ b/postgres-clusters/storageclass.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: postgres +provisioner: rawfile.csi.openebs.io +reclaimPolicy: Retain +volumeBindingMode: WaitForFirstConsumer +allowVolumeExpansion: true +parameters: + fsType: "xfs" diff --git a/redis-clusters/README.md b/redis-clusters/README.md index 45e0447..4a21e65 100644 --- a/redis-clusters/README.md +++ b/redis-clusters/README.md @@ -1,7 +1,8 @@ # Redis clusters -This is namespace for Redis clusters managed by -[Codemowers' Operator Bundle](https://github.com/codemowers/operator-bundle) +This is namespace for Redis clusters managed by Codemowers' sample +[redis-operator](https://github.com/codemowers/operatorlib/tree/main/samples/redis-operator) +which is deployed via [ArgoCD](https://argocd.k-space.ee/applications/argocd/redis-operator) ``` kubectl create namespace redis-clusters diff --git a/redis-clusters/application.yaml b/redis-clusters/application.yaml deleted file mode 100644 index 8701d70..0000000 --- a/redis-clusters/application.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterRedisClass -metadata: - name: persistent -spec: - targetNamespace: redis-clusters - description: "Persistent Redis instance" - replicas: 3 - storageClass: redis - podSpec: - imagePullPolicy: Never - containers: - - name: redis - image: codemowers/keydb:6.3.2 - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage ---- -apiVersion: codemowers.io/v1alpha1 -kind: ClusterRedisClass -metadata: - name: ephemeral -spec: - targetNamespace: redis-clusters - description: "Ephemeral Redis instance" - replicas: 3 - podSpec: - imagePullPolicy: Never - containers: - - name: redis - image: codemowers/keydb:6.3.2 - nodeSelector: - dedicated: storage - tolerations: - - effect: NoSchedule - key: dedicated - operator: Equal - value: storage diff --git a/redis-clusters/cache.yaml b/redis-clusters/cache.yaml new file mode 100644 index 0000000..4985816 --- /dev/null +++ b/redis-clusters/cache.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: RedisClass +metadata: + name: cache + annotations: + kubernetes.io/description: "Caching Redis instance" +spec: + reclaimPolicy: Delete + replicas: 1 + podSpec: + containers: + - name: redis + image: docker.io/library/redis:7.0.11@sha256:1008c73f08e9f913868e2fa2e843212b62ea5bf3c66435d87bc7a6207bc0f1b4 + imagePullPolicy: IfNotPresent + args: + - --maxmemory-policy + - volatile-lfu diff --git a/redis-clusters/ephemeral.yaml b/redis-clusters/ephemeral.yaml new file mode 100644 index 0000000..8862384 --- /dev/null +++ b/redis-clusters/ephemeral.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: RedisClass +metadata: + name: ephemeral + annotations: + kubernetes.io/description: "Ephemeral Redis cluster" +spec: + reclaimPolicy: Delete + replicas: 3 + podSpec: + containers: + - name: redis + image: docker.io/library/redis:7.0.11@sha256:1008c73f08e9f913868e2fa2e843212b62ea5bf3c66435d87bc7a6207bc0f1b4 + imagePullPolicy: IfNotPresent + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/redis-clusters/persistent.yaml b/redis-clusters/persistent.yaml new file mode 100644 index 0000000..163ca0c --- /dev/null +++ b/redis-clusters/persistent.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: RedisClass +metadata: + name: persistent + annotations: + kubernetes.io/description: "Persistent Redis instance" +spec: + reclaimPolicy: Retain + replicas: 3 + storageClass: redis + podSpec: + containers: + - name: redis + image: docker.io/library/redis:7.0.11@sha256:1008c73f08e9f913868e2fa2e843212b62ea5bf3c66435d87bc7a6207bc0f1b4 + imagePullPolicy: IfNotPresent + args: + - --activedefrag yes + nodeSelector: + dedicated: storage + tolerations: + - effect: NoSchedule + key: dedicated + operator: Equal + value: storage diff --git a/redis-clusters/session.yaml b/redis-clusters/session.yaml new file mode 100644 index 0000000..e69de29 diff --git a/redis-clusters/storageclass.yaml b/redis-clusters/storageclass.yaml new file mode 100644 index 0000000..895482f --- /dev/null +++ b/redis-clusters/storageclass.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: redis +provisioner: rawfile.csi.openebs.io +reclaimPolicy: Retain +volumeBindingMode: WaitForFirstConsumer +allowVolumeExpansion: true +parameters: + fsType: "xfs" diff --git a/storage-class.yaml b/storage-class.yaml index b94eb80..ac61ed5 100644 --- a/storage-class.yaml +++ b/storage-class.yaml @@ -12,17 +12,6 @@ parameters: --- apiVersion: storage.k8s.io/v1 kind: StorageClass -metadata: - name: minio -provisioner: rawfile.csi.openebs.io -reclaimPolicy: Retain -volumeBindingMode: WaitForFirstConsumer -allowVolumeExpansion: true -parameters: - fsType: "xfs" ---- -apiVersion: storage.k8s.io/v1 -kind: StorageClass metadata: name: prometheus provisioner: rawfile.csi.openebs.io @@ -34,28 +23,6 @@ parameters: --- apiVersion: storage.k8s.io/v1 kind: StorageClass -metadata: - name: postgres -provisioner: rawfile.csi.openebs.io -reclaimPolicy: Retain -volumeBindingMode: WaitForFirstConsumer -allowVolumeExpansion: true -parameters: - fsType: "xfs" ---- -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: mysql -provisioner: rawfile.csi.openebs.io -reclaimPolicy: Retain -volumeBindingMode: WaitForFirstConsumer -allowVolumeExpansion: true -parameters: - fsType: "xfs" ---- -apiVersion: storage.k8s.io/v1 -kind: StorageClass metadata: name: woodpecker provisioner: driver.longhorn.io From 6adcb53e96107feb7e0e8371a8f8ac073f5c9978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:41:43 +0300 Subject: [PATCH 34/77] gitea: Disable releases and wiki --- gitea/application.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitea/application.yaml b/gitea/application.yaml index 144c5e5..55882ff 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -82,6 +82,8 @@ spec: securityContext: readOnlyRootFilesystem: true env: + - name: GITEA__REPOSITORY__DISABLED_REPO_UNITS + value: repo.releases,repo.wiki - name: GITEA__ADMIN__DISABLE_REGULAR_ORG_CREATION value: "true" - name: GITEA__SERVER__SSH_SERVER_HOST_KEYS From d6a1d48c03ebf7c4460b61dfb90fe60296d425e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 10:45:55 +0300 Subject: [PATCH 35/77] logmower: Cleanups --- logmower/application.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/logmower/application.yml b/logmower/application.yml index 4d6f8f3..1b781d4 100644 --- a/logmower/application.yml +++ b/logmower/application.yml @@ -7,6 +7,7 @@ spec: displayName: Kubernetes pod log aggregator uri: 'https://log.k-space.ee' allowedGroups: + - k-space:kubernetes:developers - k-space:kubernetes:admins headerMapping: email: Remote-Email @@ -22,7 +23,7 @@ spec: size: 32 mapping: - key: password - value: "%(password)s" + value: "%(plaintext)s" --- apiVersion: codemowers.cloud/v1beta1 kind: SecretClaim From d4d44bc6d3fc621bf343580a3a85b435891dd4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 11:35:41 +0300 Subject: [PATCH 36/77] rosdump: Fix NetworkPolicies for in-kube Gitea --- rosdump/application.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rosdump/application.yml b/rosdump/application.yml index 8324a52..1955235 100644 --- a/rosdump/application.yml +++ b/rosdump/application.yml @@ -98,15 +98,14 @@ spec: - Egress egress: - to: - - ipBlock: - cidr: 193.40.103.0/24 + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: gitea - ipBlock: cidr: 172.23.0.0/24 - ipBlock: cidr: 100.102.1.0/24 - ports: - - protocol: TCP - port: 22 + --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule From ebd723d8fd68fcf850eb287185902f700a330146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 11:38:05 +0300 Subject: [PATCH 37/77] Remove keel --- keel/README.md | 10 --- keel/application.yml | 176 ------------------------------------------- 2 files changed, 186 deletions(-) delete mode 100644 keel/README.md delete mode 100644 keel/application.yml diff --git a/keel/README.md b/keel/README.md deleted file mode 100644 index 35d1e1c..0000000 --- a/keel/README.md +++ /dev/null @@ -1,10 +0,0 @@ -To generate secrets and to deploy: - -``` -kubectl create secret generic -n $(basename $(pwd)) application-secrets \ - --from-literal=BASIC_AUTH_PASSWORD=$(cat /dev/urandom | base64 | head -c 30) \ - --from-literal=MAIL_SMTP_PASS=... \ - --from-literal=SLACK_TOKEN=... -kubectl apply -n keel -f application.yml -kubectl -n keel rollout restart deployment.apps/keel -``` diff --git a/keel/application.yml b/keel/application.yml deleted file mode 100644 index a28df13..0000000 --- a/keel/application.yml +++ /dev/null @@ -1,176 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: keel - namespace: keel - labels: - app: keel ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: keel -rules: - - apiGroups: - - "" - resources: - - namespaces - verbs: - - watch - - list - - apiGroups: - - "" - resources: - - secrets - verbs: - - get - - watch - - list - - apiGroups: - - "" - - extensions - - apps - - batch - resources: - - pods - - replicasets - - replicationcontrollers - - statefulsets - - deployments - - daemonsets - - jobs - - cronjobs - verbs: - - get - - delete # required to delete pods during force upgrade of the same tag - - watch - - list - - update - - apiGroups: - - "" - resources: - - configmaps - - pods/portforward - verbs: - - get - - create - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: keel -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: keel -subjects: - - kind: ServiceAccount - name: keel - namespace: keel ---- -apiVersion: v1 -kind: Service -metadata: - name: keel - namespace: keel - labels: - app: keel -spec: - type: ClusterIP - ports: - - port: 9300 - targetPort: 9300 - protocol: TCP - name: keel - selector: - app: keel ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: keel - labels: - app: keel - annotations: - keel.sh/policy: force - keel.sh/trigger: poll - keel.sh/pollSchedule: "@midnight" -spec: - replicas: 1 - serviceName: keel - selector: - matchLabels: - app: keel - template: - metadata: - labels: - app: keel - spec: - serviceAccountName: keel - containers: - - name: keel - image: keelhq/keel:latest - imagePullPolicy: Always - command: ["/bin/keel"] - volumeMounts: - env: - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POLL - value: "true" - - name: HELM_PROVIDER - value: "false" - - name: TILLER_NAMESPACE - value: "kube-system" - - name: TILLER_ADDRESS - value: "tiller-deploy:44134" - - name: NOTIFICATION_LEVEL - value: "info" - - name: BASIC_AUTH_USER - value: admin - - name: SLACK_CHANNELS - value: kube-prod - - name: SLACK_BOT_NAME - value: keel.k-space.ee - envFrom: - - secretRef: - name: application-secrets - ports: - - containerPort: 9300 - livenessProbe: - httpGet: - path: /healthz - port: 9300 - initialDelaySeconds: 30 - timeoutSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - port: 9300 - initialDelaySeconds: 30 - timeoutSeconds: 10 - resources: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 50m - memory: 64Mi - - volumeMounts: - - name: keel-data - mountPath: /data - volumeClaimTemplates: - - metadata: - name: keel-data - spec: - storageClassName: longhorn - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2Gi From 4fa49dbf8a0bbbbb8fe885c17b187c7d89b7429a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 15:56:29 +0300 Subject: [PATCH 38/77] mysql-clusters: Rename phpMyAdmin manifest --- mysql-clusters/{application.yaml => phpmyadmin.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mysql-clusters/{application.yaml => phpmyadmin.yaml} (100%) diff --git a/mysql-clusters/application.yaml b/mysql-clusters/phpmyadmin.yaml similarity index 100% rename from mysql-clusters/application.yaml rename to mysql-clusters/phpmyadmin.yaml From 14a5d703cbf51903e2ac853922c2e74162c93e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 22:18:30 +0300 Subject: [PATCH 39/77] wikijs: Add Job for resetting OIDC config --- wiki/reset-oidc-config.yaml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 wiki/reset-oidc-config.yaml diff --git a/wiki/reset-oidc-config.yaml b/wiki/reset-oidc-config.yaml new file mode 100644 index 0000000..86f4fbd --- /dev/null +++ b/wiki/reset-oidc-config.yaml @@ -0,0 +1,44 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: reset-oidc-config +spec: + template: + spec: + volumes: + - name: tmp + emptyDir: {} + initContainers: + - name: jq + image: alpine/k8s:1.24.16@sha256:06f8942d87fa17b40795bb9a8eff029a9be3fc3c9bcc13d62071de4cc3324153 + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /tmp + name: tmp + envFrom: + - secretRef: + name: oidc-client-wiki-owner-secrets + command: + - /bin/bash + - -c + - jq '{"strategyKey":"oidc","config":{"clientId":$ENV.OIDC_CLIENT_ID,"clientSecret":$ENV.OIDC_CLIENT_SECRET,"authorizationURL":$ENV.OIDC_GATEWAY_AUTH_URI,"tokenURL":$ENV.OIDC_GATEWAY_TOKEN_URI,"userInfoURL":$ENV.OIDC_GATEWAY_USERINFO_URI,"skipUserProfile":false,"issuer":$ENV.OIDC_GATEWAY_URI,"emailClaim":"email","displayNameClaim":"name","mapGroups":false,"groupsClaim":"groups","logoutURL":$ENV.OIDC_GATEWAY_URI,"acrValues":""}} | "UPDATE authentication SET config=\(.config|tostring|@sh) WHERE strategyKey=\(.strategyKey|tostring|@sh) LIMIT 1"' -n -r > /tmp/update.sql + containers: + - name: mysql + image: mysql + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /tmp + name: tmp + env: + - name: MYSQL_PWD + valueFrom: + secretKeyRef: + name: wikijs-secrets + key: DB_PASS + command: + - /bin/bash + - -c + - mysql -u kspace_wiki kspace_wiki -h 172.20.36.1 -p${MYSQL_PWD} < /tmp/update.sql + restartPolicy: OnFailure + backoffLimit: 4 From a828b602d69fd581210750c5130d64d5bfa01d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 22:41:41 +0300 Subject: [PATCH 40/77] freescout: Add Job for resetting OIDC config --- freescout/reset-oidc-config.yaml | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 freescout/reset-oidc-config.yaml diff --git a/freescout/reset-oidc-config.yaml b/freescout/reset-oidc-config.yaml new file mode 100644 index 0000000..e880bd3 --- /dev/null +++ b/freescout/reset-oidc-config.yaml @@ -0,0 +1,50 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: reset-oidc-config +spec: + template: + spec: + volumes: + - name: tmp + emptyDir: {} + initContainers: + - name: jq + image: alpine/k8s:1.24.16@sha256:06f8942d87fa17b40795bb9a8eff029a9be3fc3c9bcc13d62071de4cc3324153 + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /tmp + name: tmp + envFrom: + - secretRef: + name: oidc-client-freescout-owner-secrets + command: + - /bin/bash + - -c + - rm -fv /tmp/update.sql; + jq '{"name":"oauth.client_id","value":$ENV.OIDC_CLIENT_ID} | "UPDATE options SET value=\(.value|tostring|@sh) WHERE name=\(.name|tostring|@sh) LIMIT 1;"' -n -r >> /tmp/update.sql; + jq '{"name":"oauth.client_secret","value":$ENV.OIDC_CLIENT_SECRET} | "UPDATE options SET value=\(.value|tostring|@sh) WHERE name=\(.name|tostring|@sh) LIMIT 1;"' -n -r >> /tmp/update.sql; + jq '{"name":"oauth.auth_url","value":$ENV.OIDC_GATEWAY_AUTH_URI} | "UPDATE options SET value=\(.value + "?scope=openid+profile" |tostring|@sh) WHERE name=\(.name|tostring|@sh) LIMIT 1;"' -n -r >> /tmp/update.sql; + jq '{"name":"oauth.token_url","value":$ENV.OIDC_GATEWAY_TOKEN_URI} | "UPDATE options SET value=\(.value|tostring|@sh) WHERE name=\(.name|tostring|@sh) LIMIT 1;"' -n -r >> /tmp/update.sql; + jq '{"name":"oauth.user_url","value":$ENV.OIDC_GATEWAY_USERINFO_URI} | "UPDATE options SET value=\(.value|tostring|@sh) WHERE name=\(.name|tostring|@sh) LIMIT 1;"' -n -r >> /tmp/update.sql; + cat /tmp/update.sql + containers: + - name: mysql + image: mysql + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /tmp + name: tmp + env: + - name: MYSQL_PWD + valueFrom: + secretKeyRef: + name: freescout-secrets + key: DB_PASS + command: + - /bin/bash + - -c + - mysql -u kspace_freescout kspace_freescout -h 172.20.36.1 -p${MYSQL_PWD} < /tmp/update.sql + restartPolicy: OnFailure + backoffLimit: 4 From d56348f9a65dad5cc375eb091f1b80570eab8ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 17 Aug 2023 11:57:32 +0300 Subject: [PATCH 41/77] wildduck: Add Prometheus exporter --- wildduck/wildduck-exporter.yaml | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 wildduck/wildduck-exporter.yaml diff --git a/wildduck/wildduck-exporter.yaml b/wildduck/wildduck-exporter.yaml new file mode 100644 index 0000000..bd2f1b5 --- /dev/null +++ b/wildduck/wildduck-exporter.yaml @@ -0,0 +1,68 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: wildduck-exporter + namespace: wildduck +spec: + size: 32 + mapping: + - key: PROMETHEUS_BEARER_TOKEN + value: "%(plaintext)s" +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: wildduck-exporter + namespace: wildduck +spec: + podMetricsEndpoints: + - bearerTokenSecret: + key: PROMETHEUS_BEARER_TOKEN + name: wildduck-exporter + targetPort: 3001 + selector: + matchLabels: + app: wildduck-exporter +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wildduck-exporter + namespace: wildduck +spec: + replicas: 1 + selector: + matchLabels: + app: wildduck-exporter + template: + metadata: + labels: + app: wildduck-exporter + spec: + containers: + - name: webmail + image: harbor.k-space.ee/k-space/wildduck-exporter + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 65534 + command: + - /wildduck_exporter.py + args: + - info + - accounting + ports: + - containerPort: 3001 + name: metrics + env: + - name: MONGODB_HOST + valueFrom: + secretKeyRef: + name: wildduck + key: MONGO_URI + - name: PROMETHEUS_BEARER_TOKEN + valueFrom: + secretKeyRef: + name: wildduck-exporter + key: PROMETHEUS_BEARER_TOKEN From bc5dcce5f76ce85bac8813265a00b40e5bc91828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 17 Aug 2023 11:58:38 +0300 Subject: [PATCH 42/77] wildflock: Limit ACL-s --- wildduck/wildflock.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index 142bb64..7716ff9 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -14,6 +14,9 @@ kind: OIDCGWClient metadata: name: wildflock spec: + allowedGroups: + - k-space:floor + - k-space:friends displayName: Wildduck disposable alias generator uri: "https://wildflock.k-space.ee/auth-oidc" redirectUris: From c8a7aecc2f74e3cb0807a71878ebc3a7511bcc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 17 Aug 2023 11:59:49 +0300 Subject: [PATCH 43/77] camtiler: Allow hackerspace friends to see cams --- camtiler/ingress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/camtiler/ingress.yml b/camtiler/ingress.yml index c4a4dde..8ebb2d6 100644 --- a/camtiler/ingress.yml +++ b/camtiler/ingress.yml @@ -8,6 +8,7 @@ spec: uri: 'https://cams.k-space.ee/tiled' allowedGroups: - k-space:floor + - k-space:friends --- apiVersion: networking.k8s.io/v1 kind: Ingress From 1361c9ec22436f66846ad84e0d92cba1cdcf4f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 17 Aug 2023 23:38:26 +0300 Subject: [PATCH 44/77] Migrate Asterisk --- asterisk/.gitignore | 1 + asterisk/application.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 asterisk/.gitignore create mode 100644 asterisk/application.yml diff --git a/asterisk/.gitignore b/asterisk/.gitignore new file mode 100644 index 0000000..32814ee --- /dev/null +++ b/asterisk/.gitignore @@ -0,0 +1 @@ +conf diff --git a/asterisk/application.yml b/asterisk/application.yml new file mode 100644 index 0000000..14de5d2 --- /dev/null +++ b/asterisk/application.yml @@ -0,0 +1,43 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: asterisk + annotations: + external-dns.alpha.kubernetes.io/hostname: voip.k-space.ee +spec: + type: LoadBalancer + externalTrafficPolicy: Local + selector: + app: asterisk + ports: + - name: sip + protocol: UDP + port: 5060 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: asterisk + labels: + app: asterisk +spec: + selector: + matchLabels: + app: asterisk + replicas: 1 + template: + metadata: + labels: + app: asterisk + spec: + containers: + - name: asterisk + image: harbor.k-space.ee/k-space/asterisk + volumeMounts: + - name: config + mountPath: /etc/asterisk + volumes: + - name: config + secret: + secretName: asterisk-secrets From 3a69c1a210ac940d06df56ec0ccd2464b8f65abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 17 Aug 2023 23:53:24 +0300 Subject: [PATCH 45/77] camtiler: Use external bucket --- camtiler/application.yml | 42 +++++---- camtiler/minio.yml | 199 --------------------------------------- 2 files changed, 26 insertions(+), 215 deletions(-) delete mode 100644 camtiler/minio.yml diff --git a/camtiler/application.yml b/camtiler/application.yml index 05f5304..dc31e09 100644 --- a/camtiler/application.yml +++ b/camtiler/application.yml @@ -1,4 +1,12 @@ --- +apiVersion: codemowers.cloud/v1beta1 +kind: MinioBucketClaim +metadata: + name: camtiler +spec: + capacity: 1Ti + class: external +--- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -105,10 +113,6 @@ spec: kind: Deployment metadata: name: camera-foobar - # Make sure keel.sh pulls updates for this deployment - annotations: - keel.sh/policy: force - keel.sh/trigger: poll spec: revisionHistoryLimit: 0 replicas: 1 @@ -166,9 +170,25 @@ spec: - name: SOURCE_NAME value: foobar - name: S3_BUCKET_NAME - value: application + valueFrom: + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: BUCKET_NAME - name: S3_ENDPOINT_URL - value: http://minio + valueFrom: + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: AWS_S3_ENDPOINT_URL + - name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: AWS_SECRET_ACCESS_KEY + - name: AWS_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: AWS_ACCESS_KEY_ID - name: BASIC_AUTH_PASSWORD valueFrom: secretKeyRef: @@ -179,16 +199,6 @@ spec: secretKeyRef: name: mongodb-application-readwrite key: connectionString.standard - - name: AWS_SECRET_ACCESS_KEY - valueFrom: - secretKeyRef: - name: minio-secrets - key: MINIO_ROOT_PASSWORD - - name: AWS_ACCESS_KEY_ID - valueFrom: - secretKeyRef: - name: minio-secrets - key: MINIO_ROOT_USER # Make sure 2+ pods of same camera are scheduled on different hosts affinity: diff --git a/camtiler/minio.yml b/camtiler/minio.yml deleted file mode 100644 index 1645724..0000000 --- a/camtiler/minio.yml +++ /dev/null @@ -1,199 +0,0 @@ ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: minio - labels: - app.kubernetes.io/name: minio -spec: - selector: - matchLabels: - app.kubernetes.io/name: minio - serviceName: minio-svc - replicas: 4 - podManagementPolicy: Parallel - template: - metadata: - labels: - app.kubernetes.io/name: minio - spec: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - minio - topologyKey: topology.kubernetes.io/zone - nodeSelector: - dedicated: storage - tolerations: - - key: dedicated - operator: Equal - value: storage - effect: NoSchedule - containers: - - name: minio - env: - - name: MINIO_PROMETHEUS_AUTH_TYPE - value: public - envFrom: - - secretRef: - name: minio-secrets - image: minio/minio:RELEASE.2022-12-12T19-27-27Z - args: - - server - - http://minio-{0...3}.minio-svc.camtiler.svc.cluster.local/data - - --address - - 0.0.0.0:9000 - - --console-address - - 0.0.0.0:9001 - ports: - - containerPort: 9000 - name: http - - containerPort: 9001 - name: console - readinessProbe: - httpGet: - path: /minio/health/ready - port: 9000 - initialDelaySeconds: 2 - periodSeconds: 5 - resources: - requests: - cpu: 300m - memory: 1Gi - limits: - cpu: 4000m - memory: 2Gi - volumeMounts: - - name: minio-data - mountPath: /data - volumeClaimTemplates: - - metadata: - name: minio-data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: '30Gi' - storageClassName: minio ---- -apiVersion: v1 -kind: Service -metadata: - name: minio -spec: - sessionAffinity: ClientIP - type: ClusterIP - ports: - - port: 80 - targetPort: 9000 - protocol: TCP - name: http - selector: - app.kubernetes.io/name: minio ---- -kind: Service -apiVersion: v1 -metadata: - name: minio-svc -spec: - selector: - app.kubernetes.io/name: minio - clusterIP: None - publishNotReadyAddresses: true - ports: - - name: http - port: 9000 - - name: console - port: 9001 ---- -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - name: minio -spec: - selector: - matchLabels: - app.kubernetes.io/name: minio - podMetricsEndpoints: - - port: http - path: /minio/v2/metrics/node - podTargetLabels: - - app.kubernetes.io/name ---- -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: minio -spec: - endpoints: - - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - honorLabels: true - port: minio - path: /minio/v2/metrics/cluster - selector: - matchLabels: - app.kubernetes.io/name: minio ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: minio - annotations: - kubernetes.io/ingress.class: traefik - traefik.ingress.kubernetes.io/router.entrypoints: websecure - traefik.ingress.kubernetes.io/router.tls: "true" - external-dns.alpha.kubernetes.io/target: traefik.k-space.ee -spec: - rules: - - host: cams-s3.k-space.ee - http: - paths: - - pathType: Prefix - path: "/" - backend: - service: - name: minio-svc - port: - name: http - tls: - - hosts: - - "*.k-space.ee" ---- -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - name: minio -spec: - groups: - - name: minio - rules: - - alert: MinioClusterDiskOffline - expr: minio_cluster_disk_offline_total > 0 - for: 0m - labels: - severity: critical - annotations: - summary: Minio cluster disk offline (instance {{ $labels.instance }}) - description: "Minio cluster disk is offline" - - alert: MinioNodeDiskOffline - expr: minio_cluster_nodes_offline_total > 0 - for: 0m - labels: - severity: critical - annotations: - summary: Minio node disk offline (instance {{ $labels.instance }}) - description: "Minio cluster node disk is offline" - - alert: MinioDiskSpaceUsage - expr: disk_storage_available / disk_storage_total * 100 < 10 - for: 0m - labels: - severity: warning - annotations: - summary: Minio disk space usage (instance {{ $labels.instance }}) - description: "Minio available free space is low (< 10%)" From 95597c3103d5653783b2ee6149f9cad8d24b4567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 18 Aug 2023 00:50:27 +0300 Subject: [PATCH 46/77] prometheus-operator: Pin SNMP exporter --- prometheus-operator/snmp-exporter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prometheus-operator/snmp-exporter.yml b/prometheus-operator/snmp-exporter.yml index 4df3072..a9caeec 100644 --- a/prometheus-operator/snmp-exporter.yml +++ b/prometheus-operator/snmp-exporter.yml @@ -13,9 +13,9 @@ spec: app: snmp-exporter spec: containers: - - image: prom/snmp-exporter:latest + - image: prom/snmp-exporter:v0.22.0 name: snmp-exporter - imagePullPolicy: Always + imagePullPolicy: IfNotPresent securityContext: runAsNonRoot: true runAsUser: 1000 From b0fd37de017de58467a563b69298942ccd625482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 18 Aug 2023 07:42:37 +0300 Subject: [PATCH 47/77] asterisk: Disable colored logging and add metrics container port --- asterisk/application.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/asterisk/application.yml b/asterisk/application.yml index 14de5d2..2c41b4b 100644 --- a/asterisk/application.yml +++ b/asterisk/application.yml @@ -34,9 +34,16 @@ spec: containers: - name: asterisk image: harbor.k-space.ee/k-space/asterisk + command: + - /usr/sbin/asterisk + args: + - -TWBpvvvdddf volumeMounts: - name: config mountPath: /etc/asterisk + ports: + - containerPort: 8088 + name: metrics volumes: - name: config secret: From b80d566927e5d4d11afb38483f94355b0de5ffb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 18 Aug 2023 08:37:58 +0300 Subject: [PATCH 48/77] asterisk: Add pod monitor and alerting rules --- asterisk/application.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/asterisk/application.yml b/asterisk/application.yml index 2c41b4b..f6a4594 100644 --- a/asterisk/application.yml +++ b/asterisk/application.yml @@ -48,3 +48,44 @@ spec: - name: config secret: secretName: asterisk-secrets +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: asterisk +spec: + selector: + matchLabels: + app: asterisk + podMetricsEndpoints: + - port: metrics +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: asterisk +spec: + groups: + - name: asterisk + rules: + - alert: AsteriskPhoneNotRegistered + expr: asterisk_endpoints_state{resource=~"1.*"} < 2 + for: 5m + labels: + severity: critical + annotations: + summary: "{{ $labels.resource }} is not registered." + - alert: AsteriskOutboundNumberNotRegistered + expr: asterisk_pjsip_outbound_registration_status == 0 + for: 5m + labels: + severity: critical + annotations: + summary: "{{ $labels.username }} is not registered with provider." + - alert: AsteriskCallsPerMinuteLimitExceed + expr: asterisk_channels_duration_seconds > 10*60 + for: 20m + labels: + severity: warning + annotations: + summary: "Call at channel {{ $labels.name }} is taking longer than 10m." From 8f07b2ef89048c6ec8a431e9190acdd96c49806e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 18 Aug 2023 16:40:18 +0300 Subject: [PATCH 49/77] camtiler: Fix event broker config --- camtiler/logmower.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/camtiler/logmower.yml b/camtiler/logmower.yml index 42317b5..b789f2c 100644 --- a/camtiler/logmower.yml +++ b/camtiler/logmower.yml @@ -96,20 +96,23 @@ spec: ports: - containerPort: 3000 env: + - name: MINIO_BUCKET + valueFrom: + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: BUCKET_NAME - name: AWS_SECRET_ACCESS_KEY valueFrom: - secretKeyRef: - name: minio-secrets - key: MINIO_ROOT_PASSWORD + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: AWS_SECRET_ACCESS_KEY - name: AWS_ACCESS_KEY_ID valueFrom: - secretKeyRef: - name: minio-secrets - key: MINIO_ROOT_USER - - name: MINIO_BUCKET - value: 'application' + secretKeyRef: + name: miniobucket-camtiler-owner-secrets + key: AWS_ACCESS_KEY_ID - name: MINIO_HOSTNAME - value: 'cams-s3.k-space.ee' + value: 'external.minio-clusters.k-space.ee' - name: MINIO_PORT value: '443' - name: MINIO_SCHEMA From 62661efc42d75a61e36857e6ab0894977f4d5db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 08:41:44 +0300 Subject: [PATCH 50/77] prometheus-operator: Drop mfp-cyber.pub.k-space.ee --- prometheus-operator/snmp-exporter.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/prometheus-operator/snmp-exporter.yml b/prometheus-operator/snmp-exporter.yml index a9caeec..dd221b0 100644 --- a/prometheus-operator/snmp-exporter.yml +++ b/prometheus-operator/snmp-exporter.yml @@ -143,7 +143,6 @@ spec: targets: staticConfig: static: - - mfp-cyber.pub.k-space.ee - mfp-chaos.pub.k-space.ee --- apiVersion: monitoring.coreos.com/v1 From 6e2f353916129594384f9fae98fb543719cb2278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 09:13:59 +0300 Subject: [PATCH 51/77] Move Prometheus instance to monitoring namespace --- monitoring/README.md | 28 ++++++++ monitoring/alertmanager.yaml | 62 +++++++++++++++++ .../blackbox-exporter.yaml | 2 +- .../mikrotik-exporter.yaml | 0 .../node-exporter.yaml | 0 .../prometheus.yaml | 69 ++----------------- .../snmp.yml => monitoring/snmp-configs.yaml | 0 .../snmp-exporter.yaml | 0 prometheus-operator/README.md | 23 +------ 9 files changed, 98 insertions(+), 86 deletions(-) create mode 100644 monitoring/README.md create mode 100644 monitoring/alertmanager.yaml rename prometheus-operator/blackbox-exporter.yml => monitoring/blackbox-exporter.yaml (99%) rename prometheus-operator/mikrotik-exporter.yml => monitoring/mikrotik-exporter.yaml (100%) rename prometheus-operator/node-exporter.yml => monitoring/node-exporter.yaml (100%) rename prometheus-operator/application.yml => monitoring/prometheus.yaml (90%) rename prometheus-operator/snmp.yml => monitoring/snmp-configs.yaml (100%) rename prometheus-operator/snmp-exporter.yml => monitoring/snmp-exporter.yaml (100%) diff --git a/monitoring/README.md b/monitoring/README.md new file mode 100644 index 0000000..f15edd9 --- /dev/null +++ b/monitoring/README.md @@ -0,0 +1,28 @@ +## Monitoring + +This namespace is managed by +[ArgoCD](https://argocd.k-space.ee/applications/argocd/monitoring) + +To reconfigure SNMP targets etc: + +``` +kubectl delete -n monitoring configmap snmp-exporter +kubectl create -n monitoring configmap snmp-exporter --from-file=snmp.yml=snmp-configs.yaml +``` + +To set Slack secrets: + +``` + kubectl create -n monitoring secret generic slack-secrets \ + --from-literal=webhook-url=https://hooks.slack.com/services/... +``` + +To set Mikrotik secrets: + +``` + kubectl create -n monitoring secret generic mikrotik-exporter \ + --from-literal=MIKROTIK_PASSWORD='f7W!H*Pu' \ + --from-literal=PROMETHEUS_BEARER_TOKEN=$(cat /dev/urandom | base64 | head -c 30) +``` + + diff --git a/monitoring/alertmanager.yaml b/monitoring/alertmanager.yaml new file mode 100644 index 0000000..3bb061b --- /dev/null +++ b/monitoring/alertmanager.yaml @@ -0,0 +1,62 @@ +--- +apiVersion: monitoring.coreos.com/v1alpha1 +kind: AlertmanagerConfig +metadata: + name: alertmanager + labels: + app.kubernetes.io/name: alertmanager +spec: + route: + routes: + - continue: false + receiver: slack-notifications + matchers: + - matchType: "=" + name: severity + value: critical + receiver: 'null' + receivers: + - name: 'null' + - name: 'slack-notifications' + slackConfigs: + - channel: '#kube-prod' + sendResolved: true + apiURL: + name: slack-secrets + key: webhook-url + +--- +apiVersion: monitoring.coreos.com/v1 +kind: Alertmanager +metadata: + name: alertmanager +spec: + alertmanagerConfigMatcherStrategy: + type: None + alertmanagerConfigNamespaceSelector: {} + alertmanagerConfigSelector: {} + alertmanagerConfiguration: + name: alertmanager + secrets: + - slack-secrets + nodeSelector: + dedicated: monitoring + tolerations: + - key: dedicated + operator: Equal + value: monitoring + effect: NoSchedule + replicas: 3 + serviceAccountName: alertmanager + externalUrl: http://am.k-space.ee/ + routePrefix: "/" + securityContext: + fsGroup: 2000 + runAsGroup: 2000 + runAsNonRoot: true + runAsUser: 1000 +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: alertmanager diff --git a/prometheus-operator/blackbox-exporter.yml b/monitoring/blackbox-exporter.yaml similarity index 99% rename from prometheus-operator/blackbox-exporter.yml rename to monitoring/blackbox-exporter.yaml index 8a26943..e16b3a3 100644 --- a/prometheus-operator/blackbox-exporter.yml +++ b/monitoring/blackbox-exporter.yaml @@ -156,7 +156,7 @@ metadata: name: blackbox-exporter spec: revisionHistoryLimit: 0 - replicas: 3 + replicas: 2 selector: matchLabels: app: blackbox-exporter diff --git a/prometheus-operator/mikrotik-exporter.yml b/monitoring/mikrotik-exporter.yaml similarity index 100% rename from prometheus-operator/mikrotik-exporter.yml rename to monitoring/mikrotik-exporter.yaml diff --git a/prometheus-operator/node-exporter.yml b/monitoring/node-exporter.yaml similarity index 100% rename from prometheus-operator/node-exporter.yml rename to monitoring/node-exporter.yaml diff --git a/prometheus-operator/application.yml b/monitoring/prometheus.yaml similarity index 90% rename from prometheus-operator/application.yml rename to monitoring/prometheus.yaml index 27d1e5b..26b93fc 100644 --- a/prometheus-operator/application.yml +++ b/monitoring/prometheus.yaml @@ -1,30 +1,4 @@ --- -apiVersion: monitoring.coreos.com/v1alpha1 -kind: AlertmanagerConfig -metadata: - name: alertmanager - labels: - app.kubernetes.io/name: alertmanager -spec: - route: - routes: - - continue: false - receiver: slack-notifications - matchers: - - matchType: "=" - name: severity - value: critical - receiver: 'null' - receivers: - - name: 'null' - - name: 'slack-notifications' - slackConfigs: - - channel: '#kube-prod' - sendResolved: true - apiURL: - name: slack-secrets - key: webhook-url ---- apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: @@ -37,41 +11,6 @@ spec: - port: metrics --- apiVersion: monitoring.coreos.com/v1 -kind: Alertmanager -metadata: - name: alertmanager -spec: - alertmanagerConfigMatcherStrategy: - type: None - alertmanagerConfigNamespaceSelector: {} - alertmanagerConfigSelector: {} - alertmanagerConfiguration: - name: alertmanager - secrets: - - slack-secrets - nodeSelector: - dedicated: monitoring - tolerations: - - key: dedicated - operator: Equal - value: monitoring - effect: NoSchedule - replicas: 3 - serviceAccountName: alertmanager - externalUrl: http://am.k-space.ee/ - routePrefix: "/" - securityContext: - fsGroup: 2000 - runAsGroup: 2000 - runAsNonRoot: true - runAsUser: 1000 ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: alertmanager ---- -apiVersion: monitoring.coreos.com/v1 kind: Prometheus metadata: name: prometheus @@ -172,7 +111,7 @@ spec: description: "A Prometheus job has disappeared\n VALUE = {{ $value }}\n \ \ LABELS = {{ $labels }}" summary: Prometheus job missing (instance {{ $labels.instance }}) - expr: absent(up{job="prometheus-operator/prometheus"}) + expr: absent(up{job="monitoring/prometheus"}) for: 0m labels: severity: warning @@ -221,7 +160,7 @@ spec: \ $value }}\n LABELS = {{ $labels }}" summary: Prometheus AlertManager job missing (instance {{ $labels.instance }}) - expr: absent(up{job="prometheus-operator/alertmanager"}) + expr: absent(up{job="monitoring/alertmanager"}) for: 0m labels: severity: warning @@ -413,7 +352,7 @@ metadata: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee - traefik.ingress.kubernetes.io/router.middlewares: prometheus-operator-prometheus@kubernetescrd + traefik.ingress.kubernetes.io/router.middlewares: monitoring-prometheus@kubernetescrd spec: rules: - host: prom.k-space.ee @@ -438,7 +377,7 @@ metadata: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee - traefik.ingress.kubernetes.io/router.middlewares: prometheus-operator-alertmanager@kubernetescrd + traefik.ingress.kubernetes.io/router.middlewares: monitoring-alertmanager@kubernetescrd spec: rules: - host: am.k-space.ee diff --git a/prometheus-operator/snmp.yml b/monitoring/snmp-configs.yaml similarity index 100% rename from prometheus-operator/snmp.yml rename to monitoring/snmp-configs.yaml diff --git a/prometheus-operator/snmp-exporter.yml b/monitoring/snmp-exporter.yaml similarity index 100% rename from prometheus-operator/snmp-exporter.yml rename to monitoring/snmp-exporter.yaml diff --git a/prometheus-operator/README.md b/prometheus-operator/README.md index ef8e8be..ec28a2d 100644 --- a/prometheus-operator/README.md +++ b/prometheus-operator/README.md @@ -1,28 +1,11 @@ # Prometheus operator +To deploy Prometheus operator: + ``` curl -L https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.61.1/bundle.yaml | sed -e 's/namespace: default/namespace: prometheus-operator/g' > bundle.yml kubectl create namespace prometheus-operator kubectl apply --server-side -n prometheus-operator -f bundle.yml -kubectl delete -n prometheus-operator configmap snmp-exporter -kubectl create -n prometheus-operator configmap snmp-exporter --from-file=snmp.yml -kubectl apply -n prometheus-operator -f application.yml -f node-exporter.yml -f blackbox-exporter.yml -f snmp-exporter.yml -f mikrotik-exporter.yml -``` - - -# Slack - -``` - kubectl create -n prometheus-operator secret generic slack-secrets \ - --from-literal=webhook-url=https://hooks.slack.com/services/... -``` - - -# Mikrotik exporter - -``` - kubectl create -n prometheus-operator secret generic mikrotik-exporter \ - --from-literal=MIKROTIK_PASSWORD='f7W!H*Pu' \ - --from-literal=PROMETHEUS_BEARER_TOKEN=$(cat /dev/urandom | base64 | head -c 30) ``` +Note: Do not put any Prometheus instances or exporters in this namespace, instead have them in `monitoring` namespace From 2e67269b5bf9a3298053cc5635a56e6589dd69d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 09:26:13 +0300 Subject: [PATCH 52/77] prometheus-operator: Bump to 0.67.1 --- prometheus-operator/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus-operator/README.md b/prometheus-operator/README.md index ec28a2d..5da9e2f 100644 --- a/prometheus-operator/README.md +++ b/prometheus-operator/README.md @@ -3,7 +3,7 @@ To deploy Prometheus operator: ``` -curl -L https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.61.1/bundle.yaml | sed -e 's/namespace: default/namespace: prometheus-operator/g' > bundle.yml +curl -L https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.67.1/bundle.yaml | sed -e 's/namespace: default/namespace: prometheus-operator/g' > bundle.yml kubectl create namespace prometheus-operator kubectl apply --server-side -n prometheus-operator -f bundle.yml ``` From e5e72de45b7fbb640fe76ba976dee8e4ad8ebdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 09:30:10 +0300 Subject: [PATCH 53/77] monitoring: Namespace change fixes --- monitoring/prometheus.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitoring/prometheus.yaml b/monitoring/prometheus.yaml index 26b93fc..e6246fa 100644 --- a/monitoring/prometheus.yaml +++ b/monitoring/prometheus.yaml @@ -24,7 +24,7 @@ spec: effect: NoSchedule alerting: alertmanagers: - - namespace: prometheus-operator + - namespace: monitoring name: alertmanager-operated port: web externalUrl: "http://prom.k-space.ee/" @@ -96,7 +96,7 @@ roleRef: subjects: - kind: ServiceAccount name: prometheus - namespace: prometheus-operator + namespace: monitoring --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule From f67bd391bc6adb86b3f1be04e2b82f1536753b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 09:37:57 +0300 Subject: [PATCH 54/77] kube-system: Bump kube-state-metrics to 2.9.2 --- kube-system/kube-state-metrics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kube-system/kube-state-metrics.yml b/kube-system/kube-state-metrics.yml index ddd75cc..2728e8b 100644 --- a/kube-system/kube-state-metrics.yml +++ b/kube-system/kube-state-metrics.yml @@ -159,7 +159,7 @@ spec: spec: automountServiceAccountToken: true containers: - - image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.7.0 + - image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.9.2 args: - --metric-labels-allowlist=pods=[*] livenessProbe: From 06757a81e55f25c540362ad57a4dc43e5638f889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 09:50:53 +0300 Subject: [PATCH 55/77] logmower: Namespace change fixes --- logmower/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logmower/application.yml b/logmower/application.yml index 1b781d4..f386932 100644 --- a/logmower/application.yml +++ b/logmower/application.yml @@ -248,7 +248,7 @@ spec: - from: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: prometheus-operator + kubernetes.io/metadata.name: monitoring podSelector: matchLabels: app.kubernetes.io/name: prometheus From 90076f2dde8a4aeb88412a7e4f7789295570686b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 10:01:09 +0300 Subject: [PATCH 56/77] wildduck: Updates --- wildduck/README.md | 15 +++------------ wildduck/webmail.yaml | 1 + wildduck/wildduck-exporter.yaml | 1 + wildduck/wildflock.yaml | 1 + 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/wildduck/README.md b/wildduck/README.md index b42c6b4..8158285 100644 --- a/wildduck/README.md +++ b/wildduck/README.md @@ -1,13 +1,4 @@ -To deploy replace the API secret in configmaps/webmail.yml and: +# Wildduck stack -``` -kubectl -n wildduck apply -f application.yml -kubectl -n wildduck rollout restart deployment/webmail -``` - -To generate secrets: - -``` - kubectl create secret generic -n wildduck wildduck \ - --from-literal=WILDDUCK_API_TOKEN=$(cat /dev/urandom | base64 | head -c 30) -``` +This application is managed by +[ArgoCD](https://argocd.k-space.ee/applications/argocd/wildduck) diff --git a/wildduck/webmail.yaml b/wildduck/webmail.yaml index 2945805..6b38f52 100644 --- a/wildduck/webmail.yaml +++ b/wildduck/webmail.yaml @@ -64,6 +64,7 @@ metadata: name: webmail namespace: wildduck spec: + revisionHistoryLimit: 0 replicas: 2 selector: matchLabels: diff --git a/wildduck/wildduck-exporter.yaml b/wildduck/wildduck-exporter.yaml index bd2f1b5..0ad5d68 100644 --- a/wildduck/wildduck-exporter.yaml +++ b/wildduck/wildduck-exporter.yaml @@ -31,6 +31,7 @@ metadata: name: wildduck-exporter namespace: wildduck spec: + revisionHistoryLimit: 0 replicas: 1 selector: matchLabels: diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index 7716ff9..66df0d6 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -77,6 +77,7 @@ metadata: labels: app: wildflock spec: + revisionHistoryLimit: 0 selector: matchLabels: app: wildflock From aacbb20e13a9ad8855d0faa5f5c3db057018737e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 10:20:37 +0300 Subject: [PATCH 57/77] camtiler: Namespace change related fixes --- camtiler/application.yml | 14 ++++++++++++++ camtiler/network-policies.yml | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/camtiler/application.yml b/camtiler/application.yml index dc31e09..b66e514 100644 --- a/camtiler/application.yml +++ b/camtiler/application.yml @@ -339,3 +339,17 @@ spec: target: http://user@100.102.3.1:8080/?action=stream secretRef: camera-secrets replicas: 1 +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: camera-motion-detect +spec: + selector: + matchLabels: + component: camera-motion-detect + podMetricsEndpoints: + - port: http + podTargetLabels: + - app.kubernetes.io/name + - component diff --git a/camtiler/network-policies.yml b/camtiler/network-policies.yml index e182b6a..0029a52 100644 --- a/camtiler/network-policies.yml +++ b/camtiler/network-policies.yml @@ -19,7 +19,7 @@ spec: - from: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: prometheus-operator + kubernetes.io/metadata.name: monitoring podSelector: matchLabels: app.kubernetes.io/name: prometheus @@ -64,7 +64,7 @@ spec: - from: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: prometheus-operator + kubernetes.io/metadata.name: monitoring podSelector: matchLabels: app.kubernetes.io/name: prometheus @@ -186,7 +186,7 @@ spec: - from: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: prometheus-operator + kubernetes.io/metadata.name: monitoring podSelector: matchLabels: app.kubernetes.io/name: prometheus From 883da46a3b5a19e71cdde7d1c3d9019d2a19e8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 19 Aug 2023 21:31:30 +0300 Subject: [PATCH 58/77] Update whole Bind setup --- ansible-bind-primary.yml | 65 +++++++ {external-dns => bind}/.gitignore | 0 bind/README.md | 31 ++++ bind/bind-secondary.yaml | 163 ++++++++++++++++++ bind/external-dns-k-space.yaml | 40 +++++ .../k6.yaml => bind/external-dns-k6.yaml | 45 +++-- .../external-dns-kspace.yaml | 45 +++-- bind/external-dns.yaml | 58 +++++++ external-dns/README.md | 15 -- external-dns/k-space.yaml | 101 ----------- inventory.yml | 3 + inventory/README.md | 21 +++ metallb-system/application.yml | 22 ++- ssh_config | 2 + 14 files changed, 448 insertions(+), 163 deletions(-) create mode 100644 ansible-bind-primary.yml rename {external-dns => bind}/.gitignore (100%) create mode 100644 bind/README.md create mode 100644 bind/bind-secondary.yaml create mode 100644 bind/external-dns-k-space.yaml rename external-dns/k6.yaml => bind/external-dns-k6.yaml (55%) rename external-dns/kspace.yaml => bind/external-dns-kspace.yaml (52%) create mode 100644 bind/external-dns.yaml delete mode 100644 external-dns/README.md delete mode 100644 external-dns/k-space.yaml create mode 100644 inventory/README.md diff --git a/ansible-bind-primary.yml b/ansible-bind-primary.yml new file mode 100644 index 0000000..8658f7d --- /dev/null +++ b/ansible-bind-primary.yml @@ -0,0 +1,65 @@ +- name: Setup primary nameserver + hosts: ns1.k-space.ee + tasks: + - name: Make sure bind9 is installed + ansible.builtin.apt: + name: bind9 + state: present + - name: Configure Bind + register: bind + copy: + dest: /etc/bind/named.conf + content: | + # This file is managed by Ansible + # https://git.k-space.ee/k-space/kube/src/branch/master/ansible-bind-primary.yml + # Do NOT modify manually + + include "/etc/bind/named.conf.options"; + include "/etc/bind/named.conf.local"; + include "/etc/bind/readwrite.key"; + include "/etc/bind/readonly.key"; + + # https://kb.isc.org/docs/aa-00723 + + acl allowed { + 172.20.3.0/24; + 172.20.4.0/24; + }; + + acl rejected { !allowed; any; }; + + zone "." { + type hint; + file "/var/lib/bind/db.root"; + }; + + zone "k-space.ee" { + type master; + file "/var/lib/bind/db.k-space.ee"; + allow-update { !rejected; key readwrite; }; + allow-transfer { !rejected; key readonly; key readwrite; }; + notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; + }; + + zone "k6.ee" { + type master; + file "/var/lib/bind/db.k6.ee"; + allow-update { !rejected; key readwrite; }; + allow-transfer { !rejected; key readonly; key readwrite; }; + notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; + }; + + zone "kspace.ee" { + type master; + file "/var/lib/bind/db.kspace.ee"; + allow-update { !rejected; key readwrite; }; + allow-transfer { !rejected; key readonly; key readwrite; }; + notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; + }; + - name: Check Bind config + ansible.builtin.shell: "named-checkconf" + - name: Reload Bind config + service: + name: bind9 + state: reloaded + when: bind.changed diff --git a/external-dns/.gitignore b/bind/.gitignore similarity index 100% rename from external-dns/.gitignore rename to bind/.gitignore diff --git a/bind/README.md b/bind/README.md new file mode 100644 index 0000000..2e99b0b --- /dev/null +++ b/bind/README.md @@ -0,0 +1,31 @@ +# Bind setup + +The Bind primary resides outside Kubernetes at `193.40.103.2` and +it's internally reachable via `172.20.0.2` + +Bind secondaries are hosted inside Kubernetes and load balanced behind `62.65.250.2` + +Ingresses and DNSEndpoints referring to `k-space.ee`, `kspace.ee`, `k6.ee` +are picked up automatically by `external-dns` and updated on primary. + +The primary triggers notification events to `172.20.53.{1..3}` +which are internally exposed IP-s of the secondaries. + +# Secrets + +To configure TSIG secrets: + +``` +kubectl create secret generic -n bind bind-readonly-secret \ + --from-file=readonly.key +kubectl create secret generic -n bind bind-readwrite-secret \ + --from-file=readwrite.key +kubectl create secret generic -n bind external-dns +kubectl -n bind delete secret tsig-secret +kubectl -n bind create secret generic tsig-secret \ + --from-literal=TSIG_SECRET=$(cat readwrite.key | grep secret | cut -d '"' -f 2) +kubectl -n cert-manager delete secret tsig-secret +kubectl -n cert-manager create secret generic tsig-secret \ + --from-literal=TSIG_SECRET=$(cat readwrite.key | grep secret | cut -d '"' -f 2) +``` + diff --git a/bind/bind-secondary.yaml b/bind/bind-secondary.yaml new file mode 100644 index 0000000..4b56c67 --- /dev/null +++ b/bind/bind-secondary.yaml @@ -0,0 +1,163 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: bind-secondary-config +data: + named.conf: | + include "/etc/bind/readonly.key"; + options { + recursion no; + pid-file "/var/bind/named.pid"; + allow-query { 0.0.0.0/0; }; + allow-notify { 172.20.0.2; }; + allow-transfer { none; }; + check-names slave ignore; + }; + zone "k-space.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; + zone "k6.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; + zone "kspace.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: bind-secondary + namespace: bind +spec: + replicas: 3 + selector: + matchLabels: + app: bind-secondary + template: + metadata: + labels: + app: bind-secondary + spec: + volumes: + - name: run + emptyDir: {} + containers: + - name: bind-secondary + image: internetsystemsconsortium/bind9:9.19 + volumeMounts: + - mountPath: /run/named + name: run + workingDir: /var/bind + command: + - named + - -g + - -c + - /etc/bind/named.conf + volumeMounts: + - name: bind-secondary-config + mountPath: /etc/bind + readOnly: true + - name: bind-data + mountPath: /var/bind + volumes: + - name: bind-secondary-config + projected: + sources: + - configMap: + name: bind-secondary-config + - secret: + name: bind-readonly-secret + - name: bind-data + emptyDir: {} + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - bind-secondary + topologyKey: "kubernetes.io/hostname" +--- +apiVersion: v1 +kind: Service +metadata: + name: bind-secondary + namespace: bind +spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerIP: 62.65.250.2 + selector: + app: bind-secondary + ports: + - protocol: TCP + port: 53 + name: dns-tcp + targetPort: 53 + - protocol: UDP + port: 53 + name: dns-udp + targetPort: 53 +--- +apiVersion: v1 +kind: Service +metadata: + name: bind-secondary-0 + namespace: bind +spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerIP: 172.20.53.1 + selector: + app: bind-secondary + statefulset.kubernetes.io/pod-name: bind-secondary-0 + ports: + - protocol: TCP + port: 53 + name: dns-tcp + targetPort: 53 + - protocol: UDP + port: 53 + name: dns-udp + targetPort: 53 +--- +apiVersion: v1 +kind: Service +metadata: + name: bind-secondary-1 + namespace: bind +spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerIP: 172.20.53.2 + selector: + app: bind-secondary + statefulset.kubernetes.io/pod-name: bind-secondary-1 + ports: + - protocol: TCP + port: 53 + name: dns-tcp + targetPort: 53 + - protocol: UDP + port: 53 + name: dns-udp + targetPort: 53 +--- +apiVersion: v1 +kind: Service +metadata: + name: bind-secondary-2 + namespace: bind +spec: + type: LoadBalancer + externalTrafficPolicy: Local + loadBalancerIP: 172.20.53.3 + selector: + app: bind-secondary + statefulset.kubernetes.io/pod-name: bind-secondary-2 + ports: + - protocol: TCP + port: 53 + name: dns-tcp + targetPort: 53 + - protocol: UDP + port: 53 + name: dns-udp + targetPort: 53 diff --git a/bind/external-dns-k-space.yaml b/bind/external-dns-k-space.yaml new file mode 100644 index 0000000..7364d7c --- /dev/null +++ b/bind/external-dns-k-space.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: external-dns-k-space +spec: + revisionHistoryLimit: 0 + selector: + matchLabels: &selectorLabels + app.kubernetes.io/name: external-dns + domain: k-space.ee + template: + metadata: + labels: *selectorLabels + spec: + serviceAccountName: external-dns + containers: + - name: external-dns + image: registry.k8s.io/external-dns/external-dns:v0.13.5 + envFrom: + - secretRef: + name: tsig-secret + args: + - --events + - --registry=txt + - --txt-prefix=external-dns- + - --txt-owner-id=k8s + - --provider=rfc2136 + - --source=ingress + - --source=service + - --source=crd + - --domain-filter=k-space.ee + - --rfc2136-tsig-axfr + - --rfc2136-host=172.20.0.2 + - --rfc2136-port=53 + - --rfc2136-zone=k-space.ee + - --rfc2136-tsig-keyname=readwrite + - --rfc2136-tsig-secret-alg=hmac-sha512 + - --rfc2136-tsig-secret=$(TSIG_SECRET) + # https://github.com/kubernetes-sigs/external-dns/issues/2446 diff --git a/external-dns/k6.yaml b/bind/external-dns-k6.yaml similarity index 55% rename from external-dns/k6.yaml rename to bind/external-dns-k6.yaml index 515cb86..12dcdab 100644 --- a/external-dns/k6.yaml +++ b/bind/external-dns-k6.yaml @@ -2,8 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: k6 - namespace: external-dns + name: external-dns-k6 spec: revisionHistoryLimit: 0 selector: @@ -16,27 +15,27 @@ spec: spec: serviceAccountName: external-dns containers: - - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 - envFrom: - - secretRef: - name: tsig-secret - args: - - --log-level=debug - - --events - - --registry=noop - - --provider=rfc2136 - - --source=service - - --source=crd - - --domain-filter=k6.ee - - --rfc2136-tsig-axfr - - --rfc2136-host=193.40.103.2 - - --rfc2136-port=53 - - --rfc2136-zone=k6.ee - - --rfc2136-tsig-keyname=acme - - --rfc2136-tsig-secret-alg=hmac-sha512 - - --rfc2136-tsig-secret=$(TSIG_SECRET) - # https://github.com/kubernetes-sigs/external-dns/issues/2446 + - name: external-dns + image: registry.k8s.io/external-dns/external-dns:v0.13.5 + envFrom: + - secretRef: + name: tsig-secret + args: + - --log-level=debug + - --events + - --registry=noop + - --provider=rfc2136 + - --source=service + - --source=crd + - --domain-filter=k6.ee + - --rfc2136-tsig-axfr + - --rfc2136-host=172.20.0.2 + - --rfc2136-port=53 + - --rfc2136-zone=k6.ee + - --rfc2136-tsig-keyname=readwrite + - --rfc2136-tsig-secret-alg=hmac-sha512 + - --rfc2136-tsig-secret=$(TSIG_SECRET) + # https://github.com/kubernetes-sigs/external-dns/issues/2446 --- apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint diff --git a/external-dns/kspace.yaml b/bind/external-dns-kspace.yaml similarity index 52% rename from external-dns/kspace.yaml rename to bind/external-dns-kspace.yaml index 35b3886..86125fd 100644 --- a/external-dns/kspace.yaml +++ b/bind/external-dns-kspace.yaml @@ -2,8 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: kspace - namespace: external-dns + name: external-dns-kspace spec: revisionHistoryLimit: 0 selector: @@ -16,27 +15,27 @@ spec: spec: serviceAccountName: external-dns containers: - - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 - envFrom: - - secretRef: - name: tsig-secret - args: - - --events - - --registry=noop - - --provider=rfc2136 - - --source=ingress - - --source=service - - --source=crd - - --domain-filter=kspace.ee - - --rfc2136-tsig-axfr - - --rfc2136-host=193.40.103.2 - - --rfc2136-port=53 - - --rfc2136-zone=kspace.ee - - --rfc2136-tsig-keyname=acme - - --rfc2136-tsig-secret-alg=hmac-sha512 - - --rfc2136-tsig-secret=$(TSIG_SECRET) - # https://github.com/kubernetes-sigs/external-dns/issues/2446 + - name: external-dns + image: registry.k8s.io/external-dns/external-dns:v0.13.5 + envFrom: + - secretRef: + name: tsig-secret + args: + - --events + - --registry=noop + - --provider=rfc2136 + - --source=ingress + - --source=service + - --source=crd + - --domain-filter=kspace.ee + - --rfc2136-tsig-axfr + - --rfc2136-host=172.20.0.2 + - --rfc2136-port=53 + - --rfc2136-zone=kspace.ee + - --rfc2136-tsig-keyname=readwrite + - --rfc2136-tsig-secret-alg=hmac-sha512 + - --rfc2136-tsig-secret=$(TSIG_SECRET) + # https://github.com/kubernetes-sigs/external-dns/issues/2446 --- apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint diff --git a/bind/external-dns.yaml b/bind/external-dns.yaml new file mode 100644 index 0000000..5360660 --- /dev/null +++ b/bind/external-dns.yaml @@ -0,0 +1,58 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: external-dns +rules: +- apiGroups: + - "" + resources: + - services + - endpoints + - pods + - nodes + verbs: + - get + - watch + - list +- apiGroups: + - extensions + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch +- apiGroups: + - externaldns.k8s.io + resources: + - dnsendpoints + verbs: + - get + - watch + - list +- apiGroups: + - externaldns.k8s.io + resources: + - dnsendpoints/status + verbs: + - update +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: external-dns +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: external-dns-viewer +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: external-dns +subjects: +- kind: ServiceAccount + name: external-dns + namespace: bind diff --git a/external-dns/README.md b/external-dns/README.md deleted file mode 100644 index 33f03b8..0000000 --- a/external-dns/README.md +++ /dev/null @@ -1,15 +0,0 @@ -Before applying replace the secret with the actual one. - -For debugging add `- --log-level=debug`: - -``` -wget https://raw.githubusercontent.com/kubernetes-sigs/external-dns/master/docs/contributing/crd-source/crd-manifest.yaml -O crd.yml -kubectl apply -n external-dns -f application.yml -f crd.yml -``` - -Insert TSIG secret: - -``` - kubectl -n external-dns create secret generic tsig-secret \ - --from-literal=TSIG_SECRET= -``` diff --git a/external-dns/k-space.yaml b/external-dns/k-space.yaml deleted file mode 100644 index 423b87a..0000000 --- a/external-dns/k-space.yaml +++ /dev/null @@ -1,101 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: external-dns - namespace: external-dns -rules: -- apiGroups: - - "" - resources: - - services - - endpoints - - pods - - nodes - verbs: - - get - - watch - - list -- apiGroups: - - extensions - - networking.k8s.io - resources: - - ingresses - verbs: - - get - - list - - watch -- apiGroups: - - externaldns.k8s.io - resources: - - dnsendpoints - verbs: - - get - - watch - - list -- apiGroups: - - externaldns.k8s.io - resources: - - dnsendpoints/status - verbs: - - update ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: external-dns - namespace: external-dns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: external-dns-viewer - namespace: external-dns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: external-dns -subjects: -- kind: ServiceAccount - name: external-dns - namespace: external-dns ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: k-space - namespace: external-dns -spec: - revisionHistoryLimit: 0 - selector: - matchLabels: &selectorLabels - app.kubernetes.io/name: external-dns - domain: k-space.ee - template: - metadata: - labels: *selectorLabels - spec: - serviceAccountName: external-dns - containers: - - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 - envFrom: - - secretRef: - name: tsig-secret - args: - - --events - - --registry=txt - - --txt-prefix=external-dns- - - --txt-owner-id=k8s - - --provider=rfc2136 - - --source=ingress - - --source=service - - --source=crd - - --domain-filter=k-space.ee - - --rfc2136-tsig-axfr - - --rfc2136-host=193.40.103.2 - - --rfc2136-port=53 - - --rfc2136-zone=k-space.ee - - --rfc2136-tsig-keyname=acme - - --rfc2136-tsig-secret-alg=hmac-sha512 - - --rfc2136-tsig-secret=$(TSIG_SECRET) - # https://github.com/kubernetes-sigs/external-dns/issues/2446 diff --git a/inventory.yml b/inventory.yml index c5134b4..7029eba 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,5 +1,8 @@ all: children: + bind: + hosts: + ns1.k-space.ee: kubernetes: children: masters: diff --git a/inventory/README.md b/inventory/README.md new file mode 100644 index 0000000..223743d --- /dev/null +++ b/inventory/README.md @@ -0,0 +1,21 @@ + +To deploy components: + +``` +kubectl create namespace members-site +kubectl apply -n members-site -f doorboy.yml +``` + + +# Doorboy + +Set up Doorboy UID hashing salt: + +``` + kubectl create secret generic -n members-site doorboy-api \ + --from-literal=DOORBOY_SECRET=hg2NmVlf6JcS3w237ZXn + kubectl create secret generic -n members-site doorboy-uid-hash-salt \ + --from-literal=KDOORPI_UID_SALT=hkRXwLlQKmCJoy5qaahp + kubectl create secret generic -n members-site mongo-application-readwrite \ + --from-literal=connectionString.standard=mongodb://kspace_accounting:dBDCS21pHlZAd5isyfBI@mongodb.infra.k-space.ee:27017/kspace_accounting?replicaSet=kspace-mongo-set +``` diff --git a/metallb-system/application.yml b/metallb-system/application.yml index 3d89eaf..7d0591b 100644 --- a/metallb-system/application.yml +++ b/metallb-system/application.yml @@ -35,7 +35,9 @@ metadata: namespace: metallb-system spec: ipAddressPools: - - zoo + - zoo + - bind-secondary-external + - bind-secondary-internal --- # Slice of public EEnet subnet using MetalLB L3 method apiVersion: metallb.io/v1beta1 @@ -57,6 +59,24 @@ spec: addresses: - 62.65.250.36/30 --- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: bind-secondary-internal + namespace: metallb-system +spec: + addresses: + - 172.20.53.0/24 +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: bind-secondary-external + namespace: metallb-system +spec: + addresses: + - 62.65.250.2/32 +--- apiVersion: metallb.io/v1beta2 kind: BGPPeer metadata: diff --git a/ssh_config b/ssh_config index 901de57..105afbc 100644 --- a/ssh_config +++ b/ssh_config @@ -4,3 +4,5 @@ Host * ControlMaster auto ControlPath ~/.ssh/cm-%r@%h:%p +Host ns1.k-space.ee + Hostname 172.20.0.2 From 9dae1a832bbfc35d0aecb877c0039d98b9c2829a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 20 Aug 2023 08:04:13 +0300 Subject: [PATCH 59/77] gitea: Set imagePullPolicy to IfNotPresent --- gitea/application.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/gitea/application.yaml b/gitea/application.yaml index 55882ff..4f82bc2 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -79,6 +79,7 @@ spec: containers: - name: gitea image: gitea/gitea:1.20.2-rootless + imagePullPolicy: IfNotPresent securityContext: readOnlyRootFilesystem: true env: From cc51f3731a67000ccd8d3b7ee641d53576541259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 20 Aug 2023 09:35:26 +0300 Subject: [PATCH 60/77] Elaborate how to configure additional domains for Bind --- ansible-bind-primary.yml | 19 ++++++++--- bind/README.md | 72 ++++++++++++++++++++++++++++++++++++++++ bind/bind-secondary.yaml | 15 +++++++++ 3 files changed, 102 insertions(+), 4 deletions(-) diff --git a/ansible-bind-primary.yml b/ansible-bind-primary.yml index 8658f7d..87b9505 100644 --- a/ansible-bind-primary.yml +++ b/ansible-bind-primary.yml @@ -5,6 +5,7 @@ ansible.builtin.apt: name: bind9 state: present + - name: Configure Bind register: bind copy: @@ -14,11 +15,24 @@ # https://git.k-space.ee/k-space/kube/src/branch/master/ansible-bind-primary.yml # Do NOT modify manually - include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; include "/etc/bind/readwrite.key"; include "/etc/bind/readonly.key"; + options { + directory "/var/cache/bind"; + version ""; + listen-on { any; }; + listen-on-v6 { any; }; + pid-file "/var/run/named/named.pid"; + notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; + allow-recursion { none; }; + recursion no; + check-names master ignore; + dnssec-validation no; + auth-nxdomain no; + }; + # https://kb.isc.org/docs/aa-00723 acl allowed { @@ -38,7 +52,6 @@ file "/var/lib/bind/db.k-space.ee"; allow-update { !rejected; key readwrite; }; allow-transfer { !rejected; key readonly; key readwrite; }; - notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; }; zone "k6.ee" { @@ -46,7 +59,6 @@ file "/var/lib/bind/db.k6.ee"; allow-update { !rejected; key readwrite; }; allow-transfer { !rejected; key readonly; key readwrite; }; - notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; }; zone "kspace.ee" { @@ -54,7 +66,6 @@ file "/var/lib/bind/db.kspace.ee"; allow-update { !rejected; key readwrite; }; allow-transfer { !rejected; key readonly; key readwrite; }; - notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; }; - name: Check Bind config ansible.builtin.shell: "named-checkconf" diff --git a/bind/README.md b/bind/README.md index 2e99b0b..450c036 100644 --- a/bind/README.md +++ b/bind/README.md @@ -29,3 +29,75 @@ kubectl -n cert-manager create secret generic tsig-secret \ --from-literal=TSIG_SECRET=$(cat readwrite.key | grep secret | cut -d '"' -f 2) ``` +# Serving additional zones + +## Bind primary configuration + +To serve additional domains from this Bind setup add following +section to `named.conf.local` on primary `ns1.k-space.ee`: + +``` +key "foobar" { + algorithm hmac-sha512; + secret "..."; +}; + +zone "foobar.com" { + type master; + file "/var/lib/bind/db.foobar.com"; + allow-update { !rejected; key foobar; }; + allow-transfer { !rejected; key readonly; key foobar; }; + notify explicit; also-notify { 172.20.53.1; 172.20.53.2; 172.20.53.3; }; +}; +``` + +Initiate empty zonefile in `/var/lib/bind/db.foobar.com` on the primary `ns1.k-space.ee`: + +``` +foobar.com IN SOA ns1.foobar.com. hostmaster.foobar.com. (1 300 300 2592000 300) + NS ns1.foobar.com. + NS ns2.foobar.com. +ns1.foobar.com. A 193.40.103.2 +ns2.foobar.com. A 62.65.250.2 +``` + +Reload Bind config: + +``` +named-checkconf +systemctl reload bind9 +``` + +## Bind secondary config + +Add section to `bind-secondary-config-local` under key `named.conf.local`: + +``` +zone "foobar.com" { type slave; masters { 172.20.0.2 key readonly; }; }; +``` + +And restart secondaries: + +``` +kubectl rollout restart -n bind statefulset/bind-secondary +``` + +## Registrar config + +At your DNS registrar point your glue records to: + +``` +foobar.com. NS ns1.foobar.com. +foobar.com. NS ns2.foobar.com. +ns1.foobar.com. A 193.40.103.2 +ns2.foobar.com. A 62.65.250.2 +``` + +## Updating DNS records + +With the configured TSIG key `foobar` you can now: + +* Obtain Let's Encrypt certificates with DNS challenge. + Inside Kubernetes use `cert-manager` with RFC2136 provider. +* Update DNS records. + Inside Kubernetes use `external-dns` with RFC2136 provider. diff --git a/bind/bind-secondary.yaml b/bind/bind-secondary.yaml index 4b56c67..1e12418 100644 --- a/bind/bind-secondary.yaml +++ b/bind/bind-secondary.yaml @@ -1,10 +1,21 @@ --- apiVersion: v1 kind: ConfigMap +metadata: + name: bind-secondary-config-local +data: + named.conf.local: | + zone "codemowers.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; + zone "codemowers.eu" { type slave; masters { 172.20.0.2 key readonly; }; }; + zone "codemowers.cloud" { type slave; masters { 172.20.0.2 key readonly; }; }; +--- +apiVersion: v1 +kind: ConfigMap metadata: name: bind-secondary-config data: named.conf: | + include "/etc/bind/named.conf.local"; include "/etc/bind/readonly.key"; options { recursion no; @@ -13,6 +24,7 @@ data: allow-notify { 172.20.0.2; }; allow-transfer { none; }; check-names slave ignore; + notify no; }; zone "k-space.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; zone "k6.ee" { type slave; masters { 172.20.0.2 key readonly; }; }; @@ -60,6 +72,9 @@ spec: sources: - configMap: name: bind-secondary-config + - configMap: + name: bind-secondary-config-local + optional: true - secret: name: bind-readonly-secret - name: bind-data From 820c95431913d8f761523cd9a2ccf837c106ceb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 21 Aug 2023 10:38:52 +0300 Subject: [PATCH 61/77] Update mjpg-streamer service --- ansible-doors.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ansible-doors.yml b/ansible-doors.yml index 41d6893..5b49a78 100644 --- a/ansible-doors.yml +++ b/ansible-doors.yml @@ -16,10 +16,20 @@ After=network.target ConditionPathExists=/dev/%I [Service] - ExecStart=ctr run --rm --privileged --read-only --net-host harbor.k-space.ee/k-space/mjpg-streamer:latest mjpg-streamer /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I' -o 'output_http.so -w /usr/share/mjpg_streamer/www' + Environment=IMAGE=harbor.k-space.ee/k-space/mjpg-streamer:latest + StandardOutput=tty + Type=forking + ExecStartPre=-ctr task kill --signal=9 %p_%i + ExecStartPre=-ctr task rm %p_%i + ExecStartPre=-ctr c rm %p_%i + ExecStartPre=ctr image pull $IMAGE + ExecStart=ctr run --tty -d --rm --pid-file=/run/%i.pid --privileged --read-only --net-host $IMAGE %p_%i /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I -r 1280x720 -f 10' -o 'output_http.so -w /usr/share/mjpg_streamer/www' + ExecStopPost=ctr task rm %p_%i + ExecStopPost=ctr c rm %p_%i + PIDFile=/run/%i.pid [Install] WantedBy=multi-user.target - - name: Enable Doorboy controller + - name: Enable mjpg-streamer ansible.builtin.systemd: state: restarted daemon_reload: yes From 6752ca55aed0ffdeceb7bcf637bf19ac37659e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 22 Aug 2023 07:29:18 +0300 Subject: [PATCH 62/77] wildduck: Allow sending only from @k-space.ee address in webmail --- wildduck/webmail.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wildduck/webmail.yaml b/wildduck/webmail.yaml index 6b38f52..bd0b6c2 100644 --- a/wildduck/webmail.yaml +++ b/wildduck/webmail.yaml @@ -27,14 +27,12 @@ metadata: namespace: wildduck data: www.toml: |- - name="Wild Duck Mail" - title="wildduck-www" [service] - domain="k-space.ee" identities=1 allowIdentityEdit=false allowJoin=false - domains=[] + domains=["k-space.ee"] + allowSendFromOtherDomains=false [service.sso.http] enabled = true header = "Remote-Username" From e6a903cfefe44e46610243f9cef9da6c354d8584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 22 Aug 2023 10:14:18 +0300 Subject: [PATCH 63/77] wildduck: Use updated image for wildflock --- wildduck/wildflock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index 66df0d6..c9c5f99 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -89,7 +89,7 @@ spec: spec: containers: - name: wildflock - image: harbor.k-space.ee/k-space/walias:latest + image: harbor.k-space.ee/k-space/wildflock:latest ports: - containerPort: 3030 env: From 430f5b0f0fd031a7368dd02e146918964fcf8267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 08:34:21 +0300 Subject: [PATCH 64/77] wildduck: Add rspamd --- wildduck/rspamd.yaml | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 wildduck/rspamd.yaml diff --git a/wildduck/rspamd.yaml b/wildduck/rspamd.yaml new file mode 100644 index 0000000..29624f4 --- /dev/null +++ b/wildduck/rspamd.yaml @@ -0,0 +1,61 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rspamd +spec: + replicas: 2 + selector: + matchLabels: + app.kubernetes.io/name: rspamd + template: + metadata: + labels: + app.kubernetes.io/name: rspamd + spec: + securityContext: + runAsUser: 1000 + runAsNonRoot: true + fsGroup: 1000 + containers: + - name: rspamd + image: docker.io/codemowers/rspamd + command: + - /usr/bin/rspamd + - -f + ports: + - containerPort: 11333 + name: rspamd + securityContext: + readOnlyRootFilesystem: true + resources: + limits: + cpu: 500m + memory: 2Gi + requests: + cpu: 10m + memory: 400Mi + volumeMounts: + - name: var-lib-rspamd + mountPath: /var/lib/rspamd + volumes: + - name: var-lib-rspamd + emptyDir: + sizeLimit: 1Gi + - name: var-run + emptyDir: + medium: Memory + - name: var-lib-nginx-tmp + emptyDir: + medium: Memory +--- +apiVersion: v1 +kind: Service +metadata: + name: rspamd +spec: + selector: + app.kubernetes.io/name: rspamd + ports: + - port: 11333 + name: rspamd From 2500342e47be65820469175d55e2bea90e28af8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 08:34:30 +0300 Subject: [PATCH 65/77] wildduck: Add ClamAV --- wildduck/clamav.yaml | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 wildduck/clamav.yaml diff --git a/wildduck/clamav.yaml b/wildduck/clamav.yaml new file mode 100644 index 0000000..993b764 --- /dev/null +++ b/wildduck/clamav.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: clamav +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: clamav + template: + metadata: + labels: + app.kubernetes.io/name: clamav + spec: + containers: + # TODO: Figure out how to trigger update + - name: clamd + image: docker.io/clamav/clamav:1.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 3310 + name: api + volumeMounts: + - mountPath: /var/lib/clamav + name: avdata + - mountPath: /tmp + name: tmp + volumes: + - name: avdata + emptyDir: {} + - name: tmp + emptyDir: + medium: Memory +--- +apiVersion: v1 +kind: Service +metadata: + name: clamav +spec: + selector: + app.kubernetes.io/name: clamav + ports: + - port: 3310 + name: clamav From b98f173441ceff26ece9eb288c3e7d72f1443640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 08:48:33 +0300 Subject: [PATCH 66/77] wildduck: Add operator --- wildduck/wildduck-operator-rbac.yaml | 40 +++++++++++++++++ wildduck/wildduck-operator.yaml | 64 ++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 wildduck/wildduck-operator-rbac.yaml create mode 100644 wildduck/wildduck-operator.yaml diff --git a/wildduck/wildduck-operator-rbac.yaml b/wildduck/wildduck-operator-rbac.yaml new file mode 100644 index 0000000..83fd57c --- /dev/null +++ b/wildduck/wildduck-operator-rbac.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: codemowers-io-wildduck-operator +rules: + - apiGroups: + - codemowers.io + resources: + - oidcgatewayusers + verbs: + - get + - list + - watch + - apiGroups: + - codemowers.io + resources: + - oidcgatewayusers/status + verbs: + - patch + - update +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: codemowers-io-wildduck-operator + namespace: wildduck +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: codemowers-io-wildduck-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: codemowers-io-wildduck-operator +subjects: + - kind: ServiceAccount + name: codemowers-io-wildduck-operator + namespace: wildduck diff --git a/wildduck/wildduck-operator.yaml b/wildduck/wildduck-operator.yaml new file mode 100644 index 0000000..94ce547 --- /dev/null +++ b/wildduck/wildduck-operator.yaml @@ -0,0 +1,64 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: wildduck-operator + namespace: wildduck +spec: + replicas: 1 + selector: + matchLabels: + app: wildduck-operator + serviceName: wildduck-operator + template: + metadata: + labels: + app: wildduck-operator + spec: + containers: + - image: docker.io/codemowers/wildduck-operator:latest + name: wildduck-operator + env: + - name: MANAGED_DOMAIN + value: k-space.ee + - name: ALLOWED_GROUPS + value: k-space:friends,k-space:floor + - name: WILDDUCK_API_URL + value: http://mail2.k-space.ee:8080 + - name: WILDDUCK_API_TOKEN + valueFrom: + secretKeyRef: + name: wildduck + key: WILDDUCK_API_TOKEN + ports: + - containerPort: 8000 + name: metrics + enableServiceLinks: false + serviceAccountName: codemowers-io-wildduck-operator +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: wildduck-operator + name: wildduck-operator + namespace: wildduck +spec: + ports: + - name: metrics + port: 8000 + protocol: TCP + selector: + app: wildduck-operator +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: wildduck-operator + namespace: wildduck +spec: + endpoints: + - port: metrics + selector: + matchLabels: + app: wildduck-operator From 0ed3010feda364f1d2460085cda9bae1b4b9fb2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 19:53:07 +0300 Subject: [PATCH 67/77] Migrate the rest of Wildduck stack --- wildduck/certificate.yaml | 12 +++ wildduck/dns.yaml | 17 ++++ wildduck/haraka.yaml | 167 +++++++++++++++++++++++++++++++++++++ wildduck/loadbalancer.yaml | 28 +++++++ wildduck/mongo.yaml | 100 ++++++++++++++++++++++ wildduck/rspamd.yaml | 24 +++++- wildduck/webmail.yaml | 18 +++- wildduck/wildduck.yaml | 85 +++++++++++++++++++ wildduck/zonemta.yaml | 72 ++++++++++++++++ 9 files changed, 516 insertions(+), 7 deletions(-) create mode 100644 wildduck/certificate.yaml create mode 100644 wildduck/dns.yaml create mode 100644 wildduck/haraka.yaml create mode 100644 wildduck/loadbalancer.yaml create mode 100644 wildduck/mongo.yaml create mode 100644 wildduck/wildduck.yaml create mode 100644 wildduck/zonemta.yaml diff --git a/wildduck/certificate.yaml b/wildduck/certificate.yaml new file mode 100644 index 0000000..7d255d9 --- /dev/null +++ b/wildduck/certificate.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: mail +spec: + dnsNames: + - mail.k-space.ee + issuerRef: + kind: ClusterIssuer + name: default + secretName: wildduck-tls diff --git a/wildduck/dns.yaml b/wildduck/dns.yaml new file mode 100644 index 0000000..220099a --- /dev/null +++ b/wildduck/dns.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: externaldns.k8s.io/v1alpha1 +kind: DNSEndpoint +metadata: + name: wildduck-mx +spec: + endpoints: + - dnsName: k-space.ee + recordTTL: 300 + recordType: MX + targets: + - "10 mail.k-space.ee" + - dnsName: k-space.ee + recordTTL: 300 + recordType: TXT + targets: + - "v=spf1 mx include:servers.mcsv.net -all" diff --git a/wildduck/haraka.yaml b/wildduck/haraka.yaml new file mode 100644 index 0000000..a1f6555 --- /dev/null +++ b/wildduck/haraka.yaml @@ -0,0 +1,167 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: RedisClaim +metadata: + name: haraka +spec: + class: ephemeral + capacity: 100Mi +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: haraka +data: + loglevel: info + plugin_timeout: "180" + queue_dir: /var/lib/haraka/queue + plugins: |- + spf + clamd + rspamd + wildduck + rspamd.ini: |- + host = rspamd + port = 11333 + add_headers = always + timeout = 30 + [dkim] + enabled = true + [header] + bar = X-Rspamd-Bar + report = X-Rspamd-Report + score = X-Rspamd-Score + spam = X-Rspamd-Spam + [check] + authenticated = true + private_ip = true + [reject] + spam = false + [soft_reject] + enabled = true + [rmilter_headers] + enabled = true + [spambar] + positive = + + negative = - + neutral = / + clamd.ini: |- + clamd_socket = clamav:3310 + [reject] + virus=true + error=false + smtp.ini: |- + listen=0.0.0.0:2525 + nodes=1 + tls.ini: |- + key=/cert/tls.key + cert=/cert/tls.crt + wildduck.js: |- + module.exports = { + "redis": process.env.REDIS_URI, + "mongo": { + "url": process.env.MONGO_URI, + "sender": "application" + }, + "sender": { + "enabled": true, + "zone": "default", + "gfs": "mail", + "collection": "zone-queue" + }, + "srs": { + "secret": "foobar" + }, + "attachments": { + "type": "gridstore", + "bucket": "attachments", + "decodeBase64": true + }, + "log": { + "authlogExpireDays": 30 + }, + "limits": { + "windowSize": 3600, + "rcptIp": 100, + "rcptWindowSize": 60, + "rcpt": 60 + }, + "gelf": { + "enabled": false + }, + "rspamd": { + "forwardSkip": 10, + "blacklist": [ + "DMARC_POLICY_REJECT" + ], + "softlist": [ + "RBL_ZONE" + ], + "responses": { + "DMARC_POLICY_REJECT": "Unauthenticated email from {host} is not accepted due to domain's DMARC policy", + "RBL_ZONE": "[{host}] was found from Zone RBL" + } + } + } +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: haraka +spec: + replicas: 2 + selector: + matchLabels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: haraka + template: + metadata: + labels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: haraka + spec: + containers: + - name: haraka + image: docker.io/codemowers/wildduck-haraka-inbound:latest@sha256:a130cc6a60ab2a47cb5971355ed2474136254613b4b8bd30aeabc6e123695ea3 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 2525 + name: haraka-mta + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 65534 + volumeMounts: + - name: wildduck-haraka-config + mountPath: /etc/haraka + readOnly: true + - name: wildduck-haraka-config + mountPath: /etc/haraka/config + readOnly: true + - name: var-lib-haraka + mountPath: /var/lib/haraka + - mountPath: /cert + name: cert + env: + - name: REDIS_URI + valueFrom: + secretKeyRef: + name: redis-wildduck-owner-secrets + key: REDIS_MASTER_0_URI + - name: MONGO_URI + valueFrom: + secretKeyRef: + name: wildduck + key: MONGO_URI + volumes: + - name: cert + secret: + secretName: wildduck-tls + - name: wildduck-haraka-config + projected: + sources: + - configMap: + name: haraka + - name: var-lib-haraka + emptyDir: + sizeLimit: 500Mi diff --git a/wildduck/loadbalancer.yaml b/wildduck/loadbalancer.yaml new file mode 100644 index 0000000..147ea0c --- /dev/null +++ b/wildduck/loadbalancer.yaml @@ -0,0 +1,28 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: wildduck + annotations: + external-dns.alpha.kubernetes.io/hostname: mail.k-space.ee + metallb.universe.tf/address-pool: wildduck +spec: + loadBalancerIP: 193.40.103.25 + type: LoadBalancer + externalTrafficPolicy: Local + selector: + app.kubernetes.io/name: wildduck + ports: + - port: 8080 + name: wildduck-api + targetPort: wildduck-api + - port: 993 + name: wildduck-mda + targetPort: wildduck-mda + - port: 465 + name: zonemta-msa + targetPort: zonemta-msa + - port: 25 + name: haraka-mta + targetPort: haraka-mta + diff --git a/wildduck/mongo.yaml b/wildduck/mongo.yaml new file mode 100644 index 0000000..f7c1985 --- /dev/null +++ b/wildduck/mongo.yaml @@ -0,0 +1,100 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: wildduck-readwrite-password +spec: + mapping: + - key: password + value: "%(plaintext)s" +--- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: wildduck-readonly-password +spec: + mapping: + - key: password + value: "%(plaintext)s" +--- +apiVersion: mongodbcommunity.mongodb.com/v1 +kind: MongoDBCommunity +metadata: + name: wildduck-mongodb +spec: + additionalMongodConfig: + systemLog: + quiet: true + members: 2 + arbiters: 1 + type: ReplicaSet + version: "6.0.3" + security: + authentication: + modes: ["SCRAM"] + users: + - name: readwrite + db: application + passwordSecretRef: + name: wildduck-readwrite-password + roles: + - name: readWrite + db: application + scramCredentialsSecretName: wildduck-readwrite + - name: readonly + db: application + passwordSecretRef: + name: wildduck-readonly-password + roles: + - name: read + db: application + scramCredentialsSecretName: wildduck-readonly + statefulSet: + spec: + logLevel: WARN + template: + spec: + containers: + - name: mongod + resources: + requests: + cpu: 100m + memory: 1Gi + limits: + cpu: 4000m + memory: 1Gi + - name: mongodb-agent + resources: + requests: + cpu: 1m + memory: 100Mi + limits: {} + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - wildduck-svc + topologyKey: topology.kubernetes.io/zone + volumeClaimTemplates: + - metadata: + name: logs-volume + spec: + storageClassName: mongo + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 512Mi + - metadata: + name: data-volume + spec: + storageClassName: mongo + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/wildduck/rspamd.yaml b/wildduck/rspamd.yaml index 29624f4..b84f29f 100644 --- a/wildduck/rspamd.yaml +++ b/wildduck/rspamd.yaml @@ -1,4 +1,15 @@ --- +apiVersion: v1 +kind: ConfigMap +metadata: + name: rspamd +data: + logging.inc: | + type = console; + level = "notice"; + worker-normal.inc: | + bind_socket = "*:11333"; +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -20,9 +31,6 @@ spec: containers: - name: rspamd image: docker.io/codemowers/rspamd - command: - - /usr/bin/rspamd - - -f ports: - containerPort: 11333 name: rspamd @@ -38,6 +46,11 @@ spec: volumeMounts: - name: var-lib-rspamd mountPath: /var/lib/rspamd + - name: var-run + mountPath: /run/rspamd + - name: rspamd-config + mountPath: /etc/rspamd/local.d + readOnly: true volumes: - name: var-lib-rspamd emptyDir: @@ -48,6 +61,11 @@ spec: - name: var-lib-nginx-tmp emptyDir: medium: Memory + - name: rspamd-config + projected: + sources: + - configMap: + name: rspamd --- apiVersion: v1 kind: Service diff --git a/wildduck/webmail.yaml b/wildduck/webmail.yaml index bd0b6c2..074b49f 100644 --- a/wildduck/webmail.yaml +++ b/wildduck/webmail.yaml @@ -54,7 +54,7 @@ data: secure=true port=465 [api] - url="https://mail.k-space.ee" + url="http://wildduck-api:8080" --- apiVersion: apps/v1 kind: Deployment @@ -96,8 +96,8 @@ spec: - name: APPCONF_dbs_redis valueFrom: secretKeyRef: - name: redis-webmail-owner-secrets - key: REDIS_MASTER_0_URI + name: redis-wildduck-owner-secrets + key: REDIS_MASTER_1_URI volumes: - name: webmail-config projected: @@ -126,7 +126,7 @@ metadata: annotations: kubernetes.io/ingress.class: traefik traefik.ingress.kubernetes.io/router.entrypoints: websecure - traefik.ingress.kubernetes.io/router.middlewares: wildduck-webmail@kubernetescrd + traefik.ingress.kubernetes.io/router.middlewares: wildduck-webmail@kubernetescrd,wildduck-webmail-redirect@kubernetescrd traefik.ingress.kubernetes.io/router.tls: "true" external-dns.alpha.kubernetes.io/target: traefik.k-space.ee spec: @@ -144,3 +144,13 @@ spec: tls: - hosts: - "*.k-space.ee" +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: webmail-redirect +spec: + redirectRegex: + regex: ^https://webmail.k-space.ee/$ + replacement: https://webmail.k-space.ee/webmail/ + permanent: false diff --git a/wildduck/wildduck.yaml b/wildduck/wildduck.yaml new file mode 100644 index 0000000..9d1556d --- /dev/null +++ b/wildduck/wildduck.yaml @@ -0,0 +1,85 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: RedisClaim +metadata: + name: wildduck +spec: + class: ephemeral + capacity: 100Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: wildduck-api +spec: + selector: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: wildduck + ports: + - port: 8080 + name: wildduck-api +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wildduck +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: wildduck + template: + metadata: + labels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: wildduck + spec: + containers: + - name: wildduck + image: docker.io/nodemailer/wildduck + ports: + - containerPort: 8080 + name: wildduck-api + - containerPort: 9993 + name: wildduck-mda + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + resources: + limits: + cpu: 500m + memory: 200Mi + requests: + cpu: 10m + memory: 100Mi + env: + - name: APPCONF_tls_key + value: /cert/tls.key + - name: APPCONF_tls_cert + value: /cert/tls.crt + - name: APPCONF_api_host + value: "0.0.0.0" + - name: APPCONF_api_accessToken + valueFrom: + secretKeyRef: + name: wildduck + key: WILDDUCK_API_TOKEN + - name: APPCONF_dbs_mongo + valueFrom: + secretKeyRef: + name: wildduck + key: MONGO_URI + - name: APPCONF_dbs_redis + valueFrom: + secretKeyRef: + name: redis-wildduck-owner-secrets + key: REDIS_MASTER_0_URI + volumeMounts: + - mountPath: /cert + name: cert + volumes: + - name: cert + secret: + secretName: wildduck-tls diff --git a/wildduck/zonemta.yaml b/wildduck/zonemta.yaml new file mode 100644 index 0000000..0b239fb --- /dev/null +++ b/wildduck/zonemta.yaml @@ -0,0 +1,72 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zonemta +spec: + replicas: 2 + selector: + matchLabels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: zonemta + template: + metadata: + labels: + app.kubernetes.io/name: wildduck + app.kubernetes.io/component: zonemta + spec: + containers: + - name: wildduck + image: docker.io/codemowers/wildduck-zonemta-outbound:latest@sha256:a35453409c29882bacb4a758909a38ed62daa875ad72cf706996bb144703ef49 + imagePullPolicy: IfNotPresent + command: + - /sbin/tini + - -- + - node + - index.js + ports: + - containerPort: 9465 + name: zonemta-msa + - containerPort: 10280 + name: api + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + resources: + limits: + cpu: 500m + memory: 1000Mi + requests: + cpu: 10m + memory: 500Mi + env: + - name: APPCONF_smtpInterfaces_feeder_key + value: /cert/tls.key + - name: APPCONF_smtpInterfaces_feeder_cert + value: /cert/tls.crt + - name: APPCONF_smtpInterfaces_feeder_port + value: "9465" + - name: APPCONF_smtpInterfaces_feeder_host + value: "0.0.0.0" + - name: APPCONF_smtpInterfaces_feeder_secure + value: "true" + - name: APPCONF_dbs_sender + value: zone-mta + - name: APPCONF_dbs_mongo + valueFrom: + secretKeyRef: + name: wildduck + key: MONGO_URI + - name: APPCONF_dbs_redis + valueFrom: + secretKeyRef: + name: redis-wildduck-owner-secrets + key: REDIS_MASTER_0_URI + volumeMounts: + - mountPath: /cert + name: cert + volumes: + - name: cert + secret: + secretName: wildduck-tls From a3539de9e0727fe3dfe0c579f9b6d3fc76aa8be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 19:55:10 +0300 Subject: [PATCH 68/77] wildduck: Remove haraka's redis as it's not used --- wildduck/haraka.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/wildduck/haraka.yaml b/wildduck/haraka.yaml index a1f6555..7ad16eb 100644 --- a/wildduck/haraka.yaml +++ b/wildduck/haraka.yaml @@ -1,12 +1,4 @@ --- -apiVersion: codemowers.cloud/v1beta1 -kind: RedisClaim -metadata: - name: haraka -spec: - class: ephemeral - capacity: 100Mi ---- apiVersion: v1 kind: ConfigMap metadata: From f10ff329b77916510a0c3a30e8e6aa9848f8c2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 20:04:32 +0300 Subject: [PATCH 69/77] wildduck: Update dedicated Mongo for Wildduck --- wildduck/mongo.yaml | 21 ++------------------- wildduck/mongodb-support.yml | 1 + 2 files changed, 3 insertions(+), 19 deletions(-) create mode 120000 wildduck/mongodb-support.yml diff --git a/wildduck/mongo.yaml b/wildduck/mongo.yaml index f7c1985..96ae096 100644 --- a/wildduck/mongo.yaml +++ b/wildduck/mongo.yaml @@ -8,15 +8,6 @@ spec: - key: password value: "%(plaintext)s" --- -apiVersion: codemowers.cloud/v1beta1 -kind: SecretClaim -metadata: - name: wildduck-readonly-password -spec: - mapping: - - key: password - value: "%(plaintext)s" ---- apiVersion: mongodbcommunity.mongodb.com/v1 kind: MongoDBCommunity metadata: @@ -34,21 +25,13 @@ spec: modes: ["SCRAM"] users: - name: readwrite - db: application + db: wildduck passwordSecretRef: name: wildduck-readwrite-password roles: - name: readWrite db: application scramCredentialsSecretName: wildduck-readwrite - - name: readonly - db: application - passwordSecretRef: - name: wildduck-readonly-password - roles: - - name: read - db: application - scramCredentialsSecretName: wildduck-readonly statefulSet: spec: logLevel: WARN @@ -77,7 +60,7 @@ spec: - key: app operator: In values: - - wildduck-svc + - wildduck-mongodb-svc topologyKey: topology.kubernetes.io/zone volumeClaimTemplates: - metadata: diff --git a/wildduck/mongodb-support.yml b/wildduck/mongodb-support.yml new file mode 120000 index 0000000..e834dd2 --- /dev/null +++ b/wildduck/mongodb-support.yml @@ -0,0 +1 @@ +../mongodb-operator/mongodb-support.yml \ No newline at end of file From 9b2631f16cabf614003a1af1e9f6619cbdb85db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 20:45:43 +0300 Subject: [PATCH 70/77] wildduck: Add README --- wildduck/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wildduck/README.md b/wildduck/README.md index 8158285..4714e69 100644 --- a/wildduck/README.md +++ b/wildduck/README.md @@ -2,3 +2,23 @@ This application is managed by [ArgoCD](https://argocd.k-space.ee/applications/argocd/wildduck) + +The mail stack consists of several moving parts: + +* Haraka with several plugins + * Wildduck plugin to handle incoming mail on port 25 of mail.k-space.ee + * Fight spam with Rspamd + * Fight viruses with ClamAV +* Wildduck + * Provide API for interfacing with other systems such as + Wildduck webmail, + Wildflock e-mail alias generator and + Wildduck Kubernetes operator which deals with account provisioning + * Provide IMAP endpoint for accessing mailbox with traditional + MUA (mail user agents): Android, iPhone, Thunderbird, Evolution etc +* ZoneMTA for handling outbound mail + * Including mail submission from MUA with the help of Wildduck plugin + +Outside Kubernetes there is NAT rule on the Mikrotik router +which rewrites source IP of any TCP port 25 headed traffic to +originate from the IP address of the mail exchange. From bec78de2f3b64b338f1cf31950e6be0cab93692b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Thu, 24 Aug 2023 22:42:38 +0300 Subject: [PATCH 71/77] Deploy godoor from Docker image --- ansible-doors.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ansible-doors.yml b/ansible-doors.yml index 5b49a78..c641cb0 100644 --- a/ansible-doors.yml +++ b/ansible-doors.yml @@ -41,17 +41,19 @@ [Unit] Description=Doorboy service Documentation=https://git.k-space.ee/k-space/godoor + After=network.target [Service] - EnvironmentFile=/etc/godoor - Environment=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed - Environment=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll - Environment=KDOORPI_API_SWIPE=https://inventory.k-space.ee/swipes - Environment=KDOORPI_DOOR=%H - ExecStart=/usr/local/bin/godoor - User=root - Restart=always + Environment=IMAGE=harbor.k-space.ee/k-space/godoor:latest + ExecStartPre=-ctr task kill --signal=9 %N + ExecStartPre=-ctr task rm %N + ExecStartPre=-ctr c rm %N + ExecStartPre=ctr image pull $IMAGE + ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor + ExecStopPost=ctr task rm %N + ExecStopPost=ctr c rm %N [Install] WantedBy=multi-user.target + Restart=always - name: Enable Doorboy controller ansible.builtin.systemd: state: restarted From 3b31b9c94c611aa9427bbc73237eadf990acbe3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 25 Aug 2023 08:59:00 +0300 Subject: [PATCH 72/77] Make image pull fail gracefully on door controllers --- ansible-doors.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible-doors.yml b/ansible-doors.yml index c641cb0..45ba980 100644 --- a/ansible-doors.yml +++ b/ansible-doors.yml @@ -22,7 +22,7 @@ ExecStartPre=-ctr task kill --signal=9 %p_%i ExecStartPre=-ctr task rm %p_%i ExecStartPre=-ctr c rm %p_%i - ExecStartPre=ctr image pull $IMAGE + ExecStartPre=-ctr image pull $IMAGE ExecStart=ctr run --tty -d --rm --pid-file=/run/%i.pid --privileged --read-only --net-host $IMAGE %p_%i /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I -r 1280x720 -f 10' -o 'output_http.so -w /usr/share/mjpg_streamer/www' ExecStopPost=ctr task rm %p_%i ExecStopPost=ctr c rm %p_%i @@ -47,7 +47,7 @@ ExecStartPre=-ctr task kill --signal=9 %N ExecStartPre=-ctr task rm %N ExecStartPre=-ctr c rm %N - ExecStartPre=ctr image pull $IMAGE + ExecStartPre=-ctr image pull $IMAGE ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor ExecStopPost=ctr task rm %N ExecStopPost=ctr c rm %N From eafae2af3b834b3aee81283454640ac6f571dc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 25 Aug 2023 09:00:36 +0300 Subject: [PATCH 73/77] Setup godoor before mjpeg-streamer for door controllers --- ansible-doors.yml | 52 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/ansible-doors.yml b/ansible-doors.yml index 45ba980..693a37b 100644 --- a/ansible-doors.yml +++ b/ansible-doors.yml @@ -7,6 +7,33 @@ ansible.builtin.apt: name: containerd state: present + + - name: Copy systemd service for Doorboy controller + copy: + dest: /etc/systemd/system/godoor.service + content: | + [Unit] + Description=Doorboy service + Documentation=https://git.k-space.ee/k-space/godoor + After=network.target + [Service] + Environment=IMAGE=harbor.k-space.ee/k-space/godoor:latest + ExecStartPre=-ctr task kill --signal=9 %N + ExecStartPre=-ctr task rm %N + ExecStartPre=-ctr c rm %N + ExecStartPre=-ctr image pull $IMAGE + ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor + ExecStopPost=ctr task rm %N + ExecStopPost=ctr c rm %N + [Install] + WantedBy=multi-user.target + Restart=always + - name: Enable Doorboy controller + ansible.builtin.systemd: + state: restarted + daemon_reload: yes + name: godoor.service + - name: Copy systemd service for mjpg-streamer copy: dest: /etc/systemd/system/mjpg_streamer@.service @@ -34,28 +61,3 @@ state: restarted daemon_reload: yes name: mjpg_streamer@video0.service - - name: Copy systemd service for Doorboy controller - copy: - dest: /etc/systemd/system/godoor.service - content: | - [Unit] - Description=Doorboy service - Documentation=https://git.k-space.ee/k-space/godoor - After=network.target - [Service] - Environment=IMAGE=harbor.k-space.ee/k-space/godoor:latest - ExecStartPre=-ctr task kill --signal=9 %N - ExecStartPre=-ctr task rm %N - ExecStartPre=-ctr c rm %N - ExecStartPre=-ctr image pull $IMAGE - ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor - ExecStopPost=ctr task rm %N - ExecStopPost=ctr c rm %N - [Install] - WantedBy=multi-user.target - Restart=always - - name: Enable Doorboy controller - ansible.builtin.systemd: - state: restarted - daemon_reload: yes - name: godoor.service From 09a9bc411513e60b77554aeb246d149252ab5b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 25 Aug 2023 09:40:03 +0300 Subject: [PATCH 74/77] wildduck: Use toml files for ZoneMTA config --- wildduck/zonemta.yaml | 59 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/wildduck/zonemta.yaml b/wildduck/zonemta.yaml index 0b239fb..18bdbdf 100644 --- a/wildduck/zonemta.yaml +++ b/wildduck/zonemta.yaml @@ -1,4 +1,39 @@ --- +apiVersion: v1 +kind: ConfigMap +metadata: + name: zonemta + namespace: wildduck +data: + pools.toml: |- + [[default]] + address="0.0.0.0" + name="mail.k-space.ee" + plugin-wildduck.toml: |- + [wildduck] + enabled=["receiver", "sender"] + interfaces=["feeder"] + hostname="mail.k-space.ee" + authlogExpireDays=30 + [wildduck.srs] + enabled=false + # SRS secret value. Must be the same as in the MX side + secret="................................" + rewriteDomain="k-space.ee" + zonemta.toml: |- + [log] + level="info" + [smtpInterfaces] + key="/cert/tls.key" + cert="/cert/tls.crt" + port=9465 + host="0.0.0.0" + secure=true + [plugins] + # @include "plugin-wildduck.toml" + [pools] + # @include "pools.toml" +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -24,6 +59,8 @@ spec: - -- - node - index.js + - --config + - /etc/zonemta/zonemta.toml ports: - containerPort: 9465 name: zonemta-msa @@ -41,16 +78,6 @@ spec: cpu: 10m memory: 500Mi env: - - name: APPCONF_smtpInterfaces_feeder_key - value: /cert/tls.key - - name: APPCONF_smtpInterfaces_feeder_cert - value: /cert/tls.crt - - name: APPCONF_smtpInterfaces_feeder_port - value: "9465" - - name: APPCONF_smtpInterfaces_feeder_host - value: "0.0.0.0" - - name: APPCONF_smtpInterfaces_feeder_secure - value: "true" - name: APPCONF_dbs_sender value: zone-mta - name: APPCONF_dbs_mongo @@ -64,9 +91,17 @@ spec: name: redis-wildduck-owner-secrets key: REDIS_MASTER_0_URI volumeMounts: - - mountPath: /cert - name: cert + - name: cert + mountPath: /cert + - name: zonemta-config + mountPath: /etc/zonemta + readOnly: true volumes: + - name: zonemta-config + projected: + sources: + - configMap: + name: zonemta - name: cert secret: secretName: wildduck-tls From 54207c482c1e5704d954ab475130123766a89a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 26 Aug 2023 08:54:04 +0300 Subject: [PATCH 75/77] rosdump: Easier to navigate commit messages --- rosdump/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosdump/application.yml b/rosdump/application.yml index 1955235..d5be50e 100644 --- a/rosdump/application.yml +++ b/rosdump/application.yml @@ -23,7 +23,7 @@ data: done if [[ `git status --porcelain` ]]; then echo "Attempting Git check in" - git commit -m "Update $(git ls-files -m) file(s)" + git commit -m "$(git diff --cached --shortstat)" git push else echo "No changes to commit" From 40445c299db956a2ee7456b5ed1181e9ddd042f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 27 Aug 2023 16:55:48 +0300 Subject: [PATCH 76/77] wildduck: ZoneMTA config fixes --- wildduck/zonemta.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wildduck/zonemta.yaml b/wildduck/zonemta.yaml index 18bdbdf..0f4b319 100644 --- a/wildduck/zonemta.yaml +++ b/wildduck/zonemta.yaml @@ -23,12 +23,17 @@ data: zonemta.toml: |- [log] level="info" - [smtpInterfaces] + [smtpInterfaces.feeder] key="/cert/tls.key" cert="/cert/tls.crt" port=9465 host="0.0.0.0" secure=true + processes=1 + authentication = true + maxRecipients=100 + starttls=false + [plugins] # @include "plugin-wildduck.toml" [pools] @@ -51,7 +56,7 @@ spec: app.kubernetes.io/component: zonemta spec: containers: - - name: wildduck + - name: zonemta image: docker.io/codemowers/wildduck-zonemta-outbound:latest@sha256:a35453409c29882bacb4a758909a38ed62daa875ad72cf706996bb144703ef49 imagePullPolicy: IfNotPresent command: From 48567f0630ab24f00321485f29ac7f089557cae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 27 Aug 2023 20:24:36 +0300 Subject: [PATCH 77/77] wildduck: Clean up configs --- wildduck/.gitignore | 1 + wildduck/README.md | 7 +++++++ wildduck/haraka.yaml | 13 +++++++++++-- wildduck/loadbalancer.yaml | 4 ---- wildduck/srs.yaml | 10 ++++++++++ wildduck/wildduck-operator.yaml | 2 +- wildduck/wildduck.yaml | 8 ++++++++ wildduck/wildflock.yaml | 2 +- wildduck/zonemta.yaml | 11 +++++++---- 9 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 wildduck/srs.yaml diff --git a/wildduck/.gitignore b/wildduck/.gitignore index 5dddbe2..e87e4f4 100644 --- a/wildduck/.gitignore +++ b/wildduck/.gitignore @@ -1 +1,2 @@ +dhparams.pem secret.yml diff --git a/wildduck/README.md b/wildduck/README.md index 4714e69..98b4bce 100644 --- a/wildduck/README.md +++ b/wildduck/README.md @@ -22,3 +22,10 @@ The mail stack consists of several moving parts: Outside Kubernetes there is NAT rule on the Mikrotik router which rewrites source IP of any TCP port 25 headed traffic to originate from the IP address of the mail exchange. + +TODO: Figure out how to automate DH parameters generation: + +``` +openssl dhparam -out dhparams.pem 2048 +kubectl create secret generic -n wildduck dhparams --from-file=dhparams.pem +``` diff --git a/wildduck/haraka.yaml b/wildduck/haraka.yaml index 7ad16eb..e0698c3 100644 --- a/wildduck/haraka.yaml +++ b/wildduck/haraka.yaml @@ -11,7 +11,9 @@ data: spf clamd rspamd + dkim_verify wildduck + tls rspamd.ini: |- host = rspamd port = 11333 @@ -53,7 +55,7 @@ data: "redis": process.env.REDIS_URI, "mongo": { "url": process.env.MONGO_URI, - "sender": "application" + "sender": "zone-mta", }, "sender": { "enabled": true, @@ -62,7 +64,7 @@ data: "collection": "zone-queue" }, "srs": { - "secret": "foobar" + "secret": process.env.SRS_SECRET }, "attachments": { "type": "gridstore", @@ -135,6 +137,11 @@ spec: - mountPath: /cert name: cert env: + - name: SRS_SECRET + valueFrom: + secretKeyRef: + name: srs + key: secret - name: REDIS_URI valueFrom: secretKeyRef: @@ -152,6 +159,8 @@ spec: - name: wildduck-haraka-config projected: sources: + - secret: + name: dhparams - configMap: name: haraka - name: var-lib-haraka diff --git a/wildduck/loadbalancer.yaml b/wildduck/loadbalancer.yaml index 147ea0c..fc5123d 100644 --- a/wildduck/loadbalancer.yaml +++ b/wildduck/loadbalancer.yaml @@ -13,9 +13,6 @@ spec: selector: app.kubernetes.io/name: wildduck ports: - - port: 8080 - name: wildduck-api - targetPort: wildduck-api - port: 993 name: wildduck-mda targetPort: wildduck-mda @@ -25,4 +22,3 @@ spec: - port: 25 name: haraka-mta targetPort: haraka-mta - diff --git a/wildduck/srs.yaml b/wildduck/srs.yaml new file mode 100644 index 0000000..748b55a --- /dev/null +++ b/wildduck/srs.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: codemowers.cloud/v1beta1 +kind: SecretClaim +metadata: + name: srs +spec: + size: 32 + mapping: + - key: secret + value: "%(plaintext)s" diff --git a/wildduck/wildduck-operator.yaml b/wildduck/wildduck-operator.yaml index 94ce547..4f74153 100644 --- a/wildduck/wildduck-operator.yaml +++ b/wildduck/wildduck-operator.yaml @@ -24,7 +24,7 @@ spec: - name: ALLOWED_GROUPS value: k-space:friends,k-space:floor - name: WILDDUCK_API_URL - value: http://mail2.k-space.ee:8080 + value: http://wildduck-api:8080 - name: WILDDUCK_API_TOKEN valueFrom: secretKeyRef: diff --git a/wildduck/wildduck.yaml b/wildduck/wildduck.yaml index 9d1556d..5a38464 100644 --- a/wildduck/wildduck.yaml +++ b/wildduck/wildduck.yaml @@ -55,6 +55,14 @@ spec: cpu: 10m memory: 100Mi env: + - name: APPCONF_emailDomain + value: k-space.ee + - name: APPCONF_log_level + value: info + - name: APPCONF_maxForwards + value: "2000" + - name: APPCONF_hostname + value: mail.k-space.ee - name: APPCONF_tls_key value: /cert/tls.key - name: APPCONF_tls_cert diff --git a/wildduck/wildflock.yaml b/wildduck/wildflock.yaml index c9c5f99..8e671d9 100644 --- a/wildduck/wildflock.yaml +++ b/wildduck/wildflock.yaml @@ -105,7 +105,7 @@ spec: - name: NODE_ENV value: prod - name: WILDDUCK_URL - value: https://mail.k-space.ee + value: http://wildduck-api:8080 - name: WILDDUCK_TOKEN valueFrom: secretKeyRef: diff --git a/wildduck/zonemta.yaml b/wildduck/zonemta.yaml index 0f4b319..0b63a22 100644 --- a/wildduck/zonemta.yaml +++ b/wildduck/zonemta.yaml @@ -16,9 +16,7 @@ data: hostname="mail.k-space.ee" authlogExpireDays=30 [wildduck.srs] - enabled=false - # SRS secret value. Must be the same as in the MX side - secret="................................" + enabled=true rewriteDomain="k-space.ee" zonemta.toml: |- [log] @@ -57,7 +55,7 @@ spec: spec: containers: - name: zonemta - image: docker.io/codemowers/wildduck-zonemta-outbound:latest@sha256:a35453409c29882bacb4a758909a38ed62daa875ad72cf706996bb144703ef49 + image: docker.io/codemowers/wildduck-zonemta-outbound:latest@sha256:0878c803164e636820398f11a3811f3d92b7771c6202cfe229f97449d0009119 imagePullPolicy: IfNotPresent command: - /sbin/tini @@ -83,6 +81,11 @@ spec: cpu: 10m memory: 500Mi env: + - name: APPCONF_plugins_wildduck_srs_secret + valueFrom: + secretKeyRef: + name: srs + key: secret - name: APPCONF_dbs_sender value: zone-mta - name: APPCONF_dbs_mongo