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

K8S Connections - Native Cloud Providers #441

Open
moshloop opened this issue Mar 7, 2024 · 1 comment · May be fixed by #1195
Open

K8S Connections - Native Cloud Providers #441

moshloop opened this issue Mar 7, 2024 · 1 comment · May be fixed by #1195
Assignees
Milestone

Comments

@moshloop
Copy link
Member

moshloop commented Mar 7, 2024

i.e. specify

kubernetes:
  - kubeconfig:
         aws:
              cluster: 
                  value: 
              region: 
                  value: 
@moshloop moshloop added this to the v1.0.0 milestone Mar 15, 2024
@moshloop moshloop modified the milestones: v1.0.0, v1.1.0 Sep 3, 2024
@moshloop
Copy link
Member Author

See https://github.com/argoproj/argo-cd/blob/master/cmd/argocd-k8s-auth/commands/aws.go

and this for gke via cnrm

      while read -r NAME NAMESPACE; do
                  CLUSTER=$(kubectl get containercluster $NAME -n $NAMESPACE -o yaml)
                  LOCATION=$(echo "$CLUSTER" | yq '.spec.location')
                  PROJECT=$(echo "$CLUSTER" | yq '.metadata.annotations."cnrm.cloud.google.com/project-id"')
                  TEMPFILE="$NAME-$LOCATION-$PROJECT"
                  export KUBECONFIG="$TEMPFILE"
                  export TOKEN=$(gcloud auth print-access-token)
                  gcloud container clusters get-credentials $NAME --location $LOCATION --project $PROJECT
                  unset KUBECONFIG
                  yq -i '.users[].user.token = strenv(TOKEN) | del(.users[].user.exec)' $TEMPFILE
                  kubectl create secret generic $NAME-kubeconfig -n $NAMESPACE --from-file=kubeconfig=$TEMPFILE --dry-run=client -o yaml | kubectl apply -f -
              done < <(kubectl get containercluster -A -o custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep -v NAME)

@moshloop moshloop changed the title Native K8 Cloud Providers K8S Connections - Native Cloud Providers Nov 27, 2024
@adityathebe adityathebe linked a pull request Nov 28, 2024 that will close this issue
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.

2 participants