-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc/gardenctl config #163
Doc/gardenctl config #163
Conversation
@petersutter do you think it would also be a good idea to somehow add the landscape name (aka garden cluster identity) in the dashboard? |
yes, I have created gardener/dashboard#1314 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@petersutter @grolu Please also merge as I don't have the correct rights :) |
README.md
Outdated
PROJECT="your-project-name" # Change to your project name | ||
SHOOT="your-shoot-name" # Change to any shoot's name in your project | ||
PREFIX="shoot--$PROJECT--$SHOOT-"$(kubectl get shoot -n garden-$PROJECT $SHOOT -ojsonpath={.metadata.uid})"-" | ||
STATUS=$(kubectl get shoot -n garden-$PROJECT $SHOOT -ojsonpath={.status.clusterIdentity}) | ||
CLUSTER_IDENTITY=$(echo ${STATUS#$PREFIX}) # difference between both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PROJECT="your-project-name" # Change to your project name | |
SHOOT="your-shoot-name" # Change to any shoot's name in your project | |
PREFIX="shoot--$PROJECT--$SHOOT-"$(kubectl get shoot -n garden-$PROJECT $SHOOT -ojsonpath={.metadata.uid})"-" | |
STATUS=$(kubectl get shoot -n garden-$PROJECT $SHOOT -ojsonpath={.status.clusterIdentity}) | |
CLUSTER_IDENTITY=$(echo ${STATUS#$PREFIX}) # difference between both | |
# This function should be added to your shell profile | |
function getClusterIdentity () { | |
local ns=$(kubectl get project $1 -ojsonpath={.spec.namespace}); | |
local uid=$(kubectl get shoot -n $ns $2 -ojsonpath={.metadata.uid}); | |
local status=$(kubectl get shoot -n $ns $2 -ojsonpath={.status.clusterIdentity}); | |
local prefix="shoot--$1--$2-$uid-"; | |
echo ${status#"$prefix"}; | |
} | |
CLUSTER_IDENTITY=$(getClusterIdentity "your-project-name" "your-shoot-name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why adding a function in the shell profile? Isn't this going to be needed only once as it's just to configure gardenctl?
After all, it's going to be saved in ~/.garden/gardenctl-v2.yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think that we need the function in the shell profile, this should only be a simple example on how to configure / setup gardenctl.
If we really want to extract it to a function it should handle both cases (as you mentioned out of this thread) and first try to fetch it from the kube-system namespace and if it fails ask the user to input a project and shoot name to try the fallback. Only then the project name and shoot name is relevant.
But I'm not sure if it's worth the effort / makes it more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. But we should not have something in our documentation where the namespace is constructed by prepending garden-
to the project name. This must be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's indeed a fair point! Just added an updated commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Co-authored-by: Peter Sutter <peter.sutter@sap.com>
f0e5b86
to
54def00
Compare
What this PR does / why we need it:
There was missing documentation on how to configure gardenctl if the kube-system namespace is blocked for a user.
So added a 2nd method to do that over CLI. I get and know that this is not an ideal solution, but it works well in the meantime
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: