feat: add ability to sync charts + use offline install for pxc-operator
diff --git a/roles/percona_xtradb_cluster_operator/defaults/main.yml b/roles/percona_xtradb_cluster_operator/defaults/main.yml
index 740006e..0deab7f 100644
--- a/roles/percona_xtradb_cluster_operator/defaults/main.yml
+++ b/roles/percona_xtradb_cluster_operator/defaults/main.yml
@@ -1,9 +1,6 @@
-percona_xtradb_cluster_operator_helm_repository_name: percona
-percona_xtradb_cluster_operator_helm_repository_url: https://percona.github.io/percona-helm-charts
-
percona_xtradb_cluster_operator_helm_release_name: pxc-operator
-percona_xtradb_cluster_operator_helm_chart_name: pxc-operator
-percona_xtradb_cluster_operator_helm_chart_version: 1.10.0
+percona_xtradb_cluster_operator_helm_chart_path: "{{ role_path }}/../../charts/pxc-operator/"
+percona_xtradb_cluster_operator_helm_chart_ref: /usr/local/src/pxc-operator
percona_xtradb_cluster_operator_helm_release_namespace: openstack
percona_xtradb_cluster_operator_helm_values: {}
diff --git a/roles/percona_xtradb_cluster_operator/meta/main.yml b/roles/percona_xtradb_cluster_operator/meta/main.yml
index aaf5af5..cc00085 100644
--- a/roles/percona_xtradb_cluster_operator/meta/main.yml
+++ b/roles/percona_xtradb_cluster_operator/meta/main.yml
@@ -25,3 +25,7 @@
dependencies:
- role: defaults
+ - role: upload_helm_chart
+ vars:
+ upload_helm_chart_src: "{{ percona_xtradb_cluster_operator_helm_chart_path }}"
+ upload_helm_chart_dest: "{{ percona_xtradb_cluster_operator_helm_chart_ref }}"
diff --git a/roles/percona_xtradb_cluster_operator/tasks/main.yml b/roles/percona_xtradb_cluster_operator/tasks/main.yml
index 136a86b..92e8a73 100644
--- a/roles/percona_xtradb_cluster_operator/tasks/main.yml
+++ b/roles/percona_xtradb_cluster_operator/tasks/main.yml
@@ -1,9 +1,3 @@
-- name: Configure Helm repository
- run_once: true
- kubernetes.core.helm_repository:
- name: "{{ percona_xtradb_cluster_operator_helm_repository_name }}"
- repo_url: "{{ percona_xtradb_cluster_operator_helm_repository_url }}"
-
# NOTE(mnaser): We should get rid of this task eventually as it is suspending
# the old HelmRelease and removing it to avoid uninstalling the
# Helm chart.
@@ -33,8 +27,7 @@
run_once: true
kubernetes.core.helm:
name: "{{ percona_xtradb_cluster_operator_helm_release_name }}"
- chart_ref: "{{ percona_xtradb_cluster_operator_helm_repository_name }}/{{ percona_xtradb_cluster_operator_helm_chart_name }}"
- chart_version: "{{ percona_xtradb_cluster_operator_helm_chart_version }}"
+ chart_ref: "{{ percona_xtradb_cluster_operator_helm_chart_ref }}"
release_namespace: "{{ percona_xtradb_cluster_operator_helm_release_namespace }}"
create_namespace: true
kubeconfig: /etc/kubernetes/admin.conf
diff --git a/roles/upload_helm_chart/README.md b/roles/upload_helm_chart/README.md
new file mode 100644
index 0000000..8a33d3e
--- /dev/null
+++ b/roles/upload_helm_chart/README.md
@@ -0,0 +1,7 @@
+# `upload_helm_chart`
+
+This role takes a Helm chart and uploads it from Atmosphere to the remote
+system which is running the Helm commands.
+
+Since we bundle all of the Helm charts into the Ansible collection, we need
+to upload the chart to the remote system before we can install it.
diff --git a/roles/upload_helm_chart/meta/main.yml b/roles/upload_helm_chart/meta/main.yml
new file mode 100644
index 0000000..626ff8f
--- /dev/null
+++ b/roles/upload_helm_chart/meta/main.yml
@@ -0,0 +1,24 @@
+# Copyright (c) 2022 VEXXHOST, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+galaxy_info:
+ author: VEXXHOST, Inc.
+ description: Upload helm charts to remote system
+ license: Apache-2.0
+ min_ansible_version: 5.5.0
+ standalone: false
+ platforms:
+ - name: Ubuntu
+ versions:
+ - focal
diff --git a/roles/upload_helm_chart/tasks/main.yml b/roles/upload_helm_chart/tasks/main.yml
new file mode 100644
index 0000000..7f3f230
--- /dev/null
+++ b/roles/upload_helm_chart/tasks/main.yml
@@ -0,0 +1,7 @@
+- name: Upload Helm chart
+ ansible.builtin.copy:
+ src: "{{ upload_helm_chart_src }}"
+ dest: "{{ upload_helm_chart_dest }}"
+ owner: root
+ group: root
+ mode: 0644