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

Possibility to retrieve EKS token #2331

Open
Vrtak-CZ opened this issue Apr 30, 2021 · 4 comments
Open

Possibility to retrieve EKS token #2331

Vrtak-CZ opened this issue Apr 30, 2021 · 4 comments
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@Vrtak-CZ
Copy link

Is your feature request related to a problem? Please describe.

For programatically access to EKS cluster resources (kubernetes api).

Describe the solution you'd like

Probably STS command for retrieving token.

@Vrtak-CZ Vrtak-CZ added the feature-request New feature or enhancement. May require GitHub community feedback. label Apr 30, 2021
@Vrtak-CZ
Copy link
Author

From my point of view there should be a similar command as https://docs.aws.amazon.com/cli/latest/reference/eks/get-token.html

@aldredb
Copy link

aldredb commented Jun 27, 2021

This is an important feature. @Vrtak-CZ do you have any workarounds?

@AllanZhengYP
Copy link
Contributor

This feature is implemented in AWS CLI as a customization: aws/aws-cli#4141

@AllanZhengYP AllanZhengYP self-assigned this Mar 14, 2022
@TimisRobert
Copy link

I'll repost my gist, maybe someday it will be implemented (:

import { SignatureV4 } from "@aws-sdk/signature-v4";
import { Sha256 } from "@aws-crypto/sha256-js";
import { fromEnv } from "@aws-sdk/credential-providers";

 const signer = new SignatureV4({
    credentials: fromEnv(),
    region: process.env.AWS_REGION ?? "",
    service: "sts",
    sha256: Sha256,
  });

  const request = await signer.presign(
    {
      headers: {
        host: `sts.${process.env.AWS_REGION}.amazonaws.com`,
        "x-k8s-aws-id": "<cluster-id>",
      },
      hostname: `sts.${process.env.AWS_REGION}.amazonaws.com`,
      method: "GET",
      path: "/",
      protocol: "https:",
      query: {
        Action: "GetCallerIdentity",
        Version: "2011-06-15",
      },
    },
    { expiresIn: 0 }
  );

  const query = Object.keys(request?.query ?? {})
    .map(
      (q) =>
        encodeURIComponent(q) +
        "=" +
        encodeURIComponent(request.query?.[q] as string)
    )
    .join("&");

  const url = `https://${request.hostname}${request.path}?${query}`;

  const token = "k8s-aws-v1." + Buffer.from(url).toString("base64url");
};

@AllanZhengYP AllanZhengYP removed their assignment Sep 3, 2022
@RanVaknin RanVaknin added the p2 This is a standard priority issue label Feb 22, 2023
@RanVaknin RanVaknin added the queued This issues is on the AWS team's backlog label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
Development

No branches or pull requests

5 participants