utils

package
v0.0.0-...-517c2d1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = "config.yml"

Variables

This section is empty.

Functions

func ConvertAndSaveYamlToJSON

func ConvertAndSaveYamlToJSON(targetName string) (string, error)

ConvertAndSaveYamlToJSON takes a YAML file path and a target file name, converts it to JSON, and does not convert if the JSON file already exists.

func CreateRequest

func CreateRequest(createCrdPath string, filePath string) (string, error)

func GetClient

func GetClient() (*kubernetes.Clientset, error)

GetClient creates and returns a Kubernetes client based on the specified KubeConfigPath file path.

func GetDynamicClient

func GetDynamicClient() (*dynamic.DynamicClient, error)

GetDynamicClient creates and returns a Kubernetes dynamic client based on the specified KubeConfigPath file path.

func GetKubeConfigPath

func GetKubeConfigPath() (string, error)

GetKubeConfigPath retrieves the kubeConfigPath based on the contents of the config file.

func LoadKubeConfig

func LoadKubeConfig(kubeconfigFullPath string) (*api.Config, error)

LoadKubeConfig loads the kubeconfig from the provided path and filename

Types

type ContextInfo

type ContextInfo struct {
	ClientCert  string
	ClientKey   string
	CACert      string
	APIServer   string
	ContentType ContextType
}

ContextInfo is a structure to hold client certificate, key, CA certificate, API server URL, and content type.

func GetContextInfo

func GetContextInfo(config *api.Config) (*ContextInfo, error)

GetContextInfo extracts the client certificate, key, CA certificate, API server URL, and content type from the provided *api.Config for the current context.

type ContextType

type ContextType string
const (
	Json ContextType = "application/json"
)

Jump to

Keyboard shortcuts

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