reaktor

package
v0.0.0-...-2dfab7d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmbassadorMappingGVR

func AmbassadorMappingGVR() schema.GroupVersionResource

func CronJobGVR

func CronJobGVR() schema.GroupVersionResource

func DeploymentGVR

func DeploymentGVR() schema.GroupVersionResource

func GroupVersionResource

func GroupVersionResource(mapper meta.RESTMapper, manifest *unstructured.Unstructured) (schema.GroupVersionResource, error)

func KubeStructToManifest

func KubeStructToManifest(kubeStruct any) (*unstructured.Unstructured, error)

Takes a typed structure from the kubernetes api (i.e. batchv1.Job, etc)

func PodGVR

func SecretGVR

func SecretGVR() schema.GroupVersionResource

func ServiceAccountGVR

func ServiceAccountGVR() schema.GroupVersionResource

func ServiceGVR

func ServiceGVR() schema.GroupVersionResource

func ToJSONManifest

func ToJSONManifest(r Resource) ([]byte, error)

ToJSONManifest is a convenience method that returns the JSON representation of the Resource's manifest.

func ToManifest

func ToManifest(r Resource) (*unstructured.Unstructured, error)

Types

type Config

type Config struct {
	// Provide either a path to a kubeconfig or the yaml contents. Both can be
	// left empty and we'll search for the kubeconfig in the default places
	// (including ~/.kube and in-cluster)
	KubeConfigPath string
	KubeConfigYAML string
}

type Option

type Option func(*Config)

func WithFile

func WithFile(kubeConfigPath string) Option

func WithYAML

func WithYAML(yaml string) Option

type Reaktor

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

See constructors.go for how to create

func New

func New(opts ...Option) (*Reaktor, error)

func NewWithConfig

func NewWithConfig(cfg *Config) (*Reaktor, error)

func WithClientBuilder

func WithClientBuilder(builder kubeconfig.ClientBuilder) (*Reaktor, error)

func (*Reaktor) Apply

func (*Reaktor) ApplyYaml

func (k *Reaktor) ApplyYaml(ctx context.Context, yaml []byte) (*unstructured.Unstructured, error)

func (*Reaktor) Delete

func (k *Reaktor) Delete(ctx context.Context, r Resource) error

func (*Reaktor) DeleteCollection

func (k *Reaktor) DeleteCollection(
	ctx context.Context,
	gvr schema.GroupVersionResource,
	ns string,
	labelSelector string,
) error

func (*Reaktor) Get

func (*Reaktor) GetByResource

func (k *Reaktor) GetByResource(ctx context.Context, r Resource) (*unstructured.Unstructured, error)

func (*Reaktor) List

func (*Reaktor) ToKubeResource

func (k *Reaktor) ToKubeResource(
	ctx context.Context,
	manifest *unstructured.Unstructured,
) (dynamic.ResourceInterface, error)

func (*Reaktor) WatchUntil

func (k *Reaktor) WatchUntil(
	ctx context.Context,
	unstructuredObj *unstructured.Unstructured,

	untilFunc func(e watch.Event) (bool, error),
) (*watch.Event, error)

type Resource

type Resource interface {
	// TODO:
	//    1. I'd love to return a more specific type. Using any for now so we can
	//       play with typed and untyped APIs, but ideally we choose one.
	ToManifest() (any, error)
}

RFC: I was originally going to call this 'Component' (like in React), but ended with 'Resource' to more closely match the K8s terminology. Is that the right name?

Directories

Path Synopsis
package clustertest uses `kind` (https://kind.sigs.k8s.io/) to create an in-docker testing cluster.
package clustertest uses `kind` (https://kind.sigs.k8s.io/) to create an in-docker testing cluster.
examples
kubejobs adds APIs specific to k8s jobs
kubejobs adds APIs specific to k8s jobs

Jump to

Keyboard shortcuts

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