kube

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAllResources added in v0.9.0

func CreateAllResources(ctx context.Context, cluster *Cluster, resources []CreateResource) (map[string]interface{}, []string, error)

CreateAllResources() creates all resources and returns their status

func CreateFromFile added in v0.4.0

func CreateFromFile(ctx context.Context, client klient.Client, resourceFile string) ([]map[string]interface{}, error)

CreateResourceFromFile() creates the resource from a file

func CreateFromManifest added in v0.4.0

func CreateFromManifest(ctx context.Context, client klient.Client, resourceBytes []byte) ([]map[string]interface{}, error)

CreateResourceFromManifest() creates the resource from the manifest string

func CreateKubernetesDomain added in v0.6.0

func CreateKubernetesDomain(spec *KubernetesSpec) (types.Domain, error)

func DestroyAllResources added in v0.4.0

func DestroyAllResources(ctx context.Context, client klient.Client, collections map[string]interface{}, namespaces []string) error

DestroyAllResources() removes all the created resources

func EvaluateWait

func EvaluateWait(ctx context.Context, cluster *Cluster, waitPayload Wait) error

func GetResourcesDynamically

func GetResourcesDynamically(ctx context.Context, cluster *Cluster, resource *ResourceRule) ([]map[string]interface{}, error)

GetResourcesDynamically() requires a dynamic interface and processes GVR to return []map[string]interface{} This function is used to query the cluster for specific subset of resources required for processing

func QueryCluster

func QueryCluster(ctx context.Context, cluster *Cluster, resources []Resource) (map[string]interface{}, error)

QueryCluster() requires context and a Payload as input and returns []unstructured.Unstructured This function is used to query the cluster for all resources required for processing

Types

type Cluster added in v0.9.0

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

func GetCluster added in v0.9.0

func GetCluster() (*Cluster, error)

func New added in v0.9.0

func New() (*Cluster, error)

type CreateResource added in v0.4.0

type CreateResource struct {
	Name      string `json:"name" yaml:"name"`
	Namespace string `json:"namespace" yaml:"namespace"`
	Manifest  string `json:"manifest" yaml:"manifest"`
	File      string `json:"file" yaml:"file"`
}

type Field

type Field struct {
	Jsonpath string    `json:"jsonpath" yaml:"jsonpath"`
	Type     FieldType `json:"type" yaml:"type"`
	Base64   bool      `json:"base64" yaml:"base64"`
}

func (Field) Validate

func (f Field) Validate() error

Validate the Field type if valid

type FieldType

type FieldType string
const (
	FieldTypeJSON    FieldType = "json"
	FieldTypeYAML    FieldType = "yaml"
	DefaultFieldType FieldType = FieldTypeJSON
)

type KubernetesDomain

type KubernetesDomain struct {
	// Spec is the specification of the Kubernetes resources
	Spec *KubernetesSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
}

func (KubernetesDomain) GetResources

func (k KubernetesDomain) GetResources(ctx context.Context) (types.DomainResources, error)

GetResources returns the resources from the Kubernetes domain Evaluates the `create-resources` first, `wait` second, and finally `resources` last

func (KubernetesDomain) IsExecutable added in v0.4.0

func (k KubernetesDomain) IsExecutable() bool

type KubernetesSpec

type KubernetesSpec struct {
	Resources       []Resource       `json:"resources" yaml:"resources"`
	Wait            *Wait            `json:"wait,omitempty" yaml:"wait,omitempty"`
	CreateResources []CreateResource `json:"create-resources" yaml:"create-resources"`
}

type Resource

type Resource struct {
	Name         string        `json:"name" yaml:"name"`
	Description  string        `json:"description" yaml:"description"`
	ResourceRule *ResourceRule `json:"resource-rule,omitempty" yaml:"resource-rule,omitempty"`
}

type ResourceRule

type ResourceRule struct {
	Name       string   `json:"name" yaml:"name"`
	Group      string   `json:"group" yaml:"group"`
	Version    string   `json:"version" yaml:"version"`
	Resource   string   `json:"resource" yaml:"resource"`
	Namespaces []string `json:"namespaces" yaml:"namespaces"`
	Field      *Field   `json:"field,omitempty" yaml:"field,omitempty"`
}

type Wait

type Wait struct {
	Name      string `json:"name" yaml:"name"`
	Group     string `json:"group" yaml:"group"`
	Version   string `json:"version" yaml:"version"`
	Resource  string `json:"resource" yaml:"resource"`
	Namespace string `json:"namespace" yaml:"namespace"`
	Timeout   string `json:"timeout" yaml:"timeout"`
}

Jump to

Keyboard shortcuts

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