keptnkubeutils

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 33 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(useInClusterConfig bool, namespace string, namespaceMetadata ...metav1.ObjectMeta) error

CreateNamespace creates a new Kubernetes namespace with the provided name

func ExecuteCommand

func ExecuteCommand(command string, args []string) (string, error)

ExecuteCommand exectues the command using the args

func ExecuteCommandInDirectory

func ExecuteCommandInDirectory(command string, args []string, directory string) (string, error)

ExecuteCommandInDirectory executes the command using the args within the specified directory

func ExistsNamespace

func ExistsNamespace(useInClusterConfig bool, namespace string) (bool, error)

ExistsNamespace checks whether a namespace with the provided name exists

func ExpandTilde

func ExpandTilde(fileName string) string

ExpandTilde expands ~ to HOME

func GetChart

func GetChart(project string, service string, stage string, chartName string, configServiceURL string) (*chart.Chart, string, error)

GetChart returns the chart and the related git commit ID from the configuration service

func GetClientset

func GetClientset(useInClusterConfig bool) (*kubernetes.Clientset, error)

GetClientset returns the kubernetes Clientset

func GetFiles

func GetFiles(workingPath string, suffixes ...string) ([]string, error)

GetFiles returns a list of files in a directory filtered by the provided suffix

func GetKeptnAPITokenFromSecret added in v0.8.0

func GetKeptnAPITokenFromSecret(useInClusterConfig bool, namespace string, secretName string) (string, error)

GetKeptnAPITokenFromSecret returns the `keptn-api-token` data secret from Keptn Installation

func GetKeptnDirectory

func GetKeptnDirectory() (string, error)

GetKeptnDirectory returns a path, which is used to store logs and possibly creds

func GetKeptnEndpointFromIngress added in v0.8.0

func GetKeptnEndpointFromIngress(useInClusterConfig bool, namespace string, ingressName string) (string, error)

GetKeptnEndpointFromIngress returns the host of ingress object Keptn Installation

func GetKeptnEndpointFromService added in v0.8.0

func GetKeptnEndpointFromService(useInClusterConfig bool, namespace string, serviceName string) (string, error)

GetKeptnEndpointFromService returns the loadbalancer service IP from Keptn Installation

func GetKeptnManagedNamespace added in v0.8.0

func GetKeptnManagedNamespace(useInClusterConfig bool) ([]string, error)

GetKeptnManagedNamespace returns the list of namespace with the annotation & label `keptn.sh/managed-by: keptn`

func GetKubeAPI

func GetKubeAPI(useInClusterConfig bool) (v1.CoreV1Interface, error)

GetKubeAPI returns the CoreV1Interface

func GetRenderedDeployments

func GetRenderedDeployments(ch *chart.Chart) ([]*appsv1.Deployment, error)

GetRenderedDeployments returns all deployments contained in the provided chart

func GetRenderedServices

func GetRenderedServices(ch *chart.Chart) ([]*typesv1.Service, error)

GetRenderedServices returns all services contained in the provided chart

func IsDeployment

func IsDeployment(dpl *appsv1.Deployment) bool

IsDeployment tests whether the provided struct is a deployment

func IsService

func IsService(svc *typesv1.Service) bool

IsService tests whether the provided struct is a service

func LoadChart

func LoadChart(data []byte) (*chart.Chart, error)

LoadChart converts a byte array into a Chart

func LoadChartFromPath

func LoadChartFromPath(path string) (*chart.Chart, error)

LoadChartFromPath loads a directory or Helm chart into a Chart

func NewChartPackager added in v0.8.0

func NewChartPackager() *chartPackager

NewChartPackager creates a new chartPackager instance

func NewChartRetriever added in v0.13.0

func NewChartRetriever(resourceHandler *goutils.ResourceHandler) *chartRetriever

NewChartRetriever creates a new chartRetriever instance

func NewChartStorer added in v0.8.0

func NewChartStorer(resourceHandler *goutils.ResourceHandler) *chartStorer

NewChartStorer creates a new chartStorer instance

func PackageChart

func PackageChart(ch *chart.Chart) ([]byte, error)

PackageChart packages the chart and returns it Deprecated: PackageChart is deprecated, use chartPackager.Package instead

func PatchKeptnManagedNamespace added in v0.8.0

func PatchKeptnManagedNamespace(useInClusterConfig bool, namespace string) error

PatchKeptnManagedNamespace to patch the namespace with the annotation & label `keptn.sh/managed-by: keptn`

func RestartPodsWithSelector

func RestartPodsWithSelector(useInClusterConfig bool, namespace string, selector string) error

RestartPodsWithSelector restarts the pods which are found in the provided namespace and selector

func ScaleDeployment

func ScaleDeployment(useInClusterConfig bool, deployment string, namespace string, replicas int32) error

func StoreChart

func StoreChart(project string, service string, stage string, chartName string, helmChart []byte, configServiceURL string) (string, error)

StoreChart stores a chart in the configuration service Deprecated: StoreChart is deprecated, use chartStorer.Store instead

func UserHomeDir

func UserHomeDir() string

UserHomeDir returns the HOME directory by taking into account the operating system

func WaitForDeploymentToBeRolledOut

func WaitForDeploymentToBeRolledOut(useInClusterConfig bool, deploymentName string, namespace string) error

WaitForDeploymentToBeRolledOut waits until the deployment is Available

func WaitForDeploymentsInNamespace

func WaitForDeploymentsInNamespace(useInClusterConfig bool, namespace string) error

WaitForDeploymentsInNamespace waits until all deployments in a namespace are available

func WaitForPodsWithSelector

func WaitForPodsWithSelector(useInClusterConfig bool, namespace string, selector string,
	retries int, waitingTime time.Duration) error

Types

type RetrieveChartOptions added in v0.13.0

type RetrieveChartOptions struct {
	Project   string
	Service   string
	Stage     string
	ChartName string
	CommitID  string
}

RetrieveChartOptions are the parameters to obtain a chart

type StoreChartOptions added in v0.8.0

type StoreChartOptions struct {
	Project   string
	Service   string
	Stage     string
	ChartName string
	HelmChart []byte
}

StoreChartOptions are the parameters for storing a chart

Jump to

Keyboard shortcuts

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