k8s

package module
v0.0.0-...-608f347 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudAgent

type CloudAgent struct {
	Kubernetes KubernetesCloud `json:"kubernetes"`
}

CloudAgent represents a Jenkins cloud agent

type Container

type Container struct {
	Name                  string `json:"name"`
	Image                 string `json:"image"`
	Command               string `json:"command"`
	Args                  string `json:"args"`
	TtyEnabled            bool   `json:"ttyEnabled"`
	Privileged            bool   `json:"privileged"`
	ResourceRequestCPU    string `json:"resourceRequestCpu,omitempty"`
	ResourceLimitCPU      string `json:"resourceLimitCpu,omitempty"`
	ResourceRequestMemory string `json:"resourceRequestMemory,omitempty"`
	ResourceLimitMemory   string `json:"resourceLimitMemory,omitempty"`
}

Container represents the container that defined in Jenkins

type EmptyDirWorkspaceVolume

type EmptyDirWorkspaceVolume struct {
	Memory bool `json:"memory"`
}

EmptyDirWorkspaceVolume is an empty dir type of workspace volume

type HostPathVolume

type HostPathVolume struct {
	HostPath  string `json:"hostPath"`
	MountPath string `json:"mountPath"`
}

HostPathVolume represents a host path volume

type JenkinsConfig

type JenkinsConfig struct {
	Config []byte
}

JenkinsConfig represents a Jenkins configuration-as-code object

func (*JenkinsConfig) AddPodTemplate

func (c *JenkinsConfig) AddPodTemplate(podTemplate *v1.PodTemplate) (err error)

AddPodTemplate adds a PodTemplate to the Jenkins cloud config

func (*JenkinsConfig) GetConfigAsString

func (c *JenkinsConfig) GetConfigAsString() string

GetConfigAsString returns the config data as string

func (*JenkinsConfig) RemovePodTemplate

func (c *JenkinsConfig) RemovePodTemplate(name string) (err error)

RemovePodTemplate removes a PodTemplate from the Jenkins cloud config

func (*JenkinsConfig) ReplaceOrAddPodTemplate

func (c *JenkinsConfig) ReplaceOrAddPodTemplate(podTemplate *v1.PodTemplate) (err error)

ReplaceOrAddPodTemplate replace the existing PodTemplate, or add it if it's not exist

type JenkinsPodTemplate

type JenkinsPodTemplate struct {
	Name          string      `json:"name"`
	Namespace     string      `json:"namespace"`
	Label         string      `json:"label"`
	NodeUsageMode string      `json:"nodeUsageMode"`
	IdleMinutes   int         `json:"idleMinutes"`
	Containers    []Container `json:"containers"`
	InheritFrom   string      `json:"inheritFrom,omitempty"`
	Volumes       []Volume    `json:"volumes"`
	// YAML is the YAML format for merging into the whole PodTemplate
	YAML            string          `json:"yaml"`
	WorkspaceVolume WorkspaceVolume `json:"workspaceVolume"`
}

JenkinsPodTemplate represents the PodTemplate that defined in Jenkins

func ConvertToJenkinsPodTemplate

func ConvertToJenkinsPodTemplate(podTemplate *v1.PodTemplate) (target JenkinsPodTemplate, err error)

ConvertToJenkinsPodTemplate converts a k8s style PodTemplate to a Jenkins style PodTemplate

type KubernetesCloud

type KubernetesCloud struct {
	Name                   string               `json:"name"`
	ServerURL              string               `json:"serverUrl"`
	SkipTLSVerify          bool                 `json:"skipTlsVerify"`
	Namespace              string               `json:"namespace"`
	CredentialsID          string               `json:"credentialsId"`
	JenkinsURL             string               `json:"jenkinsUrl"`
	JenkinsTunnel          string               `json:"jenkinsTunnel"`
	ContainerCapStr        string               `json:"containerCapStr"`
	ConnectTimeout         string               `json:"connectTimeout"`
	ReadTimeout            string               `json:"readTimeout"`
	MaxRequestsPerhHostStr string               `json:"maxRequestsPerhHostStr"`
	Templates              []JenkinsPodTemplate `json:"templates"`
}

KubernetesCloud represents a Kubernetes connection in Jenkins

type Volume

type Volume struct {
	HostPathVolume HostPathVolume `json:"hostPathVolume"`
}

Volume represents the volume in kubernetes

type WorkspaceVolume

type WorkspaceVolume struct {
	EmptyDirWorkspaceVolume EmptyDirWorkspaceVolume `json:"emptyDirWorkspaceVolume"`
}

WorkspaceVolume is the volume of the Jenkins agent workspace

Jump to

Keyboard shortcuts

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