Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions roles/ocp4_workload_rhacs/tasks/certificate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,26 @@
retries: 5
delay: 5

- name: Filter to Ready ClusterIssuers only
ansible.builtin.set_fact:
_ready_cluster_issuers: >-
{{
r_cluster_issuers.resources
| json_query("[?status.conditions[?type=='Ready' && status=='True']]")
| default([])
}}

- name: Fail if no ClusterIssuer is found but certificates are requested
when: r_cluster_issuers.resources | length == 0
when: _ready_cluster_issuers | length == 0
ansible.builtin.fail:
msg: "No ClusterIssuer found to issue certificates for Central"
msg: "No Ready ClusterIssuer found to issue certificates for Central"

- name: Build list of ClusterIssuers to try (fallback issuers last)
ansible.builtin.set_fact:
_cluster_issuers_to_try: >-
{{
(r_cluster_issuers.resources | map(attribute='metadata.name') | list | reject('search', 'fallback') | list)
+ (r_cluster_issuers.resources | map(attribute='metadata.name') | list | select('search', 'fallback') | list)
(_ready_cluster_issuers | map(attribute='metadata.name') | list | reject('search', 'fallback') | list)
+ (_ready_cluster_issuers | map(attribute='metadata.name') | list | select('search', 'fallback') | list)
}}

- name: Try each ClusterIssuer until certificate is issued successfully
Expand Down
5 changes: 5 additions & 0 deletions roles/ocp4_workload_rhacs/templates/certificate.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ spec:
secretName: rhacs-central-tls
duration: 2160h
renewBefore: 360h
commonName: central-{{ ocp4_workload_rhacs_central_namespace }}.{{ openshift_cluster_ingress_domain }}
dnsNames:
- central-{{ ocp4_workload_rhacs_central_namespace }}.{{ openshift_cluster_ingress_domain }}
usages:
- server auth
privateKey:
rotationPolicy: Always
issuerRef:
name: {{ _ocp4_workload_rhacs_cert_cluster_issuer }}
kind: ClusterIssuer
Expand Down
Loading