resource

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package resource provides utilities for managing and manipulating Kubernetes resources. It includes functionalities for handling resource operations such as installation, uninstallation, and validation.

The package uses the "github.com/nextbillion-ai/goreman-util/global" library for global configurations and specifications, "github.com/zhchang/goquiver/k8s" for Kubernetes operations, and "github.com/zhchang/goquiver/raw" for raw data operations.

The main type in this package is Resource, which represents a Kubernetes resource. It provides methods for installing, uninstalling, and validating the resource.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Uninstall added in v1.0.6

func Uninstall(rc global.ResourceContext, name string, options ...ResourceOption) error

Uninstall removes the resource from the cluster. It takes a global.ResourceContext and optional ResourceOption(s) as parameters. The ResourceOptions can be used to customize the uninstallation process. If the wait duration is specified in the ResourceOptions, it will wait for the resource to be removed before returning. It returns an error if the uninstallation fails.

Types

type Resource

type Resource struct {
	Name  string
	Spec  *global.Spec
	Asset *asset.Asset
	Url   string
}

func New

func New(rc global.ResourceContext, name string, spec *global.Spec) (*Resource, error)

New creates a new Resource instance with the given resource context, name, and spec. It returns a pointer to the created Resource and an error, if any.

func (*Resource) Rollout

func (r *Resource) Rollout(rc global.ResourceContext, options ...ResourceOption) error

Rollout performs a resource rollout operation. It acquires a lock, merges global and app-specific options, validates the asset, and then triggers the rollout operation using the provided resource context and options. The function returns an error if any of the operations fail.

type ResourceOption

type ResourceOption func(*resourceOptions)

func WithValues

func WithValues(values map[string]any) ResourceOption

WithValues sets the values for a resource option. It takes a map of string to any as input and returns a ResourceOption function. The returned function sets the values of the resource options.

func WithWait

func WithWait(wait time.Duration) ResourceOption

WithWait sets the wait duration for a resource option.

Jump to

Keyboard shortcuts

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