resources

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0, CC-BY-4.0 Imports: 22 Imported by: 0

Documentation

Overview

Package resources contains Kubernetes resources required by Jenkins

Index

Constants

View Source
const (
	// OperatorUserName defines username for Jenkins API calls
	OperatorUserName = "jenkins-operator"
	// OperatorCredentialsSecretUserNameKey defines key of username in operator credentials secret
	OperatorCredentialsSecretUserNameKey = "user"
	// OperatorCredentialsSecretPasswordKey defines key of password in operator credentials secret
	OperatorCredentialsSecretPasswordKey = "password"
	// OperatorCredentialsSecretTokenKey defines key of token in operator credentials secret
	OperatorCredentialsSecretTokenKey = "token"
	// OperatorCredentialsSecretTokenCreationKey defines key of token creation time in operator credentials secret
	OperatorCredentialsSecretTokenCreationKey = "tokenCreationTime"
)
View Source
const (
	// JenkinsMasterContainerName is the Jenkins master container name in pod
	JenkinsMasterContainerName = "jenkins-master"
	// JenkinsHomeVolumeName is the Jenkins home volume name
	JenkinsHomeVolumeName = "jenkins-home"

	// JenkinsScriptsVolumePath is a path where are scripts used to configure Jenkins
	JenkinsScriptsVolumePath = jenkinsPath + "/scripts"
	// InitScriptName is the init script name which configures init.groovy.d, scripts and install plugins
	InitScriptName = "init.sh"

	// GroovyScriptsSecretVolumePath is a path where are groovy scripts used to configure Jenkins
	// This script is provided by user
	GroovyScriptsSecretVolumePath = jenkinsPath + "/groovy-scripts-secrets"
	// ConfigurationAsCodeSecretVolumePath is a path where are CasC configs used to configure Jenkins
	// This script is provided by user
	ConfigurationAsCodeSecretVolumePath = jenkinsPath + "/configuration-as-code-secrets"
)
View Source
const (

	//EmptyAPIGroup short hand for the empty API group while defining policies
	EmptyAPIGroup = ""
	//OpenshiftAPIGroup the openshift api group name
	OpenshiftAPIGroup = "image.openshift.io"
	//BuildAPIGroup  the openshift api group name for builds
	BuildAPIGroup = "build.openshift.io"
)
View Source
const ServiceKind = "Service"

ServiceKind the kind name for Service

Variables

This section is empty.

Functions

func BuildLabelsForWatchedResources

func BuildLabelsForWatchedResources(jenkins v1alpha2.Jenkins) map[string]string

BuildLabelsForWatchedResources returns labels for Kubernetes resources which operator want to watch resources with that labels should not be deleted after Jenkins CR deletion, to prevent this situation don't set any owner

func BuildResourceLabels

func BuildResourceLabels(jenkins *v1alpha2.Jenkins) map[string]string

BuildResourceLabels returns labels for all Kubernetes resources created by operator

func ConvertJenkinsContainerToKubernetesContainer

func ConvertJenkinsContainerToKubernetesContainer(container v1alpha2.Container) corev1.Container

ConvertJenkinsContainerToKubernetesContainer converts Jenkins container to Kubernetes container

func GetBaseConfigurationConfigMapName

func GetBaseConfigurationConfigMapName(jenkins *v1alpha2.Jenkins) string

GetBaseConfigurationConfigMapName returns name of Kubernetes config map used to base configuration.

func GetInitConfigurationConfigMapName

func GetInitConfigurationConfigMapName(jenkins *v1alpha2.Jenkins) string

GetInitConfigurationConfigMapName returns name of Kubernetes config map used to init configuration

func GetJenkinsDeploymentName

func GetJenkinsDeploymentName(jenkins *v1alpha2.Jenkins) string

GetJenkinsMasterPodName returns Jenkins pod name for given CR

func GetJenkinsHTTPServiceFQDN

func GetJenkinsHTTPServiceFQDN(jenkins *v1alpha2.Jenkins, kubernetesClusterDomain string) (string, error)

GetJenkinsHTTPServiceFQDN returns Kubernetes service FQDN used for expose Jenkins HTTP endpoint

func GetJenkinsHTTPServiceName

func GetJenkinsHTTPServiceName(jenkins *v1alpha2.Jenkins) string

GetJenkinsHTTPServiceName returns Kubernetes service name used for expose Jenkins HTTP endpoint

func GetJenkinsMasterContainerBaseCommand

func GetJenkinsMasterContainerBaseCommand() []string

GetJenkinsMasterContainerBaseCommand returns default Jenkins master container command

func GetJenkinsMasterContainerBaseEnvs

func GetJenkinsMasterContainerBaseEnvs(jenkins *v1alpha2.Jenkins) []corev1.EnvVar

GetJenkinsMasterContainerBaseEnvs returns Jenkins master pod envs required by operator

func GetJenkinsMasterContainerBaseVolumeMounts

func GetJenkinsMasterContainerBaseVolumeMounts(jenkins *v1alpha2.Jenkins) []corev1.VolumeMount

GetJenkinsMasterContainerBaseVolumeMounts returns Jenkins master pod volume mounts required by operator

func GetJenkinsMasterPodBaseVolumes

func GetJenkinsMasterPodBaseVolumes(jenkins *v1alpha2.Jenkins) []corev1.Volume

GetJenkinsMasterPodBaseVolumes returns Jenkins master pod volumes required by operator

func GetJenkinsMasterPodLabels

func GetJenkinsMasterPodLabels(jenkins v1alpha2.Jenkins) map[string]string

GetJenkinsMasterPodLabels returns Jenkins pod labels for given CR

func GetJenkinsMasterPodName

func GetJenkinsMasterPodName(jenkins *v1alpha2.Jenkins) string

GetJenkinsMasterPodName returns Jenkins pod name for given CR

func GetJenkinsOpts

func GetJenkinsOpts(jenkins v1alpha2.Jenkins) map[string]string

GetJenkinsOpts gets JENKINS_OPTS env parameter, parses it's values and returns it as a map`

func GetJenkinsSlavesServiceFQDN

func GetJenkinsSlavesServiceFQDN(jenkins *v1alpha2.Jenkins, kubernetesClusterDomain string) (string, error)

GetJenkinsSlavesServiceFQDN returns Kubernetes service FQDN used for expose Jenkins slave endpoint

func GetJenkinsSlavesServiceName

func GetJenkinsSlavesServiceName(jenkins *v1alpha2.Jenkins) string

GetJenkinsSlavesServiceName returns Kubernetes service name used for expose Jenkins slave endpoint

func GetOperatorCredentialsSecretName

func GetOperatorCredentialsSecretName(jenkins *v1alpha2.Jenkins) string

GetOperatorCredentialsSecretName returns name of Kubernetes secret used to store jenkins operator credentials to allow calls to Jenkins API

func GetResourceName

func GetResourceName(jenkins *v1alpha2.Jenkins) string

GetResourceName returns name of Kubernetes resource base on Jenkins CR

func IsRouteAPIAvailable

func IsRouteAPIAvailable(clientSet *kubernetes.Clientset) bool

IsRouteAPIAvailable tells if the Route API is installed and discoverable

func IsRunningInCluster added in v0.6.0

func IsRunningInCluster() (bool, error)

func NewBaseConfigurationConfigMap

func NewBaseConfigurationConfigMap(meta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins, kubernetesClusterDomain string) (*corev1.ConfigMap, error)

NewBaseConfigurationConfigMap builds Kubernetes config map used to base configuration.

func NewDefaultPolicyRules

func NewDefaultPolicyRules() []v1.PolicyRule

NewDefaultPolicyRules sets the default policy rules

func NewInitConfigurationConfigMap

func NewInitConfigurationConfigMap(meta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins) (*corev1.ConfigMap, error)

NewInitConfigurationConfigMap builds Kubernetes config map used to init configuration

func NewJenkinsDeployment

func NewJenkinsDeployment(objectMeta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins) *appsv1.Deployment

NewJenkinsMasterPod builds Jenkins Master Kubernetes Pod resource.

func NewJenkinsMasterContainer

func NewJenkinsMasterContainer(jenkins *v1alpha2.Jenkins) corev1.Container

NewJenkinsMasterContainer returns Jenkins master Kubernetes container

func NewJenkinsMasterPod

func NewJenkinsMasterPod(objectMeta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins) *corev1.Pod

NewJenkinsMasterPod builds Jenkins Master Kubernetes Pod resource

func NewOpenShiftPolicyRule

func NewOpenShiftPolicyRule(apiGroup string, resource string, verbs []string) v1.PolicyRule

NewOpenShiftPolicyRule returns a policyRule allowing verbs on resources

func NewOperatorCredentialsSecret

func NewOperatorCredentialsSecret(meta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins) *corev1.Secret

NewOperatorCredentialsSecret builds the Kubernetes secret used to store jenkins operator credentials to allow calls to Jenkins API

func NewPolicyRule

func NewPolicyRule(apiGroup string, resource string, verbs []string) v1.PolicyRule

NewPolicyRule returns a policyRule allowing verbs on resources

func NewProbe

func NewProbe(uri string, port string, scheme corev1.URIScheme, initialDelaySeconds, timeoutSeconds, failureThreshold int32) *corev1.Probe

func NewResourceObjectMeta

func NewResourceObjectMeta(jenkins *v1alpha2.Jenkins) metav1.ObjectMeta

NewResourceObjectMeta builds ObjectMeta for all Kubernetes resources created by operator

func NewResourceRequirements

func NewResourceRequirements(cpuRequest, memoryRequest, cpuLimit, memoryLimit string) corev1.ResourceRequirements

func NewRole

func NewRole(meta metav1.ObjectMeta) *v1.Role

NewRole returns rbac role for jenkins master

func NewRoleBinding

func NewRoleBinding(name, namespace, serviceAccountName string, roleRef v1.RoleRef) *v1.RoleBinding

NewRoleBinding returns rbac role binding for jenkins master

func NewScriptsConfigMap

func NewScriptsConfigMap(meta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins) (*corev1.ConfigMap, error)

NewScriptsConfigMap builds Kubernetes config map used to store scripts

func NewServiceAccount

func NewServiceAccount(meta metav1.ObjectMeta, annotations map[string]string) *v1.ServiceAccount

NewServiceAccount return Kubernetes service account

func UpdateRoute

func UpdateRoute(actual routev1.Route, jenkins *v1alpha2.Jenkins) routev1.Route

UpdateRoute returns new route matching the service

func UpdateService

func UpdateService(actual corev1.Service, config v1alpha2.Service, targetPort int32) corev1.Service

UpdateService returns new service with override fields from config

func VerifyIfLabelsAreSet

func VerifyIfLabelsAreSet(object metav1.Object, requiredLabels map[string]string) bool

VerifyIfLabelsAreSet check is selected labels are set for specific resource

Types

This section is empty.

Jump to

Keyboard shortcuts

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