From 28fca37541f01c95c1df6a3cda12cea8df678848 Mon Sep 17 00:00:00 2001 From: melserngawy Date: Wed, 17 Mar 2021 17:32:06 -0400 Subject: [PATCH] Add hw type to the cluster variables Signed-off-by: melserngawy --- acm-spoke/README.md | 3 +-- acm-spoke/enroll-clusters.yaml | 2 +- acm-spoke/import_cluster.sh | 2 ++ acm-spoke/inventory/hosts.sample | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/acm-spoke/README.md b/acm-spoke/README.md index b081c99..4fb1241 100644 --- a/acm-spoke/README.md +++ b/acm-spoke/README.md @@ -5,7 +5,6 @@ This playbook is to allow spoke-clusters to join the ACM hub. - We assume that there is already an ACM hub up and running. If not you can use the ../acm-hub/playbook.yaml to create an ACM hub. - Note: The ACM hub needs an independent cluster to run. Cannot use spoke-clusters to run ACM. - Note: The ACM must have this subscription_permission manifest https://github.com/redhat-ztp/ztp-acm-manifests/blob/main/hub/04_add_subscription_permission.yaml applied to give proper permissions, otherwise the subscriptions are not created correctly. - - The clusters that will be defined in the inventory/hosts under [clusters] section should have its profiles in the ztp-acm-manifest. Check the https://github.com/redhat-ztp/ztp-acm-manifests/tree/main/subscriptions/sites for more information - Steps: @@ -13,7 +12,7 @@ This playbook is to allow spoke-clusters to join the ACM hub. 2- go to acm-spoke dir - 3- make a copy inventory/hosts.sample file and rename it with hosts name under same directory. + 3- make a copy inventory/hosts.sample file and rename it as hosts under same directory. 4- modify the [all:vars] section at inventory/hosts file to match your setup. diff --git a/acm-spoke/enroll-clusters.yaml b/acm-spoke/enroll-clusters.yaml index 7a4d110..7158914 100644 --- a/acm-spoke/enroll-clusters.yaml +++ b/acm-spoke/enroll-clusters.yaml @@ -7,7 +7,7 @@ shell: "for kf in $(find {{ acm_directory.path }}/subscriptions/ -name kustomization.yaml); do oc --kubeconfig={{ kubeconfig_hub_path }} apply -k $(echo $kf | rev | cut -d'/' -f 2- | rev); done" - name: Import cluster to ACM - shell: "{{ temporary_path }}/import_cluster.sh {{ hostvars[item].name }} {{ hostvars[item].profile }} {{ kubeconfig_hub_path }} {{ temporary_path }}" + shell: "{{ temporary_path }}/import_cluster.sh {{ hostvars[item].name }} {{ hostvars[item].profile }} {{ kubeconfig_hub_path }} {{ temporary_path }} {{ hw }}" - name: Extract the klusterlet definition from ACM shell: "oc get secret/{{ hostvars[item].name }}-cluster-import -n {{ hostvars[item].name }}-cluster -o jsonpath={.data.crds\\\\.yaml} | base64 --decode > {{ acm_directory.path }}/crd.yaml" diff --git a/acm-spoke/import_cluster.sh b/acm-spoke/import_cluster.sh index f67236f..e7c41ac 100644 --- a/acm-spoke/import_cluster.sh +++ b/acm-spoke/import_cluster.sh @@ -4,6 +4,7 @@ CLUSTER_NAME=$1 PROFILE=$2 KUBE_CONFIG=$3 OUT_DIR=$4 +HW_TYPE=$5 cat << EOF > $OUT_DIR/$CLUSTER_NAME.yaml apiVersion: v1 @@ -19,6 +20,7 @@ metadata: vendor: auto-detect name: $CLUSTER_NAME-cluster profile: $PROFILE + hardwareType: $HW_TYPE name: $CLUSTER_NAME-cluster spec: hubAcceptsClient: true diff --git a/acm-spoke/inventory/hosts.sample b/acm-spoke/inventory/hosts.sample index 6ba5546..24c51a8 100644 --- a/acm-spoke/inventory/hosts.sample +++ b/acm-spoke/inventory/hosts.sample @@ -7,8 +7,8 @@ temporary_path=/tmp # example: https://github.com/redhat-ztp/ztp-acm-manifests/tree/main/subscriptions/sites/sample_site_cu_subscription # profile should be easier cu or du. [clusters] -cluster-1 name=sample-site-cu kubeconfig=/path/to/spoke_cluster_kubeconfig profile=cu acm_manifest_repo=https://github.com/redhat-ztp/ztp-acm-manifests -cluster-2 name=sample-site-du kubeconfig=/path/to/spoke_cluster_kubeconfig profile=du acm_manifest_repo=https://github.com/redhat-ztp/ztp-acm-manifests +cluster-1 name=sample-site-cu kubeconfig=/path/to/spoke_cluster_kubeconfig profile=cu acm_manifest_repo=https://github.com/redhat-ztp/ztp-acm-manifests hw=dell +cluster-2 name=sample-site-du kubeconfig=/path/to/spoke_cluster_kubeconfig profile=du acm_manifest_repo=https://github.com/redhat-ztp/ztp-acm-manifests hw=dell [provisioner] # host from where the installation is performed