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

Commit 6ad2bf7

Browse files
author
Mathieu Benoit
committed
Config Controller's root-repo is now private for more security
1 parent f6b483c commit 6ad2bf7

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

content/config-controller/set-up-config-controller-git-repo.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,30 @@ kubectl wait --for condition=established crd rootsyncs.configsync.gke.io
6060

6161
## Define the primary Git repository
6262

63-
Create a dedicated GitHub repository to store any Kubernetes manifests associated to the GCP Organization:
63+
Create a dedicated private GitHub repository to store any Kubernetes manifests associated to the GCP Organization:
6464
```Bash
6565
cd ~
6666
gh repo create $WORKSHOP_ORG_DIR_NAME --public --clone --template https://github.com/mathieu-benoit/config-sync-template-repo
6767
cd ~/$WORKSHOP_ORG_DIR_NAME
6868
git pull
6969
git checkout main
70-
ORG_REPO_URL=$(gh repo view --json url --jq .url)
70+
ORG_REPO_URL=$(gh repo view --json sshUrl --jq .sshUrl)
71+
ORG_REPO_NAME_WITH_OWNER=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
72+
```
73+
74+
Generate [SSH key pair](https://cloud.google.com/anthos-config-management/docs/how-to/installing-config-sync#ssh-key-pair) in order to get a read access to the private Git repository:
75+
```Bash
76+
mkdir tmp
77+
ssh-keygen -t rsa -b 4096 \
78+
-C "${ORG_REPO_NAME_WITH_OWNER}@github" \
79+
-N '' \
80+
-f ./tmp/github-org-repo
81+
kubectl create ns config-management-system && \
82+
kubectl create secret generic git-creds \
83+
--namespace=config-management-system \
84+
--from-file=ssh=./tmp/github-org-repo
85+
gh repo deploy-key add ./tmp/github-org-repo.pub
86+
rm -r tmp
7187
```
7288

7389
Deploy a `RootSync` linking this GitHub repository to the Config Controller instance as the main/root GitOps configuration:
@@ -85,13 +101,17 @@ spec:
85101
revision: HEAD
86102
branch: main
87103
dir: config-sync
88-
auth: none
104+
auth: ssh
105+
secretRef:
106+
name: git-creds
89107
EOF
90108
```
91-
{{% notice info %}}
92-
Since you started this workshop, you just ran 4 `kubectl` commands. For your information, moving forward you won't run any other `kubectl` commands because the design and intent of this workshop is to only deploy any Kubernetes resources via GitOps with Config Sync. You will also use some handy `gcloud` commands when appropriate.
109+
{{% notice tips %}}
110+
The GitHub repository is private in order to demonstrate how to allow read access to Config Sync when you use a restricted Git repository.
93111
{{% /notice %}}
94112

113+
Since you started this workshop, you just ran 6 `kubectl` commands. For your information, moving forward you won't run any other `kubectl` commands because the design and intent of this workshop is to only deploy any Kubernetes resources via GitOps with Config Sync. You will also use some handy `gcloud` commands when appropriate.
114+
95115
## Define Cloud Billing API
96116

97117
In order to have Config Controller's Config Sync linking a Billing Account to GCP projects later in this workshop, we need to define the Cloud Billing API [`Service`](https://cloud.google.com/config-connector/docs/reference/resource-docs/serviceusage/service) resource for Config Controller's GCP project:

content/overview/objectives.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Three personas are involved:
4141
- 2 GCP Projects
4242
- 1 Config Controller instance
4343
- 1 GKE cluster
44-
- 4 `kubectl` commands
45-
- 44 `git commit` commands
46-
- 126 `gcloud` commands
44+
- 6 `kubectl` commands
45+
- 42 `git commit` commands
46+
- 170 `gcloud` commands
4747
- 145 Kubernetes manifests
4848
- 57 KCC resources
4949
- 12 containerized apps

content/whereami/set-up-authorization-policies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ git push origin main
5757
List the GitHub runs for the **Whereami app** repository `cd ~/$WHERE_AMI_DIR_NAME && gh run list`:
5858
```Plaintext
5959
STATUS NAME WORKFLOW BRANCH EVENT ID ELAPSED AGE
60-
✓ Whereami Authorization Policy ci main push 1976612253 1m9s 2m
60+
✓ Whereami Authorization Policy ci main push 1976612253 1m9s 2m
6161
✓ Whereami Sidecar ci main push 1976601129 1m3s 5m
6262
✓ Whereami Network Policies ci main push 1976593659 1m1s 1m
6363
✓ Whereami app ci main push 1976257627 1m1s 2h

0 commit comments

Comments
 (0)