2018-02-04 04:32:33 +00:00
|
|
|
---
|
2018-02-09 07:47:57 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: ReplicaSet
|
2018-02-04 04:32:33 +00:00
|
|
|
metadata:
|
2018-08-22 03:02:56 +00:00
|
|
|
name: registry
|
2018-02-09 07:47:57 +00:00
|
|
|
namespace: {{ registry_namespace }}
|
2018-02-04 04:32:33 +00:00
|
|
|
labels:
|
2018-02-09 07:47:57 +00:00
|
|
|
k8s-app: registry
|
2018-02-04 04:32:33 +00:00
|
|
|
version: v{{ registry_image_tag }}
|
|
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
|
|
spec:
|
2021-11-22 10:45:09 +00:00
|
|
|
{% if registry_storage_class != "" and registry_storage_access_mode == "ReadWriteMany" %}
|
|
|
|
replicas: {{ registry_replica_count }}
|
|
|
|
{% else %}
|
2018-02-04 04:32:33 +00:00
|
|
|
replicas: 1
|
2021-11-22 10:45:09 +00:00
|
|
|
{% endif %}
|
2018-02-04 04:32:33 +00:00
|
|
|
selector:
|
2018-02-09 07:47:57 +00:00
|
|
|
matchLabels:
|
|
|
|
k8s-app: registry
|
|
|
|
version: v{{ registry_image_tag }}
|
2018-02-04 04:32:33 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2018-02-09 07:47:57 +00:00
|
|
|
k8s-app: registry
|
2018-02-04 04:32:33 +00:00
|
|
|
version: v{{ registry_image_tag }}
|
|
|
|
spec:
|
2018-09-25 14:50:22 +00:00
|
|
|
priorityClassName: {% if registry_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
|
2018-08-22 16:16:13 +00:00
|
|
|
serviceAccountName: registry
|
2021-11-22 10:45:09 +00:00
|
|
|
securityContext:
|
|
|
|
fsGroup: 1000
|
|
|
|
runAsUser: 1000
|
2018-02-04 04:32:33 +00:00
|
|
|
containers:
|
|
|
|
- name: registry
|
|
|
|
image: {{ registry_image_repo }}:{{ registry_image_tag }}
|
2018-02-09 07:47:57 +00:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2021-12-07 16:32:00 +00:00
|
|
|
command:
|
|
|
|
- /bin/registry
|
|
|
|
- serve
|
|
|
|
- /etc/docker/registry/config.yml
|
2018-02-04 04:32:33 +00:00
|
|
|
env:
|
|
|
|
- name: REGISTRY_HTTP_ADDR
|
2020-03-17 12:52:22 +00:00
|
|
|
value: :{{ registry_port }}
|
2018-02-04 04:32:33 +00:00
|
|
|
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
|
|
|
value: /var/lib/registry
|
2021-12-07 16:32:00 +00:00
|
|
|
{% if registry_htpasswd != "" %}
|
|
|
|
- name: REGISTRY_AUTH
|
|
|
|
value: "htpasswd"
|
|
|
|
- name: REGISTRY_AUTH_HTPASSWD_REALM
|
|
|
|
value: "Registry Realm"
|
|
|
|
- name: REGISTRY_AUTH_HTPASSWD_PATH
|
|
|
|
value: "/auth/htpasswd"
|
|
|
|
{% endif %}
|
|
|
|
{% if registry_tls_secret != "" %}
|
|
|
|
- name: REGISTRY_HTTP_TLS_CERTIFICATE
|
|
|
|
value: /etc/ssl/docker/tls.crt
|
|
|
|
- name: REGISTRY_HTTP_TLS_KEY
|
|
|
|
value: /etc/ssl/docker/tls.key
|
|
|
|
{% endif %}
|
2018-02-04 04:32:33 +00:00
|
|
|
volumeMounts:
|
2018-02-09 07:47:57 +00:00
|
|
|
- name: registry-pvc
|
2018-02-04 04:32:33 +00:00
|
|
|
mountPath: /var/lib/registry
|
2021-12-07 16:32:00 +00:00
|
|
|
- name: registry-config
|
|
|
|
mountPath: /etc/docker/registry
|
|
|
|
{% if registry_htpasswd != "" %}
|
|
|
|
- name: auth
|
|
|
|
mountPath: /auth
|
|
|
|
readOnly: true
|
|
|
|
{% endif %}
|
|
|
|
{% if registry_tls_secret != "" %}
|
|
|
|
- name: tls-cert
|
|
|
|
mountPath: /etc/ssl/docker
|
|
|
|
readOnly: true
|
|
|
|
{% endif %}
|
2018-02-04 04:32:33 +00:00
|
|
|
ports:
|
2020-03-17 12:52:22 +00:00
|
|
|
- containerPort: {{ registry_port }}
|
2018-02-04 04:32:33 +00:00
|
|
|
name: registry
|
|
|
|
protocol: TCP
|
2021-11-22 10:45:09 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
2021-12-07 16:32:00 +00:00
|
|
|
{% if registry_tls_secret != "" %}
|
|
|
|
scheme: HTTPS
|
|
|
|
{% endif %}
|
2021-11-22 10:45:09 +00:00
|
|
|
path: /
|
|
|
|
port: {{ registry_port }}
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
2021-12-07 16:32:00 +00:00
|
|
|
{% if registry_tls_secret != "" %}
|
|
|
|
scheme: HTTPS
|
|
|
|
{% endif %}
|
2021-11-22 10:45:09 +00:00
|
|
|
path: /
|
|
|
|
port: {{ registry_port }}
|
2018-02-04 04:32:33 +00:00
|
|
|
volumes:
|
2018-02-09 07:47:57 +00:00
|
|
|
- name: registry-pvc
|
2018-12-28 06:23:19 +00:00
|
|
|
{% if registry_storage_class != "" %}
|
2018-02-09 07:47:57 +00:00
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: registry-pvc
|
|
|
|
{% else %}
|
2018-02-04 04:32:33 +00:00
|
|
|
emptyDir: {}
|
2021-12-07 16:32:00 +00:00
|
|
|
{% endif %}
|
|
|
|
- name: registry-config
|
|
|
|
configMap:
|
|
|
|
name: registry-config
|
|
|
|
{% if registry_htpasswd != "" %}
|
|
|
|
- name: auth
|
|
|
|
secret:
|
|
|
|
secretName: registry-secret
|
|
|
|
items:
|
|
|
|
- key: htpasswd
|
|
|
|
path: htpasswd
|
|
|
|
{% endif %}
|
|
|
|
{% if registry_tls_secret != "" %}
|
|
|
|
- name: tls-cert
|
|
|
|
secret:
|
|
|
|
secretName: {{ registry_tls_secret }}
|
2018-02-09 07:47:57 +00:00
|
|
|
{% endif %}
|