kubeconfig

package
v0.41.11 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package kubeconfig provides access to the cluster for kapp-controller

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessInfo

type AccessInfo struct {
	Name      string
	Namespace string

	Kubeconfig                    *Restricted
	DangerousUsePodServiceAccount bool
}

AccessInfo provides a kubernetes kubeconfig for use to access the cluster

type AccessLocation

type AccessLocation struct {
	Name      string
	Namespace string
}

AccessLocation contains the name/namespace of the resource which provides cluster access for example, a service account has a name and namespace

type Kubeconfig

type Kubeconfig struct {
	// contains filtered or unexported fields
}

Kubeconfig provides access to the kubernetes cluster It initializes the service-account token cache

func NewKubeconfig

func NewKubeconfig(coreClient kubernetes.Interface, log logr.Logger) *Kubeconfig

NewKubeconfig creates a Kubeconfig with a new serviceaccount cache and kubeconfigsecrets

func (Kubeconfig) ClusterAccess

func (k Kubeconfig) ClusterAccess(saName string, clusterOpts *v1alpha1.AppCluster, accessLocation AccessLocation) (AccessInfo, error)

ClusterAccess takes cluster info and a ServiceAccount Name, and returns a populated kubeconfig that can connect to a cluster. if the saName is empty then you'll connect to a cluster via the clusterOpts inside the genericOpts, otherwise you'll use the specified SA.

type Restricted

type Restricted struct {
	// contains filtered or unexported fields
}

Restricted contains a kubernetes kubeconfig as a string

func NewKubeconfigRestricted

func NewKubeconfigRestricted(input string) (*Restricted, error)

NewKubeconfigRestricted takes kubeconfig yaml as input and returns kubeconfig yaml with certain fields restricted (removed). Developers may find it informative to view their own config at ~/.kube/config

func (*Restricted) AsYAML

func (r *Restricted) AsYAML() string

AsYAML returns a string formatted kubernetes kubeconfig

type Secrets

type Secrets struct {
	// contains filtered or unexported fields
}

Secrets gets cluster access based on a secret

func NewKubeconfigSecrets

func NewKubeconfigSecrets(coreClient kubernetes.Interface) *Secrets

NewKubeconfigSecrets returns a Secrets

func (*Secrets) Find

func (s *Secrets) Find(accessLocation AccessLocation,
	clusterOpts *v1alpha1.AppCluster) (AccessInfo, error)

Find takes the location of the credentials secret and returns information to access the cluster

type ServiceAccounts

type ServiceAccounts struct {
	// contains filtered or unexported fields
}

ServiceAccounts gets cluster access based on a serviceaccount It provides a tokenManager to cache service account tokens

func NewServiceAccounts

func NewServiceAccounts(coreClient kubernetes.Interface, log logr.Logger) *ServiceAccounts

NewServiceAccounts provides access to the ServiceAccount Resource in kubernetes

func (*ServiceAccounts) Find

func (s *ServiceAccounts) Find(accessLocation AccessLocation, saName string) (AccessInfo, error)

Find takes the location of the credentials service account and returns information to access the cluster

Jump to

Keyboard shortcuts

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