kubeutils

package
v0.0.0-...-9c93095 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalContext = "kubernetes-admin@kubernetes"
)

Variables

This section is empty.

Functions

func BuildCloudKubernetesConfig

func BuildCloudKubernetesConfig(ts oauth2.TokenSource, remoteServer string) *rest.Config

BuildCloudKubernetesConfig build a kubernetes config for authenticated access to the cloud project.

func CloudKubernetesContextName

func CloudKubernetesContextName(projectID, region string) string

CloudKubernetesContextName generates the name of the cloud kubernetes context from the GCP project ID and region.

func ExpandUser

func ExpandUser(path string) string

Expand paths of the form "~/path" to absolute paths.

func GetCloudKubernetesContext

func GetCloudKubernetesContext() (string, error)

GetCloudKubernetesContext returns the name of the cloud kubernetes context.

func GetRobotKubernetesContext

func GetRobotKubernetesContext() (string, error)

GetRobotKubernetesContext returns the name of the robot kubernetes context provided by the kubernetes-relay-client.

func LoadOutOfClusterConfig

func LoadOutOfClusterConfig(context string) (*rest.Config, error)

func LoadOutOfClusterConfigLocal

func LoadOutOfClusterConfigLocal() (*rest.Config, error)

LoadOutOfClusterConfig loads a local kubernetes config on the robot or workstation.

func UpdateSecret

func UpdateSecret(ctx context.Context, k8s *kubernetes.Clientset, input *corev1.Secret) error

UpdateSecret (over-) writes a k8s secret.

Types

type PrefixingRoundtripper

type PrefixingRoundtripper struct {
	Prefix string
	Base   http.RoundTripper
}

PrefixingRoundtripper is a HTTP roundtripper that adds a specified prefix to all HTTP requests. We need to use it instead of setting APIPath because autogenerated and dynamic Kubernetes clients overwrite the REST config's APIPath.

func (*PrefixingRoundtripper) RoundTrip

func (pr *PrefixingRoundtripper) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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