kubernetes

package
v0.0.0-...-530d8eb Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobsLabelConfigmap = "jobs"
	DeleteSecret       = "delete_secret"
)

Variables

This section is empty.

Functions

func DefaultNamespaceValidator

func DefaultNamespaceValidator(namespace string) bool

DefaultNamespaceValidator is a function that change the namespace adding a prefix

func NsNameGen

func NsNameGen(jobs jenkins.JobsParameters) string

NsNameGen is the function that return the unique namespace

Types

type Client

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

KubernetesClient is a struct that inherits all the capabilities of a needed kubernetes datas

func NewKubernetesClient

func NewKubernetesClient(v *viper.Viper, checkNamespaces ...func(string) bool) *Client

NewKubernetesClient initialize the Client struct

func (*Client) CloneIngresses

func (k *Client) CloneIngresses(dstNamespace string, projects []string) (*CloneIngressResponse, error)

CloneIngresses will clone ingresses from a source namespace

func (*Client) CreateConfigMap

func (k *Client) CreateConfigMap(data *CloneIngressResponse, projectJobMap map[string]string, deleteSecret string) error

CreateConfigMap is a function that allow to create a configMap in a namespace with a specific content

func (*Client) CreateCronjob

func (k *Client) CreateCronjob(namespace string, stable bool, deleteSecret string) error

CreateCronjob will create the seppuku cronjob for self-killing task

func (*Client) CreateNamespace

func (k *Client) CreateNamespace(namespace string, stable bool) error

CreateNamespace will create a kubernetes namespace adding stable labels

func (*Client) DeleteNamespace

func (k *Client) DeleteNamespace(namespace string) error

DeleteNamespace if a function useful to delete namespace

func (*Client) GetConfigMap

func (k *Client) GetConfigMap(namespace, cmName string) (*CloneIngressResponse, map[string]string, error)

GetConfigMap is a function that allow to fetch the data in a configmap, with error

func (*Client) NamespaceAlreadyCreated

func (k *Client) NamespaceAlreadyCreated(namespace string) bool

NamespaceAlreadyCreated check if the namespace is already created or not

func (*Client) NamespaceManagedList

func (k *Client) NamespaceManagedList() (nslist []MyNameSpace, err error)

NamespaceManagedList will list all kubernetes namespace handled by one

func (*Client) NsConstraintReqs

func (k *Client) NsConstraintReqs() error

NsConstraintReqs check the ns constraints

func (*Client) UnderMaxNsLimit

func (k *Client) UnderMaxNsLimit() (bool, error)

UnderMaxNsLimit check the ns number limits

func (*Client) UnderMaxStableNsLimit

func (k *Client) UnderMaxStableNsLimit() (bool, error)

UnderMaxStableNsLimit check the number of stable ns

type CloneIngressResponse

type CloneIngressResponse struct {
	ProjectsWithDetails utils.StatusPerProject `json:"projects_with_details" yaml:"projects_with_details"`
	NamespaceCreated    string                 `json:"namespace_created" yaml:"namespace_created"`
}

CloneIngressResponse give the response from cloneIngress

func EnrichCloneIngressResp

func EnrichCloneIngressResp(jobStatus jenkins.JobsStatuses, cloneIngressResp *CloneIngressResponse, jobParams *jenkins.JobsParameters) *CloneIngressResponse

jobStatuses :: {jobName: status} jobParams :: { stable? : ... , CommitPerProject : { projectName: { ...Commit ... }}} cloneIngressResp :: {projects_with_details : { projectName: { jobName : ... , CSVRefs : ... } } }

type MyNameSpace

type MyNameSpace struct {
	Name   string `json:"name" yaml:"name"`
	Stable bool   `json:"stable" yaml:"stable"`
	Status string `json:"status" yaml:"status"`
}

MyNameSpace describe the namespace informations needed

Jump to

Keyboard shortcuts

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