kubernetes

package
v0.0.0-...-54d0854 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInClusterClientSet

func NewInClusterClientSet(logger *zap.SugaredLogger) (kubernetes.Interface, error)

func ResolveNamespace

func ResolveNamespace(resource *unstructured.Unstructured, namespace string) string

func ToUnstructured

func ToUnstructured(manifest []byte, async bool) ([]*unstructured.Unstructured, error)

ToUnstructured Unmarshalls given manifest in YAML format into k8s.io Unstructured data type.

Types

type Client

type Client interface {
	Kubeconfig() string
	DeleteResource(ctx context.Context, kind, name, namespace string) (*Resource, error)
	Deploy(ctx context.Context, manifestTarget, namespace string, interceptors ...ResourceInterceptor) ([]*Resource, error)
	DeployByCompareWithOriginal(ctx context.Context, manifestOriginal, manifestTarget, namespace string, interceptors ...ResourceInterceptor) ([]*Resource, error)
	Delete(ctx context.Context, manifest, namespace string) ([]*Resource, error)
	PatchUsingStrategy(ctx context.Context, kind, name, namespace string, p []byte, strategy types.PatchType) error
	Clientset() (kubernetes.Interface, error)

	Get(kind, name, namespace string) (*unstructured.Unstructured, error)
	GetDeployment(ctx context.Context, name, namespace string) (*v1apps.Deployment, error)
	GetStatefulSet(ctx context.Context, name, namespace string) (*v1apps.StatefulSet, error)
	GetSecret(ctx context.Context, name, namespace string) (*v1.Secret, error)
	GetService(ctx context.Context, name, namespace string) (*v1.Service, error)
	GetPod(ctx context.Context, name, namespace string) (*v1.Pod, error)
	GetJob(ctx context.Context, name, namespace string) (*batchv1.Job, error)
	GetPersistentVolumeClaim(ctx context.Context, name, namespace string) (*v1.PersistentVolumeClaim, error)
	ListResource(ctx context.Context, resource string, lo metav1.ListOptions) (*unstructured.UnstructuredList, error)
	ListGroupVersionResource(ctx context.Context, group string, version string, resource string, lo metav1.ListOptions) (*unstructured.UnstructuredList, error)

	GetHost() string
}

func NewKubernetesClient

func NewKubernetesClient(kubeconfig string, logger *zap.SugaredLogger, config *Config) (Client, error)

type Config

type Config struct {
	ProgressInterval time.Duration
	ProgressTimeout  time.Duration
	MaxRetries       int
	RetryDelay       time.Duration
}

type DefaultUpdateStrategyResolver

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

func (*DefaultUpdateStrategyResolver) Resolve

func (d *DefaultUpdateStrategyResolver) Resolve(resourceInfo *resource.Info) (UpdateStrategy, error)

type Resource

type Resource struct {
	Kind      string
	Name      string
	Namespace string
}

func (*Resource) String

func (r *Resource) String() string

type ResourceCacheList

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

func NewResourceList

func NewResourceList(unstructs []*unstructured.Unstructured) *ResourceCacheList

func (*ResourceCacheList) Add

func (*ResourceCacheList) Get

func (r *ResourceCacheList) Get(kind, name, namespace string) *unstructured.Unstructured

func (*ResourceCacheList) GetByKind

func (r *ResourceCacheList) GetByKind(kind string) []*unstructured.Unstructured

func (*ResourceCacheList) Len

func (r *ResourceCacheList) Len() int

func (*ResourceCacheList) Remove

func (*ResourceCacheList) Replace

func (*ResourceCacheList) Visit

func (r *ResourceCacheList) Visit(callback func(u *unstructured.Unstructured) error) error

func (*ResourceCacheList) VisitByKind

func (r *ResourceCacheList) VisitByKind(kind string, callback func(u *unstructured.Unstructured) error) error

func (*ResourceCacheList) VisitByKindAndAPIVersion

func (r *ResourceCacheList) VisitByKindAndAPIVersion(kind string, apiversion string, callback func(u *unstructured.Unstructured) error) error

type ResourceInterceptor

type ResourceInterceptor interface {
	Intercept(resources *ResourceCacheList, namespace string) error
}

type SimpleRESTClientGetter

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

func NewRESTClientGetter

func NewRESTClientGetter(config *rest.Config) *SimpleRESTClientGetter

func (*SimpleRESTClientGetter) ToDiscoveryClient

func (*SimpleRESTClientGetter) ToRESTConfig

func (c *SimpleRESTClientGetter) ToRESTConfig() (*rest.Config, error)

func (*SimpleRESTClientGetter) ToRESTMapper

func (c *SimpleRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*SimpleRESTClientGetter) ToRawKubeConfigLoader

func (c *SimpleRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type UpdateStrategy

type UpdateStrategy string
const (
	PatchUpdateStrategy   UpdateStrategy = "PATCH"
	ReplaceUpdateStrategy UpdateStrategy = "REPLACE"
	SkipUpdateStrategy    UpdateStrategy = "SKIP"
)

type UpdateStrategyResolver

type UpdateStrategyResolver interface {
	Resolve(resource *resource.Info) (UpdateStrategy, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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