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

Automatically select kube context. #251

Open
stewartmiles opened this issue Mar 23, 2022 · 0 comments · May be fixed by #252
Open

Automatically select kube context. #251

stewartmiles opened this issue Mar 23, 2022 · 0 comments · May be fixed by #252

Comments

@stewartmiles
Copy link

At the moment the scripts have code like this...

CURRENT_CONTEXT=$(kubectl config current-context)

if [ "$?" != "0" ]; then
  bold "No current Kubernetes context is configured."
  exit 1
fi

which is only going to catch no current context and is likely going to be wrong if a user has been managing other clusters with kubectl.

Since installation properties ~/cloudshell_open/spinnaker-for-gcp/scripts/install/properties are used throughout a range of scripts in the project which means that only one Spinnaker deployment can be managed from a user account (since they're tied to the user's home directory). Since Spinnaker's GKE Kubernetes context can be derived from gke_${PROJECT_ID}_${ZONE}_${DEPLOYMENT_NAME}, how about making it easier on users by automatically selecting the GKE context for the current Spinnaker deployment?

stewartmiles added a commit to stewartmiles/spinnaker-for-gcp that referenced this issue Mar 23, 2022
Since the cluster information is stored in
`scripts/install/properties`, this commit selects the Spinnaker
cluster using `kubectl config use-context` before trying to
read / write the cluster.

Fixes GoogleCloudPlatform#251
stewartmiles added a commit to stewartmiles/spinnaker-for-gcp that referenced this issue Mar 23, 2022
Since the cluster information is stored in
`scripts/install/properties`, this commit selects the Spinnaker
cluster using `kubectl config use-context` before trying to
read / write the cluster.

Fixes GoogleCloudPlatform#251
stewartmiles added a commit to stewartmiles/spinnaker-for-gcp that referenced this issue Mar 24, 2022
Since the cluster information is stored in
`scripts/install/properties`, this commit selects the Spinnaker
cluster using `kubectl config use-context` before trying to
read / write the cluster.

Fixes GoogleCloudPlatform#251
stewartmiles added a commit to stewartmiles/spinnaker-for-gcp that referenced this issue Mar 24, 2022
Since the cluster information is stored in
`scripts/install/properties`, this commit selects the Spinnaker
cluster using `kubectl config use-context` before trying to
read / write the cluster.

Fixes GoogleCloudPlatform#251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant