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

Commit 83f53ce

Browse files
committed
Add secrets to addons.yaml too, since in different namespace
1 parent da3344c commit 83f53ce

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To deploy a cluster:
3838
* `cluster.yaml`
3939
* `machines.yaml`
4040
* `provider-components.yaml` - note that this file _will_ contain your secrets, specifically `PACKET_API_KEY`, to be loaded into the cluster
41-
* `addons.yaml`
41+
* `addons.yaml` - note that this file _will_ contain your secrets, specifically `PACKET_API_KEY`, to be loaded into the cluster
4242
1. If desired, edit the following files:
4343
* `cluster.yaml` - to change parameters or settings, including network CIDRs
4444
* `machines.yaml` - to change parameters or settings, including machine types and quantity
@@ -68,6 +68,14 @@ Run `clusterctl create cluster --help` for more options, for example to use an e
6868
1. Deploy add-on components, e.g. the [packet cloud-controller-manager](https://github.com/packethost/packet-ccm) and the [packet cloud storage interface provider](https://github.com/packethost/csi-packet)
6969
1. If a new bootstrap cluster was created, terminate it
7070

71+
#### About Those Secrets
72+
73+
Notice that the API key is load into _two_ separate files, `provider-components.yaml` and `addons.yaml`. This is unfortunately necessary.
74+
75+
* `provider-components.yaml` - needs the secret to run the `manager` that creates and destroys nodes.
76+
* `addons.yaml` - needs the secret to run the Packet cloud controller manager.
77+
78+
Each of these runs in a distinct namespace, which means that each needs it in a separate kubernetes `Secret`. In the future, we may merge the namespaces or, more likely, create an authentication service that gives out credentials.
7179

7280
### Deploying Manually
7381

cmd/clusterctl/examples/packet/addons.yaml.template

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,12 @@ subjects:
150150
name: cloud-controller-manager
151151
namespace: kube-system
152152
---
153-
kind: StorageClass
154-
apiVersion: storage.k8s.io/v1
155-
metadata:
156-
name: standard
157-
annotations:
158-
storageclass.kubernetes.io/is-default-class: "true"
159-
provisioner: kubernetes.io/gce-pd
160-
parameters:
161-
type: pd-standard
162-
---
163153
apiVersion: v1
164-
kind: ConfigMap
154+
kind: Secret
165155
metadata:
166-
name: ingress-controller-config
156+
name: cluster-api-provider-packet-credentials
167157
namespace: kube-system
168-
data:
169-
gce.conf: |
170-
[global]
171-
token-url = nil
172-
network = default
173-
project-id = $GCLOUD_PROJECT
174-
node-tags = $CLUSTER_NAME-worker
158+
stringData:
159+
apiKey: "$PACKET_API_KEY"
160+
projectID: "$PACKET_PROJECT_ID"
161+
type: Opaque

generate-yaml.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ cat $CLUSTER_TEMPLATE_FILE \
163163

164164
cat $ADDON_TEMPLATE_FILE \
165165
| sed -e "s/\$CLUSTER_NAME/$CLUSTER_NAME/" \
166+
| sed -e "s/\$PACKET_PROJECT_ID/$PACKET_PROJECT_ID/" \
167+
| sed -e "s/\$PACKET_API_KEY/$PACKET_API_KEY/" \
166168
> $ADDON_GENERATED_FILE
167169

168170
echo -e "\nYour cluster name is '${CLUSTER_NAME}'"

0 commit comments

Comments
 (0)