Store certificate in configmap/secret dynamically;Remove helmchart values
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-08-30 21:14:51 +02:00
parent d8299ee90c
commit 8d13b527be
4 changed files with 59 additions and 39 deletions

View File

@ -26,24 +26,34 @@
- argo-cd - argo-cd
# - kube-system # - kube-system
- name: Store root certificate in namespaced secrets - name: Store root certificate in namespaced configmaps/secrets
kubernetes.core.k8s: kubernetes.core.k8s:
state: present state: present
template: secret.j2 template: "{{ item.kind }}.j2"
kubeconfig: "{{ kubeconfig.path }}" kubeconfig: "{{ kubeconfig.path }}"
vars: vars:
_template: _template:
name: step-certificates-certs name: "{{ item.name }}"
namespace: "{{ item.namespace }}" namespace: "{{ item.namespace }}"
key: "{{ item.filename }}" labels: "{{ item.labels | default({}) | indent(width=4, indent=True) }}"
value: "{{ stepca_cm_certs.resources[0].data['root_ca.crt'] | b64encode }}" key: "{{ item.key }}"
value: "{{ item.value }}"
loop: loop:
- namespace: argo-cd - name: argocd-tls-certs-cm
filename: custom-ca-certificates.crt namespace: argo-cd
- namespace: kube-system kind: configmap
filename: root_ca.crt labels: |
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
key: git.{{ vapp['metacluster.fqdn'] }}
value: "{{ stepca_cm_certs.resources[0].data['root_ca.crt'] }}"
- name: step-certificates-certs
namespace: kube-system
kind: secret
key: root_ca.crt
value: "{{ stepca_cm_certs.resources[0].data['root_ca.crt'] | b64encode }}"
loop_control: loop_control:
label: "{{ item.namespace }}" label: "{{ item.kind + '/' + item.name + ' (' + item.namespace + ')' }}"
- name: Configure step-ca passthrough ingress - name: Configure step-ca passthrough ingress
ansible.builtin.template: ansible.builtin.template:

View File

@ -5,6 +5,7 @@
state: present state: present
loop: loop:
# TODO: Make this list dynamic # TODO: Make this list dynamic
- ca
- git - git
- gitops - gitops
- ingress - ingress

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ _template.name }}
namespace: {{ _template.namespace }}
labels:
{{ _template.labels }}
data:
"{{ _template.key }}": {{ _template.value }}

View File

@ -149,26 +149,26 @@ components:
configs: configs:
secret: secret:
argocdServerAdminPassword: "{{ vapp['guestinfo.rootpw'] | password_hash('bcrypt') }}" argocdServerAdminPassword: "{{ vapp['guestinfo.rootpw'] | password_hash('bcrypt') }}"
controller: # controller:
volumeMounts: # volumeMounts:
- name: custom-ca-certificates # - name: custom-ca-certificates
mountPath: /etc/ssl/certs/custom-ca-certificates.crt # mountPath: /etc/ssl/certs/custom-ca-certificates.crt
subPath: custom-ca-certificates.crt # subPath: custom-ca-certificates.crt
volumes: # volumes:
- name: custom-ca-certificates # - name: custom-ca-certificates
secret: # secret:
defaultMode: 420 # defaultMode: 420
secretName: step-certificates-certs # secretName: step-certificates-certs
repoServer: # repoServer:
volumeMounts: # volumeMounts:
- name: custom-ca-certificates # - name: custom-ca-certificates
mountPath: /etc/ssl/certs/custom-ca-certificates.crt # mountPath: /etc/ssl/certs/custom-ca-certificates.crt
subPath: custom-ca-certificates.crt # subPath: custom-ca-certificates.crt
volumes: # volumes:
- name: custom-ca-certificates # - name: custom-ca-certificates
secret: # secret:
defaultMode: 420 # defaultMode: 420
secretName: step-certificates-certs # secretName: step-certificates-certs
server: server:
extraArgs: extraArgs:
- --insecure - --insecure
@ -176,15 +176,15 @@ components:
enabled: true enabled: true
hosts: hosts:
- gitops.{{ vapp['metacluster.fqdn'] }} - gitops.{{ vapp['metacluster.fqdn'] }}
volumeMounts: # volumeMounts:
- name: custom-ca-certificates # - name: custom-ca-certificates
mountPath: /etc/ssl/certs/custom-ca-certificates.crt # mountPath: /etc/ssl/certs/custom-ca-certificates.crt
subPath: custom-ca-certificates.crt # subPath: custom-ca-certificates.crt
volumes: # volumes:
- name: custom-ca-certificates # - name: custom-ca-certificates
secret: # secret:
defaultMode: 420 # defaultMode: 420
secretName: step-certificates-certs # secretName: step-certificates-certs
sealed-secrets: sealed-secrets:
helm: helm: