kubernetes

package
v0.0.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

This package is used for general Kubernetes templates such as kubeconfig files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubeConfigFile

func KubeConfigFile(contextName string, namespace string, encodedCertificateAuthorityData string, clusterServerURL string, userName string, encodedTokenData string) string

Function used to generate a kubeconfig file from the Kubeconfig struct. `contextName` is used for the Kubeconfig's `.cluster[x].name`, `context[x].name` and `current-context`. `userName` is used for `user[x].name`,.

Types

type Kubeconfig

type Kubeconfig struct {
	ApiVersion string `yaml:"apiVersion"`
	Kind       string `yaml:"kind"`
	Clusters   []struct {
		Cluster struct {
			CertificateAuthorityData string `yaml:"certificate-authority-data"`
			Server                   string `yaml:"server"`
		} `yaml:"cluster"`
		Name string `yaml:"name"`
	} `yaml:"clusters"`
	Contexts []struct {
		Context struct {
			Cluster   string `yaml:"cluster"`
			User      string `yaml:"user"`
			Namespace string `yaml:"namespace"`
		} `yaml:"context"`
		Name string `yaml:"name"`
	} `yaml:"contexts"`
	CurrentContext string `yaml:"current-context"`
	Users          []struct {
		Name string `yaml:"name"`
		User struct {
			Token string `yaml:"token"`
		} `yaml:"user"`
	} `yaml:"users"`
}

Kubeconfig struct used to hold the kubeconfig file data

func (*Kubeconfig) GetKubeConfig

func (configItem *Kubeconfig) GetKubeConfig(clusterName string, kubeConfigPath string) *Kubeconfig

Use: GetKubeConfig |DESCRIPTION| Used to retrieve values from a kubeconfig file. **Use with the Kubeconfig struct.** |ARGS| clusterName (string), kubeConfigPath (string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL