New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@sctg/okteto-auto-token

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sctg/okteto-auto-token

generate kube.config automatically for Okteto

latest
npmnpm
Version
0.9.1
Version published
Maintainers
1
Created
Source

Okteto auto tokens library

Why

If you are working with multiple Okteto workpaces and you interact on them with kubectl it might be difficult to maintain a correct kube.config.

Idea

The main idea is to maintain only a json file describing your workspaces.
The json files is populated with some long life (180 days) personal access token. One for each Okteto context.

Start

Create a config/clusters.json according to the sample config/sample_clusters.json.

Demo tools

kubeconfig.ts

This simple typescript for generating a kube.config automatically with 1 day short life access tokens.
create a .env file:

PORT="8080"
CLUSTERS_FILE="./config/clusters.json"

index.ts

This is a sample Express server provinding 3 paths:

  • /kube.config returning a YAML formatted kube.config
  • /kube.json returning a JSON formatted kube.config
  • /token.sh returning a bash script with the long life access tokens as shell variable Simply start it with:
npm i
npm run build
npm run start

Don't repeat yourself

For using clusters.json in your bash script it is easy to generate the token variables with:
Example with yq tool:

eval `cat clusters.json | yq -r '.[] | { (.bash_token): .token} | to_entries | .[] | .key +"=" + (.value | @sh)'`

or with jq tool:

eval `cat clusters.json | jq -r '.[] | { (.bash_token): .token} | to_entries | .[] | .key + "=" + (.value | @sh)'`

FAQs

Package last updated on 13 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts