Skip to content

Commit

Permalink
feat: ✨ add dsc.general.registry
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentha authored and ArnaudTA committed May 3, 2024
1 parent 9fa205d commit bd0046c
Show file tree
Hide file tree
Showing 20 changed files with 262 additions and 0 deletions.
8 changes: 8 additions & 0 deletions roles/argocd/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if use_private_registry %}
image:
registry: "{{ dsc.global.registry }}"

redis:
image:
registry: "{{ dsc.global.registry }}"
{% endif %}
20 changes: 20 additions & 0 deletions roles/cert-manager/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% if use_private_registry %}
image:
repository: "{{ dsc.global.registry }}/cert-manager-controller"

webhook:
image:
repository: "{{ dsc.global.registry }}/cert-manager-webhook"

cainjector:
image:
repository: "{{ dsc.global.registry }}/cert-manager-cainjector"

acmesolver:
image:
repository: "{{ dsc.global.registry }}/cert-manager-acmesolver"

startupapicheck:
image:
repository: "{{ dsc.global.registry }}/cert-manager-startupapicheck"
{% endif %}
4 changes: 4 additions & 0 deletions roles/cloudnativepg/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if use_private_registry %}
image:
repository: "{{ dsc.global.registry }}/cloudnative-pg/cloudnative-pg"
{% endif %}
13 changes: 13 additions & 0 deletions roles/console-dso/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% if use_private_registry %}
server:
container:
image: "{{ dsc.global.registry }}/cloud-pi-native/console/server:{{ dsc.console.release }}"

client:
container:
image: "{{ dsc.global.registry }}/cloud-pi-native/console/client:{{ dsc.console.release }}"

postgres:
container:
image: "{{ dsc.global.registry }}/postgres:15.3"
{% endif %}
18 changes: 18 additions & 0 deletions roles/gitlab-operator/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@
chart_version: "{{ dsc.gitlabOperator.chartVersion }}"
release_namespace: "{{ dsc.gitlabOperator.namespace }}"
values: "{{ operator_values }}"
when: not use_private_registry

- name: Generate post_renderer script
template:
src: post_renderer_template.j2
dest: /tmp/yq_script.sh
mode: 0755
when: use_private_registry

- name: Deploy GitLab Operator helm
kubernetes.core.helm:
name: gitlab-operator
chart_ref: gitlab-operator/gitlab-operator
chart_version: "{{ dsc.gitlabOperator.chartVersion }}"
release_namespace: "{{ dsc.gitlabOperator.namespace }}"
values: "{{ operator_values }}"
post_renderer: /tmp/yq_script.sh
when: use_private_registry

- name: Wait gitlab-webhook-service endpoint
kubernetes.core.k8s_info:
Expand Down
5 changes: 5 additions & 0 deletions roles/gitlab-operator/templates/post_renderer_template.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

rm -f /tmp/all.yaml
cat <&0 > /tmp/all.yaml
yq eval '.spec.template.spec.containers[1].image = "{{ dsc.global.registry }}/kubebuilder/kube-rbac-proxy:v0.14.1"' /tmp/all.yaml 2> /dev/null && rm /tmp/all.yaml
4 changes: 4 additions & 0 deletions roles/gitlab-operator/templates/values.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
watchCluster: true

image:
{% if use_private_registry %}
registry: "{{ dsc.global.registry }}"
{% else %}
registry: registry.gitlab.com
{% endif %}
repository: gitlab-org/cloud-native
name: gitlab-operator
tag: {{ dsc.gitlabOperator.chartVersion }}
Expand Down
4 changes: 4 additions & 0 deletions roles/gitlab-runner/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if use_private_registry %}
image:
registry: "{{ dsc.global.registry }}"
{% endif %}
77 changes: 77 additions & 0 deletions roles/gitlab/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{% if use_private_registry %}
gitlab:
gitaly:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitaly"
gitlab-exporter:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-exporter"
gitlab-shell:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-shell"
kas:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-kas"
toolbox:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-toolbox-ee"

global:
kubectl:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/kubectl"
gitlabBase:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-base"
certificates:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/certificates"
enterpriseImages:
migrations:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-toolbox-ee"
sidekiq:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-sidekiq-ee"
toolbox:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-toolbox-ee"
webservice:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-webservice-ee"
workhorse:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-workhorse-ee"
geo-logcursor:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-geo-logcursor"
communityImages:
migrations:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-toolbox-ce"
sidekiq:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-sidekiq-ce"
toolbox:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-toolbox-ce"
webservice:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-webservice-ce"
workhorse:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/gitlab-workhorse-ce"

shared-secrets:
selfsign:
image:
repository: "{{ dsc.global.registry }}/gitlab-org/build/cng/cfssl-self-sign"

minio:
image: "{{ dsc.global.registry }}/minio"
minioMc:
image: "{{ dsc.global.registry }}/mc"

postgresql:
image:
registry: "{{ dsc.global.registry }}"
metrics:
image:
registry: "{{ dsc.global.registry }}"

redis:
image:
registry: "{{ dsc.global.registry }}"
metrics:
image:
registry: "{{ dsc.global.registry }}"
{% endif %}
43 changes: 43 additions & 0 deletions roles/harbor/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% if use_private_registry %}
nginx:
image:
repository: "{{ dsc.global.registry }}/goharbor/nginx-photon"

portal:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-portal"

core:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-core"

jobservice:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-jobservice"

registry:
registry:
image:
repository: "{{ dsc.global.registry }}/goharbor/registry-photon"
controller:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-registryctl"

trivy:
image:
repository: "{{ dsc.global.registry }}/goharbor/trivy-adapter-photon"

database:
internal:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-db"

redis:
internal:
image:
repository: "{{ dsc.global.registry }}/goharbor/redis-photon"

exporter:
image:
repository: "{{ dsc.global.registry }}/goharbor/harbor-exporter"
{% endif %}
6 changes: 6 additions & 0 deletions roles/keycloak/templates/pg-cluster-keycloak.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ spec:

# Parameters and pg_hba configuration will be append
# to the default ones to make the cluster work
{% if use_private_registry %}
imageName: "{{ dsc.global.registry }}/cloudnative-pg/postgresql:16.1"
{% endif %}
postgresql:
{% if use_private_registry %}
image: "{{ dsc.global.registry }}/cloudnative-pg/postgresql:16.1"
{% endif %}
parameters:
max_worker_processes: "60"
pg_hba:
Expand Down
4 changes: 4 additions & 0 deletions roles/keycloak/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if use_private_registry %}
image:
registry: "{{ dsc.global.registry }}"
{% endif %}
12 changes: 12 additions & 0 deletions roles/kyverno/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
- "app.kubernetes.io/part-of=kyverno"
register: kyverno_pods

- name: Set path fact
ansible.builtin.set_fact:
path: "{{ role_path + '/templates/values' }}"

- name: Compute Kyverno Helm values
ansible.builtin.include_role:
name: combine
vars:
combine_path: "{{ path }}"
combine_dest_var: "kyverno_values"

- name: Install Kyverno
when: kyverno_pods.resources | length == 0
block:
Expand All @@ -21,6 +32,7 @@
chart_version: "{{ dsc.kyverno.chartVersion }}"
release_namespace: "{{ dsc.kyverno.namespace }}"
create_namespace: true
values: "{{ kyverno_values }}"

- name: Wait Kyverno service endpoint to be available
kubernetes.core.k8s_info:
Expand Down
5 changes: 5 additions & 0 deletions roles/kyverno/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if use_private_registry %}
global:
image:
registry: "{{ dsc.global.registry }}"
{% endif %}
4 changes: 4 additions & 0 deletions roles/nexus/templates/nexus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ spec:
spec:
containers:
- name: nexus
{% if use_private_registry %}
image: "{{ dsc.global.registry }}/sonatype/nexus3:{{ dsc.nexus.imageTag }}"
{% else %}
image: sonatype/nexus3:{{ dsc.nexus.imageTag }}
{% endif %}
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 8081 # Exposes container port
Expand Down
3 changes: 3 additions & 0 deletions roles/socle-config/files/crd-conf-dso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ spec:
- velero
type: string
type: object
registry:
description: Specifies the internal registry to use.
type: string
required:
- projectsRootDir
- rootDomain
Expand Down
4 changes: 4 additions & 0 deletions roles/socle-config/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
ansible.builtin.set_fact:
dsc: "{{ dsc.spec }}"

- name: set private registry
ansible.builtin.set_fact:
use_private_registry: "{{ dsc.global.registry is defined and dsc.global.registry | length > 0 | bool }}"

- name: Set root_domain fact
ansible.builtin.set_fact:
root_domain: "{{ dsc.global.rootDomain }}"
Expand Down
6 changes: 6 additions & 0 deletions roles/sonarqube/templates/pg-cluster-sonar.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ spec:

# Parameters and pg_hba configuration will be append
# to the default ones to make the cluster work
{% if use_private_registry %}
imageName: "{{ dsc.global.registry }}/cloudnative-pg/postgresql:16.1"
{% endif %}
postgresql:
{% if use_private_registry %}
image: "{{ dsc.global.registry }}/cloudnative-pg/postgresql:16.1"
{% endif %}
parameters:
max_worker_processes: "60"
pg_hba:
Expand Down
4 changes: 4 additions & 0 deletions roles/sonarqube/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if use_private_registry %}
image:
repository: "{{ dsc.global.registry }}/sonarqube"
{% endif %}
18 changes: 18 additions & 0 deletions roles/vault/templates/values/10-registry.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% if use_private_registry %}
injector:
image:
repository: "{{ dsc.global.registry }}/hashicorp/vault-k8s"
agentImage:
repository: "{{ dsc.global.registry }}/hashicorp/vault"

server:
image:
repository: "{{ dsc.global.registry }}/hashicorp/vault"

csi:
image:
repository: "{{ dsc.global.registry }}/hashicorp/vault-csi-provider"
agent:
image:
repository: "{{ dsc.global.registry }}/hashicorp/vault"
{% endif %}

0 comments on commit bd0046c

Please sign in to comment.