Skip to content
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

Merged
merged 8 commits into from
Oct 21, 2022
Merged

Conversation

etiennnr
Copy link
Contributor

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:

Added a second method to configure gardenctl which requres less premissions

@etiennnr etiennnr requested a review from a team as a code owner September 30, 2022 15:32
@gardener-robot gardener-robot added needs/review Needs review size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) labels Sep 30, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 30, 2022
@etiennnr
Copy link
Contributor Author

etiennnr commented Sep 30, 2022

@petersutter do you think it would also be a good idea to somehow add the landscape name (aka garden cluster identity) in the dashboard?

@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 30, 2022
@petersutter
Copy link
Member

@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

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 12, 2022
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 12, 2022
@etiennnr etiennnr requested a review from petersutter October 12, 2022 14:33
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 12, 2022
Copy link
Member

@petersutter petersutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/review Needs review labels Oct 12, 2022
Copy link
Contributor

@grolu grolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@etiennnr
Copy link
Contributor Author

@petersutter @grolu Please also merge as I don't have the correct rights :)

README.md Outdated
Comment on lines 68 to 72
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")

Copy link
Contributor Author

@etiennnr etiennnr Oct 12, 2022

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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

@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 13, 2022
Copy link
Member

@petersutter petersutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Member

@holgerkoser holgerkoser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 21, 2022
@petersutter petersutter merged commit 2dcde47 into gardener:master Oct 21, 2022
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/lgtm Has approval for merging size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants