utils

package
v0.0.0-...-3e220e4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(list []string, s string) bool

Contains represents func for checking if a string is in a list of strings

func CopyUntypedMap

func CopyUntypedMap(source map[string]interface{}) map[string]interface{}

CopyUntypedMap return a copy of a map with strings as keys and empty interface as value

func GetEnvSettings

func GetEnvSettings(env map[string]string) *cli.EnvSettings

GetEnvSettings represents func for returning helm cli settings which are needed for helm actions

func GetLabelsByInstance

func GetLabelsByInstance(metaObj metav1.ObjectMeta, env map[string]string) (string, string)

GetLabelsByInstance represents func for parsing labels by k8s objectMeta and env map

func InitActionConfig

func InitActionConfig(getter genericclioptions.RESTClientGetter, kubeconfig []byte, logger logr.Logger) (*action.Configuration, error)

InitActionConfig represents the initialization of an helm configuration

func LoadChartIndex

func LoadChartIndex(chart, repository, namespace string, c client.Client) (*repo.ChartVersions, error)

func ManagerOptions

func ManagerOptions(config string) (*manager.Options, error)

func MergeMaps

func MergeMaps(source, dest map[string]interface{}) map[string]interface{}

MergeMaps returns distinct map of two as input have to be called as a goroutine to avoid memory leaks

func MergeUntypedMaps

func MergeUntypedMaps(dest, source map[string]interface{}, keys ...string) map[string]interface{}

MergeUntypedMaps returns distinct map of two as input

func RandomString

func RandomString(n int) string

RandomString return a string with random chars of length n

Types

type ClientInterface

type ClientInterface interface {
	GetResource(name, namespace, resource, group, version string, opts metav1.GetOptions) ([]byte, error)
	ListResources(namespace, resource, group, version string, opts metav1.ListOptions) ([]byte, error)
}

ClientInterface repesents interface for mocking custom k8s client

type Config

type Config struct {
	HealthProbeBindAddress string         `yaml:"healthProbeBindAddress"`
	MetricsBindAddress     string         `yaml:"metricsBindAddress"`
	LeaderElection         LeaderElection `yaml:"leaderElection"`
	WebhookPort            int            `yaml:"webhookPort"`
}

type HTTPClientInterface

type HTTPClientInterface interface {
	Get(url string) (*http.Response, error)
	Do(req *http.Request) (*http.Response, error)
}

HTTPClientInterface represents interface for mocking an http client

type HelmRESTClientGetter

type HelmRESTClientGetter struct {
	Namespace        string
	ReleaseNamespace string
	KubeConfig       string
	IsLocal          bool
	HelmConfig       *helmv1alpha1.Config
	Client           client.Client
	// contains filtered or unexported fields
}

func NewRESTClientGetter

func NewRESTClientGetter(config *helmv1alpha1.Config, namespace, releaseNamespace string, isLocal bool, c client.Client, logger logr.Logger) (*HelmRESTClientGetter, error)

func (*HelmRESTClientGetter) ToDiscoveryClient

func (*HelmRESTClientGetter) ToRESTConfig

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

func (*HelmRESTClientGetter) ToRESTMapper

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

func (*HelmRESTClientGetter) ToRawKubeConfigLoader

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

type LeaderElection

type LeaderElection struct {
	Enabled    bool   `yaml:"enabled"`
	ResourceID string `yaml:"resourceName"`
}

Jump to

Keyboard shortcuts

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