Skip to content

Commit

Permalink
Feat: add external OCI cloud controller manager workflow
Browse files Browse the repository at this point in the history
Signed-off-by: tico88612 <17496418+tico88612@users.noreply.github.com>
  • Loading branch information
tico88612 committed Jul 13, 2024
1 parent e5a1ca6 commit 6eea519
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
10 changes: 10 additions & 0 deletions roles/kubernetes-apps/external_cloud_controller/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ dependencies:
tags:
- external-cloud-controller
- external-huaweicloud
- role: kubernetes-apps/external_cloud_controller/oci
when:
- cloud_provider is defined
- cloud_provider == "external"
- external_cloud_provider is defined
- external_cloud_provider == "oci"
- inventory_hostname == groups['kube_control_plane'][0]
tags:
- external-cloud-controller
- external-oci
34 changes: 34 additions & 0 deletions roles/kubernetes-apps/external_cloud_controller/oci/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: External OCI Cloud Controller Manager | Get base64 cloud-config
set_fact:
external_oci_cloud_config_secret: "{{ lookup('template', 'external-oci-cloud-config.j2') | b64encode }}"
when: inventory_hostname == groups['kube_control_plane'][0]
tags: external-oci

- name: External OCI Cloud Controller Manager | Generate Manifests
template:
src: "{{ item.file }}.j2"
dest: "{{ kube_config_dir }}/{{ item.file }}"
group: "{{ kube_cert_group }}"
mode: 0640
with_items:
- {name: external-oci-cloud-config-secret, file: external-oci-cloud-config-secret.yml}
- {name: external-oci-cloud-controller-manager-rbac, file: external-oci-cloud-controller-manager-rbac.yml}
- {name: external-oci-cloud-controller-manager, file: external-oci-cloud-controller-manager.yml}
register: external_oci_manifests
when: inventory_hostname == groups['kube_control_plane'][0]
tags: external-oci

- name: External OCI Cloud Controller Manager | Apply Manifests
kube:
kubectl: "{{ bin_dir }}/kubectl"
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
state: "latest"
with_items:
- "{{ external_oci_manifests.results }}"
when:
- inventory_hostname == groups['kube_control_plane'][0]
- not item is skipped
loop_control:
label: "{{ item.item.file }}"
tags: external-oci

0 comments on commit 6eea519

Please sign in to comment.