Skip to content

Commit

Permalink
Add hw type to the cluster variables
Browse files Browse the repository at this point in the history
Signed-off-by: melserngawy <[email protected]>
  • Loading branch information
serngawy authored and yrobla committed Mar 18, 2021
1 parent 213c3ba commit 28fca37
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions acm-spoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ 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:

1- git clone the ztp-cluster-deploy repo

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.

Expand Down
2 changes: 1 addition & 1 deletion acm-spoke/enroll-clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions acm-spoke/import_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,6 +20,7 @@ metadata:
vendor: auto-detect
name: $CLUSTER_NAME-cluster
profile: $PROFILE
hardwareType: $HW_TYPE
name: $CLUSTER_NAME-cluster
spec:
hubAcceptsClient: true
Expand Down
4 changes: 2 additions & 2 deletions acm-spoke/inventory/hosts.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 28fca37

Please sign in to comment.