Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,9 @@ To initialize the cluster, you need to provider it with the path to the config f
1. Use the config file.

```
VERSION=v0.3.0
curl -L -o clusterctl.yaml https://github.com/packethost/cluster-api-provider-packet/releases/download/${VERSION}/clusterctl.yaml
clusterctl --config=./clusterctl.yaml init --infrastructure=packet
clusterctl init --infrastructure=packet
```

Unfortunately, clusterctl itself does not support passing a URL to `--config`, see [this issue](https://github.com/kubernetes-sigs/cluster-api/issues/3099).

Additionally, we are in the process of working with the core cluster-api team, so that you will not need the
`--config=` option, hopefully soon.

#### Generate Cluster yaml

To generate your cluster yaml:
Expand All @@ -80,7 +73,7 @@ To generate your cluster yaml:
1. Run the cluster generation command:

```
clusterctl --config=./clusterctl.yaml config cluster <cluster-name> > out/cluster.yaml
clusterctl config cluster <cluster-name> > out/cluster.yaml
```

Note that the above command will make _all_ of the environment variables required. This is a limitation of
Expand Down
20 changes: 5 additions & 15 deletions scripts/generate-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@

set -e

# default configure URL
DEFAULT_CONFIG_URL=https://api.github.com/repos/packethost/cluster-api-provider-packet/releases/latest
TMPYAML=/tmp/clusterctl-packet.yaml

# might want to use a specific path to clusterctl
CLUSTERCTL=${CLUSTERCTL:-clusterctl}

# might want to use a specific config URL
CONFIG_URL=${CONFIG_URL:-""}

# if the config url was not provided, download it
if [ -z "${CONFIG_URL}" ]; then
# because github does not have a direct link to an asset
# this would be easier with jq, but not everyone has jq installed
YAML_URL=$(curl -s ${DEFAULT_CONFIG_URL} | grep clusterctl.yaml | grep browser_download_url | cut -d ":" -f 2,3 | tr -d "\"")
curl -L -o ${TMPYAML} ${YAML_URL}
CONFIG_URL=${TMPYAML}
CONFIG_OPT=${CONFIG_OPT:-""}
if [ -n "$CONFIG_URL" ]; then
CONFIG_OPT="--config ${CONFIG_URL}"
fi

TEMPLATE_OUT=./out/cluster.yaml
Expand Down Expand Up @@ -65,9 +57,7 @@ FACILITY=${PACKET_FACILITY}

# and now export them all so envsubst can use them
export PROJECT_ID FACILITY NODE_OS WORKER_NODE_TYPE MASTER_NODE_TYPE POD_CIDR SERVICE_CIDR SSH_KEY KUBERNETES_VERSION
${CLUSTERCTL} --config=${CONFIG_URL} config cluster ${CLUSTER_NAME} > $TEMPLATE_OUT
# remove any lingering config file
rm -f ${TMPYAML}
${CLUSTERCTL} ${CONFIG_OPT} config cluster ${CLUSTER_NAME} > $TEMPLATE_OUT

echo "Done! See output file at ${TEMPLATE_OUT}. Run:"
echo " kubectl apply -f ${TEMPLATE_OUT}"
Expand Down