Skip to content

Commit

Permalink
Doc/gardenctl config (#163)
Browse files Browse the repository at this point in the history
* not quite there yet

* found a good solution

* small correction

* small correction 2

* Update README.md

Co-authored-by: Peter Sutter <peter.sutter@sap.com>

* no mo export

* no mo export 2

* dynamic ns

Co-authored-by: Peter Sutter <peter.sutter@sap.com>
  • Loading branch information
etiennnr and petersutter authored Oct 21, 2022
1 parent 33fa169 commit 2dcde47
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,20 @@ Example `config` command:
# Adapt the path to your kubeconfig file for the garden cluster
export KUBECONFIG=~/relative/path/to/kubeconfig.yaml

# Fetch cluster-identity of garden cluster
CLUSTER_IDENTITY=$(kubectl -n kube-system get configmap cluster-identity -ojsonpath={.data.cluster-identity})
# Method 1 : Fetch cluster-identity of garden cluster from the configmap
cluster_identity=$(kubectl -n kube-system get configmap cluster-identity -ojsonpath={.data.cluster-identity})
# OR
# Method 2 : If you don't have access to the kube-system namespace in the garden cluster, the garden cluster-identity can also be extracted from every shoot's yaml
project="your-project-name" # Change to your project name
shoot="your-shoot-name" # Change to any shoot's name in your project
# Simply copy/paste the following lines
ns=$(kubectl get project $project -ojsonpath={.spec.namespace})
prefix="shoot--$project--$shoot-"$(kubectl get shoot -n $ns $shoot -ojsonpath={.metadata.uid})"-"
identity_status=$(kubectl get shoot -n $ns $shoot -ojsonpath={.status.clusterIdentity})
cluster_identity=$(echo ${identity_status#"$prefix"})

# Configure garden cluster
gardenctl config set-garden $CLUSTER_IDENTITY --kubeconfig $KUBECONFIG
gardenctl config set-garden $cluster_identity --kubeconfig $KUBECONFIG
```
This command will create or update a garden with the provided identity and kubeconfig path of your garden cluster.

Expand Down

0 comments on commit 2dcde47

Please sign in to comment.