Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom cluster image set name for agentclusterinstall file #10

Merged
merged 21 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ Then provide the addons you would like to enable or disabled in all hosts in the
### Generating manifests
On the Bastion machine, run script [`create-manifests.sh`](https://github.com/open-cluster-management/assisted-installer-batch-deploy-tool/blob/main/create-manifests.sh) to create the SNO clusters:
```sh
./create-manifests.sh inventory/csv/path pull/secret/path private-key-path
./create-manifests.sh inventory/csv/path pull/secret/path private/key/path cluster-image-set
```

If the script is exited without errors, manifests should be created for each inventory. The generated manifests are under `/clusters`. Under `/clusters`, directories will be created for each SNO clusters, with the directory name being the cluster name. Before continuing to the next step, we recommend spot checking the manifests of one of the generated clusters.

#### Required arguments
The 4 required arguments for the script are:
1. `inventory/csv/path` - file path to the inventory csv file. E.g. `/User/root/files/inventory.csv`
2. `pull/secret/path` - file path to the OCP pull secret file. E.g. `/User/root/files/pull_secret.txt`
3. `private/key/path` - file path to your SSH private key. E.g. `/User/root/.ssh/id_rsa`
4. `cluster-image-set` - name of the cluster image set to use in the `AgentClusterInstall` resource. E.g. `ocp-4.8`

#### Additional options
Set the following variables ahead of running the "Generating manifests" section.
`enable_workload_partitioning` - set to "true" to enable workload partitioning. Default is "false".
Expand Down
11 changes: 7 additions & 4 deletions create-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ set -o nounset
# Please provide the hardware information of VM Hosts in inventory-manifest.csv,
# as well as which addons you would like to enable or disable in acm-agent-addon.json.
# Usage:
# ./create-manifests.sh INVENTORY_FILE PULL_SECRET_PATH SSH_KEY_PATH'
# ./create-manifests.sh INVENTORY_FILE PULL_SECRET_PATH SSH_KEY_PATH CLUSTER_IMAGE_SET'

if [ -z "$3" ]; then
echo 'usage: ./create-manifests.sh INVENTORY_FILE PULL_SECRET_PATH SSH_KEY_PATH'
if [ -z "$4" ]; then
echo 'usage: ./create-manifests.sh INVENTORY_FILE PULL_SECRET_PATH SSH_KEY_PATH CLUSTER_IMAGE_SET'
exit 1
fi
inventory_file=$1
pull_secret_path=$2
ssh_key_path=$3
cluster_image_set=$4

enable_workload_partitioning=${enable_workload_partitioning:-"false"}


#network_type="OpenShiftSDN"
network_type="OVNKubernetes"

Expand All @@ -38,7 +40,7 @@ service_network="fd02::/112"

generate_manifest_yamls() {
local row=$1
IFS="," read cluster_name base_domain mac_addr ip_addr public_ip_network_prefix gateway machine_network_cidr dns_resolver bmc_addr bmc_username_base64 bmc_password_base64 <<<$row
IFS="," read cluster_name base_domain mac_addr ip_addr public_ip_network_prefix gateway machine_network_cidr dns_resolver bmc_addr bmc_username_base64 bmc_password_base64 <<< "$row"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!! 👍 I think there are a lot of other places we need to also make this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! I'll add this as a TODO item


local yaml_dir=clusters/"$cluster_name"/manifest
mkdir -p "$yaml_dir"
Expand All @@ -55,6 +57,7 @@ generate_manifest_yamls() {
-e "s~{{SERVICE_NETWORK}}~'$service_network'~g" \
-e "s~{{PUBLIC_KEY}}~'$public_key'~g" \
-e s~\{\{MACHINE_NETWORK_DIR\}\}~"$machine_network_cidr"~g \
-e s/\{\{CLUSTER_IMAGE_SET\}\}/"$cluster_image_set"/g \
templates/agentclusterinstall.template.yaml >"$yaml_dir"/500-agentclusterinstall.yaml

sed -e s/\{\{CLUSTER_NAME\}\}/"$cluster_name"/g \
Expand Down
2 changes: 1 addition & 1 deletion templates/agentclusterinstall.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
namespace: {{CLUSTER_NAME}}
spec:
imageSetRef:
name: "openshift-4.8.0-rc.1"
name: {{CLUSTER_IMAGE_SET}}
clusterDeploymentRef:
name: {{CLUSTER_NAME}}
networking:
Expand Down