Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit fd21a66

Browse files
committed
standardize generate-yaml.sh and secrets
1 parent b8971d3 commit fd21a66

9 files changed

+276
-246
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OS ?= $(BUILDOS)
3131

3232
# Image URL to use all building/pushing image targets
3333
IMG ?= packethost/cluster-api-provider-packet:latest
34-
PROVIDERYAML ?= provider-components.yaml
34+
PROVIDERYAML ?= provider-components.yaml.template
3535
CLUSTERCTL ?= bin/clusterctl-$(OS)-$(ARCH)
3636
MANAGER ?= bin/manager-$(OS)-$(ARCH)
3737
KUBECTL ?= kubectl
@@ -66,7 +66,8 @@ install: manifests
6666

6767
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
6868
deploy: manifests
69-
cat provider-components.yaml | kubectl apply -f -
69+
generate-yaml.sh
70+
cat out/packet/provider-components.yaml | kubectl apply -f -
7071

7172
# Generate manifests e.g. CRD, RBAC etc.
7273
manifests: $(PROVIDERYAML)

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To deploy a cluster:
3737
1. Create the config files you need via `./generate-yaml.sh`. This will generate the following files in [out/packet](./out/packet):
3838
* `cluster.yaml`
3939
* `machines.yaml`
40-
* `provider-components.yaml`
40+
* `provider-components.yaml` - note that this file _will_ contain your secrets, specifically `PACKET_API_KEY`, to be loaded into the cluster
4141
* `addons.yaml`
4242
1. If desired, edit the following files:
4343
* `cluster.yaml` - to change parameters or settings, including network CIDRs
@@ -62,7 +62,6 @@ Run `clusterctl create cluster --help` for more options, for example to use an e
6262
* creating a new one using [kind](https://github.com/kubernetes-sigs/kind)
6363
* connecting using the provided kubeconfig
6464
1. Deploy the provider components in `provider-components.yaml`
65-
1. Update the secret in the cluster with your credentials based on the environment variables set earlier
6665
1. Create a master node on Packet, download the `kubeconfig` file
6766
1. Connect to the master and deploy the controllers
6867
1. Create worker nodes
@@ -74,17 +73,20 @@ Run `clusterctl create cluster --help` for more options, for example to use an e
7473

7574
If you _really_ want to deploy manually, rather than using `clusterctl`, do the following. This assumes that you have generated the yaml files as required.
7675

77-
1. Ensure you have a cluster running
78-
1. Edit the `provider-components.yaml` to update the secret at the very end with the real values for the project ID and API key
76+
1. Ensure you have a bootstrap cluster running
77+
1. Run `./generate-yaml.sh` per the instructions above
7978
1. Deploy the manager controller: `kubectl apply -f provider-components.yaml`
8079
1. Deploy the cluster: `kubectl apply -f cluster.yaml`
8180
1. Deploy the machines: `kubectl apply -f machines.yaml`
8281
1. Deploy the addons: `kubectl apply -f addons.yaml`
82+
1. Create a `kubeconfig` file for the workload cluster
83+
1. "Pivot" to the workload cluster by switching to the new kubeconfig: `export KUBECONFIG=kubeconfig`
84+
1. Reapply all of the components: `kubectl apply -f provider-components.yaml cluster.yaml machines.yaml addons.yaml`
85+
1. Shut down the bootstrap cluster, if desired
8386

8487
Note that, unlike `clusterctl`, this method will not take care of the following:
8588

8689
* create a bootstrap cluster
87-
* inject the actual secret values
8890
* pivot the control from the bootstrap cluster to the newly started cluster
8991
* remove the bootstrap cluster
9092

@@ -106,6 +108,7 @@ The components deployed via the `yaml` files are the following:
106108
* all of the necessary `ClusterRole`, `ClusterRoleBinding`, `ServiceAccount` to run the controllers
107109
* Packet-specific `manager` binary, in a `StatefulSet`, whose control loop manages the `Cluster` and `MachineDeployment` resources, and creates, updates or removes `Machine` resources
108110
* Cluster-API-generic `controller` binary, in a `StatefulSet`, whose control loop manages the `Machine` resources
111+
* `Secret` with Packet credentials
109112

110113
As of this writing, the Packet cluster-api provider control plane supports only one master node. Thus, you should deploy a single control plane node as a `Machine`, and the worker nodes as a `MachineDeployment`. This is the default provided by `generate-yaml.sh`. Because the worker nodes are a `MachineDeployment`, the cluster-api manager keeps track of the count. If one disappears, it ensures that a new one is deployed to take its place.
111114

cmd/clusterctl/examples/packet/generate-yaml.sh

Lines changed: 0 additions & 155 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../generate-yaml.sh
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../provider-components.yaml.template

config/crds/packetprovider_v1alpha1_packetclusterproviderspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ spec:
2626
type: string
2727
metadata:
2828
type: object
29-
project:
29+
projectID:
3030
type: string
3131
required:
32-
- project
32+
- projectID
3333
version: v1alpha1
3434
status:
3535
acceptedNames:

config/crds/packetprovider_v1alpha1_packetmachineproviderspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ spec:
4747
type: string
4848
type: array
4949
required:
50+
- OS
51+
- projectID
52+
- billingCycle
5053
- machineType
5154
version: v1alpha1
5255
status:

config/manager/manager.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ kind: Secret
8888
metadata:
8989
name: credentials
9090
namespace: system
91-
type: Opaque
9291
stringData:
93-
# these are stubs that are replaced by clusterctl
94-
apiKey: "apiKey"
95-
projectID: "projectID"
92+
apiKey: $PACKET_API_KEY
93+
projectID: $PACKET_PROJECT_ID
94+
type: Opaque

generate-yaml.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)