Skip to content

Commit

Permalink
change ns from alpha to stockholm
Browse files Browse the repository at this point in the history
  • Loading branch information
600lyy committed Nov 23, 2022
1 parent 9c8cbc7 commit b638245
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 60 deletions.
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,28 @@ git push -u orighin main
## Repo Hierarchy
**Central Root Repo (`Build-KRM-Platform/cluster/`):**
```bash
.
├── apply-spec.yaml
├── backups
│ ├── admin.yaml
│ ├── alpha.yaml
│ ├── beta.yaml
│ ├── configconnectorcontext.yaml
│ ├── configconnector.yaml
│ ├── install.sh
│ └── reposync-alpha.yaml
├── cluster
│ ├── reposync-alpha.yaml
│ ├── newyork.yaml
│ ├── reposync-iam
│ │ ├── alpha-configconnectorcontext.yaml
│ │ └── alpha-rolebinding.yaml
│ ├── rootsync-kcc.yaml
│ │ ├── stockholm-configconnectorcontext.yaml
│ │ └── stockholm-rolebinding.yaml
│ ├── reposync-stockholm.yaml
│ └── stockholm.yaml
├── cluster
│ └── rootsync.yaml
├── configconnector.yaml
├── gcp-resources
│ └── alpha
│ └── stockholm
├── install-config-connector.sh
├── install.sh
├── namespaces
│ ├── admin.yaml
│ └── alpha.yaml
├── README.md
└── setup-iam-for-kcc-ns-alpha.sh
└── setup-iam-for-kcc-ns-sthlm.sh
```

**RootSync**
Expand Down Expand Up @@ -102,7 +99,7 @@ Should display "SYNCD" for all clusters with the latest commit SHA.

Should include:
- admin
- alpha
- stockholm
- beta

## Attempt to delete a namespace from the cluster
Expand All @@ -120,7 +117,7 @@ Expected result:
kubetctl get ns infra-dev -o yaml

NAME STATUS AGE
alpha Active 1s
stockholm Active 1s
```

You can see Config Sync re-creates the namespace on your behalf, to make sure the consistency between your current state with desired state across all clusters.
Expand Down
6 changes: 0 additions & 6 deletions backups/alpha.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion backups/newyork.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: team-newyork
name: newyork
20 changes: 0 additions & 20 deletions backups/reposync-alpha.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ kind: ConfigConnectorContext
metadata:
# you can only have one ConfigConnectorContext per namespace
name: configconnectorcontext.core.cnrm.cloud.google.com
namespace: alpha
namespace: stockholm
annotations:
configsync.gke.io/cluster-name-selector: admin
spec:
googleServiceAccount: "kcc-sa-alpha@k8s-lab-322711.iam.gserviceaccount.com"
googleServiceAccount: "kcc-sa-stockholm@k8s-lab-322711.iam.gserviceaccount.com"
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: repo-sync-rolebinding
namespace: alpha
namespace: stockholm
annotations:
configsync.gke.io/cluster-name-selector: admin
subjects:
- kind: ServiceAccount
name: ns-reconciler-alpha
name: ns-reconciler-stockholm
namespace: config-management-system
roleRef:
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
# There can be at most one RepoSync object per namespace.
# To enforce this restriction, the object name must be repo-sync.
name: repo-sync
namespace: alpha
namespace: stockholm
annotations:
configsync.gke.io/cluster-name-selector: admin
spec:
Expand All @@ -15,7 +15,7 @@ spec:
repo: https://github.com/600lyy/Build-KRM-Platform.git
# If you move the configs to a different branch, update the branch here
branch: main
dir: gcp-resources/alpha
dir: gcp-resources/stockholm
auth: token
# Refer to a Secret you create to hold the private key, cookiefile, or token.
secretRef:
Expand Down
4 changes: 3 additions & 1 deletion backups/stockholm.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: team-stockholm
annotations:
cnrm.cloud.google.com/project-id: k8s-lab-322711
name: stockholm
File renamed without changes.
6 changes: 0 additions & 6 deletions namespaces/alpha.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions setup-iam-for-kcc-ns-alpha.sh → setup-iam-for-kcc-ns-sthlm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://cloud.google.com/config-connector/docs/how-to/advanced-install#namespaced-mode

# In this demo examplem, host project and managed project are one project. The project is linked to
# namespace alpha
# namespace stockholm


if [[ -z "$PROJECT_ID" ]]; then
Expand All @@ -20,8 +20,8 @@ if [[ -z "$GITHUB_TOKEN" ]]; then
exit 1
fi

export SERVICE_ACCOUNT_NAME="kcc-sa-alpha"
export MANAGED_NAMESPACE="alpha"
export SERVICE_ACCOUNT_NAME="kcc-sa-stockholm"
export MANAGED_NAMESPACE="stockholm"


setup_sa_for_kcc () {
Expand All @@ -46,11 +46,11 @@ setup_sa_for_kcc () {
create_git_secret () {
CLUSTER_NAME=$1

echo "********** Creating Secret in alpha namespace to grant Config Sync access to your repos: $CLUSTER_NAME ***************"
echo "********** Creating Secret in stockholm namespace to grant Config Sync access to your repos: $CLUSTER_NAME ***************"
kubectl ctx $CLUSTER_NAME

kubectl create secret generic git-creds \
--namespace="alpha" \
--namespace="team-stockholm" \
--from-literal=username=$GITHUB_USERNAME \
--from-literal=token=$GITHUB_TOKEN
}
Expand Down

0 comments on commit b638245

Please sign in to comment.