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

[WIP] convert create-user.sh to pure go functions #995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

9trocode
Copy link

@9trocode 9trocode commented Feb 27, 2024

The result of this code would look like this it generates ${tenant}-${user}.kubeconfig

{
  "apiVersion": "v1",
  "kind": "Config",
  "clusters": [
    {
      "name": "orbstack",
      "cluster": {
        "certificate-authority-data": "<data>",
        "server": "https://127.0.0.1:26443"
      }
    }
  ],
  "contexts": [
    {
      "name": "oil-oil",
      "context": {
        "cluster": "orbstack",
        "user": "oil"
      }
    }
  ],
  "current-context": "oil-oil",
  "preferences": null,
  "users": [
    {
      "name": "oil",
      "user": {
        "client-certificate-data": "<data>",
        "client-key-data": "<data>"
      }
    }
  ]
}

Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for capsule-documentation canceled.

Name Link
🔨 Latest commit 89801be
🔍 Latest deploy log https://app.netlify.com/sites/capsule-documentation/deploys/65dda207df41a5000819cca5

Comment on lines +26 to +35
// KubeConfig represents the kubeconfig structure
type KubeConfig struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Clusters []Cluster `json:"clusters"`
Contexts []Context `json:"contexts"`
CurrentContext string `json:"current-context"`
Preferences interface{} `json:"preferences"`
Users []User `json:"users"`
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

So instead of defining my own types i could use the types for the k8 sdk

Nice will make some edits

@prometherion
Copy link
Member

@9trocode I'm very welcoming to your PR, and I'd like to know if you could revamp it.

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 this pull request may close these issues.

2 participants