cluster

package
v1.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials interface {
	ToRestConfig() (*rest.Config, error)
}

Credentials interface manages all cluster related tasks

type K8sClusterCreds

type K8sClusterCreds struct {
	K8sConfig *K8sConfig
}

K8sClusterCreds implements CredsManager interface

func NewK8sClusterCreds

func NewK8sClusterCreds(k *K8sConfig) *K8sClusterCreds

NewK8sClusterCreds returns a K8sCredsManager

func (*K8sClusterCreds) ToRestConfig

func (k *K8sClusterCreds) ToRestConfig() (*rest.Config, error)

ToRestConfig generates a k8s rest.Config that is used to instantiate k8s clients ie any client that is generated by client-go generators

type K8sConfig

type K8sConfig struct {
	Cluster  *clientcmdapiv1.Cluster  `json:"cluster" yaml:"cluster"`
	AuthInfo *clientcmdapiv1.AuthInfo `json:"user" yaml:"user" mapstructure:"user"`
	Name     string                   `json:"name" yaml:"name"`
}

K8sConfig contains fields on how to connect to a k8s cluster

func (*K8sConfig) Decode

func (k *K8sConfig) Decode(value string) error

Decode provides envconfig steps to parse env var to K8sConfig struct

func (*K8sConfig) UnmarshalYAML

func (k *K8sConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements Unmarshal interface Since K8sConfig fields only have json tags, sigyaml.Unmarshal needs to be used to unmarshal all the fields. This method reads K8sConfig into a map[string]interface{}, marshals it into a byte for, before passing to sigyaml.Unmarshal

Jump to

Keyboard shortcuts

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