kube

package
v0.0.0-...-bb99189 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KubeconfigDir is the default kubeconfig directory.
	KubeconfigDir = ".kube"
	// KubeconfigFile is the default kubeconfig file.
	KubeconfigFile = "config"
	// UpboundKubeconfigKeyFmt is the format for Upbound control plane entries
	// in a kubeconfig file.
	UpboundKubeconfigKeyFmt = "upbound-%s"

	// UpboundK8sResource is appended to the end of the kubeconfig server path.
	UpboundK8sResource = "k8s"
)

Variables

This section is empty.

Functions

func ApplyControlPlaneKubeconfig

func ApplyControlPlaneKubeconfig(mcpConf api.Config, existingFilePath string, wrapTransport transport.WrapperFunc) error

ApplyControlPlaneKubeconfig applies a control plane kubeconfig to an existing kubeconfig file and sets it as the current context.

func BuildControlPlaneKubeconfig

func BuildControlPlaneKubeconfig(proxy *url.URL, id string, token string, includePrefix bool) *api.Config

BuildControlPlaneKubeconfig builds a kubeconfig entry for a control plane.

func Client

func Client(config *rest.Config) (*kubernetes.Clientset, error)

func Config

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

func ConfigContext

func ConfigContext(ctx context.Context, config *rest.Config) (*dynamic.DynamicClient, error)

func Context

func Context(ctx context.Context, context string) (*dynamic.DynamicClient, error)

func Create

func Create()

func DeleteKubeResources

func DeleteKubeResources(ctx context.Context, p ResourceParams, resourceName string) error

func DynamicWatch

func DynamicWatch(ctx context.Context, r dynamic.NamespaceableResourceInterface, timeout *int64, done func(u *unstructured.Unstructured) (bool, error)) (chan error, error)

DynamicWatch starts a watch on the given resource type. The done callback is called on every received event until either timeout or context cancellation.

func GetKubeConfig

func GetKubeConfig(path string) (*rest.Config, error)

GetKubeConfig constructs a Kubernetes REST config from the specified kubeconfig, or falls back to same defaults as kubectl.

func GetKubeResources

func GetKubeResources(p ResourceParams) ([]unstructured.Unstructured, error)

Types

type ImagePullApplicator

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

ImagePullApplicator constructs and creates or updates an image pull Secret.

func NewImagePullApplicator

func NewImagePullApplicator(secret *SecretApplicator) *ImagePullApplicator

NewImagePullApplicator constructs a new ImagePullApplicator with the passed SecretApplicator. TODO(hasheddan): consider moving applicators to a common interface.

func (*ImagePullApplicator) Apply

func (i *ImagePullApplicator) Apply(ctx context.Context, name, ns, user, pass, registry string) error

Apply constructs an DockerConfig image pull Secret with the provided registry and credentials.

type ResourceParams

type ResourceParams struct {
	Dynamic    dynamic.Interface
	Ctx        context.Context
	Group      string
	Version    string
	Resource   string
	Namespace  string
	ListOption metav1.ListOptions
}

type SecretApplicator

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

SecretApplicator creates or updates Secrets. In the event that the Secret exists and must be updated, it is completely replaced, not patched.

func NewSecretApplicator

func NewSecretApplicator(client kubernetes.Interface) *SecretApplicator

NewSecretApplicator constructs a SecretApplicator with the passed Kubernetes client.

func (*SecretApplicator) Apply

func (s *SecretApplicator) Apply(ctx context.Context, ns string, secret *corev1.Secret) error

Apply creates or updates a Secret.

Jump to

Keyboard shortcuts

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