Skip to content

Commit

Permalink
Add cloud credits API to azimuth-ops
Browse files Browse the repository at this point in the history
  • Loading branch information
assumptionsandg committed Aug 20, 2024
1 parent fd1332f commit b3ec925
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ jobs:
prereleases: "yes"
version_jsonpath: capi_cluster_chart_version

- key: coral-credits
path: ./roles/coral_credits/defaults/main.yml
respoistory: stackhpc/coral-credits
prereleases: "yes"
version_jsonpath: coral_credits_chart_version

- key: cluster-api
path: ./roles/clusterapi/defaults/main.yml
repository: kubernetes-sigs/cluster-api
Expand Down
2 changes: 2 additions & 0 deletions playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
when: azimuth_apps_enabled
- role: azimuth_cloud.azimuth_ops.zenith
when: azimuth_apps_enabled
- role: azimuth_cloud.azimuth_ops.coral_credits
when: coral_credits_enabled
- role: azimuth_cloud.azimuth_ops.azimuth_identity_operator
when: azimuth_apps_enabled
- role: azimuth_cloud.azimuth_ops.azimuth_capi_operator
Expand Down
66 changes: 66 additions & 0 deletions roles/coral_credits/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---

# The chart to use
coral_credits_chart_repo: https://stackhpc.github.io/coral-credits
coral_credits_chart_name: coral-credits
coral_credits_chart_version: 0.3.1-dev.0.add-servicemonitor.5

# Release information for the coral credits release
coral_credits_release_namespace: "{{ azimuth_release_namespace | default('azimuth') }}"
coral_credits_release_name: coral-credits

# The timeout to wait for coral credits API to become ready
coral_credits_wait_timeout: 10m

# Ingress settings
# The hostname for Coral credits ingress resources
coral_credits_ingress_host: >-
{{-
"{}.{}".format(coral_credits_ingress_subdomain, ingress_base_domain)
if coral_credits_ingress_subdomain is defined and ingress_base_domain is defined
else undef(hint = 'coral_credits_ingress_subdomain is required')
}}
# Subdomain for the Coral credits ingress host
coral_credits_ingress_subdomain: "coral"
# Annotations for coral_credits ingress resources
coral_credits_ingress_annotations: "{{ ingress_annotations | default({}) }}"
# Indicates whether TLS should be enabled
coral_credits_ingress_tls_enabled: "{{ ingress_tls_enabled | default(True) }}"
# The TLS secret name (can be null)
coral_credits_ingress_tls_secret_name: "{{ ingress_tls_secret_name | default('coral-cedits-tls') }}"
# Any TLS-specific annotations
coral_credits_ingress_tls_annotations: "{{ ingress_tls_annotations | default({}) }}"
# Wildcard TLS certificate, if available
coral_credits_ingress_tls_certificate: "{{ ingress_tls_wildcard_certificate | default(None) }}"
coral_credits_ingress_tls_key: >-
{{-
ingress_tls_wildcard_key
if ingress_tls_wildcard_key is defined
else undef(hint = 'coral_credits_ingress_tls_key is required')
}}
# The admin username to use for coral credits
coral_credits_admin_username: admin
# The admin password to use for coral credits
coral_credits_admin_password: >-
{{ undef(hint = 'coral_credits_admin_password is required') }}
# The values for the release
coral_credits_release_defaults:
ingress:
host: "{{ coral_credits_ingress_host }}"
annotations: "{{ coral_credits_ingress_annotations }}"
tls:
enabled: "{{ coral_credits_ingress_tls_enabled }}"
secretName: "{{ coral_credits_ingress_tls_secret_name }}"
annotations: "{{ coral_credits_ingress_tls_annotations }}"
settings:
superuserUsername: "{{ coral_credits_admin_username }}"
superuserPassword: "{{ coral_credits_admin_password }}"

coral_credits_release_overrides: {}
coral_credits_release_values: >-
{{-
coral_credits_release_defaults |
combine(coral_credits_release_overrides, recursive = True)
}}
31 changes: 31 additions & 0 deletions roles/coral_credits/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

- name: Install wildcard TLS certificate
command: kubectl apply -f -
args:
stdin: "{{ coral_credits_ingress_tls_wildcard_secret_definition | to_nice_yaml }}"
vars:
coral_credits_ingress_tls_wildcard_secret_definition:
apiVersion: v1
kind: Secret
metadata:
name: "{{ coral_credits_ingress_tls_secret_name }}"
namespace: "{{ coral_credits_release_namespace }}"
type: kubernetes.io/tls
stringData:
tls.crt: "{{ coral_credits_ingress_tls_certificate }}"
tls.key: "{{ coral_credits_ingress_tls_key }}"
when: coral_credits_ingress_tls_certificate

- name: Install Coral Credits API on target Kubernetes cluster
kubernetes.core.helm:
chart_ref: "{{ coral_credits_chart_name }}"
chart_repo_url: "{{ coral_credits_chart_repo }}"
chart_version: "{{ coral_credits_chart_version }}"
release_namespace: "{{ coral_credits_release_namespace }}"
release_name: "{{ coral_credits_release_name }}"
release_values: "{{ coral_credits_release_values }}"
atomic: yes
create_namespace: yes
wait: yes
wait_timeout: "{{ coral_credits_wait_timeout }}"

0 comments on commit b3ec925

Please sign in to comment.