deploy

package
v0.0.0-...-14d2540 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: EPL-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CheServiceName = "che-host"
)

Variables

View Source
var DefaultDeploymentDiffOpts = cmp.Options{
	cmpopts.IgnoreFields(appsv1.Deployment{}, "TypeMeta", "ObjectMeta", "Status"),
	cmpopts.IgnoreFields(appsv1.DeploymentSpec{}, "Replicas", "RevisionHistoryLimit", "ProgressDeadlineSeconds"),
	cmpopts.IgnoreFields(appsv1.DeploymentStrategy{}, "RollingUpdate"),
	cmpopts.IgnoreFields(corev1.Container{}, "ReadinessProbe", "LivenessProbe", "TerminationMessagePath", "TerminationMessagePolicy"),
	cmpopts.IgnoreFields(corev1.PodSpec{}, "DNSPolicy", "SchedulerName", "DeprecatedServiceAccount"),
	cmpopts.IgnoreFields(corev1.ConfigMapVolumeSource{}, "DefaultMode"),
	cmpopts.IgnoreFields(corev1.SecretVolumeSource{}, "DefaultMode"),
	cmp.Comparer(func(x, y resource.Quantity) bool {
		return x.Cmp(y) == 0
	}),
}
View Source
var (
	DefaultIngressAnnotations = map[string]string{
		"kubernetes.io/ingress.class":                       "nginx",
		"nginx.ingress.kubernetes.io/proxy-read-timeout":    "3600",
		"nginx.ingress.kubernetes.io/proxy-connect-timeout": "3600",
		"nginx.ingress.kubernetes.io/ssl-redirect":          "true",
	}
)
View Source
var IngressDiffOpts = cmp.Options{
	cmpopts.IgnoreFields(networking.Ingress{}, "TypeMeta", "Status"),
	cmpopts.IgnoreFields(networking.HTTPIngressPath{}, "PathType"),
	cmp.Comparer(func(x, y metav1.ObjectMeta) bool {
		return reflect.DeepEqual(x.Labels, y.Labels) &&
			x.Annotations[constants.CheEclipseOrgManagedAnnotationsDigest] == y.Annotations[constants.CheEclipseOrgManagedAnnotationsDigest]
	}),
}
View Source
var (
	JobDiffOpts = cmp.Options{
		cmpopts.IgnoreFields(batchv1.Job{}, "TypeMeta", "ObjectMeta", "Status"),
		cmpopts.IgnoreFields(batchv1.JobSpec{}, "Selector", "TTLSecondsAfterFinished"),
		cmpopts.IgnoreFields(corev1.PodTemplateSpec{}, "ObjectMeta"),
		cmpopts.IgnoreFields(corev1.Container{}, "TerminationMessagePath", "TerminationMessagePolicy"),
		cmpopts.IgnoreFields(corev1.PodSpec{}, "DNSPolicy", "SchedulerName", "SecurityContext"),
		cmp.Comparer(func(x, y []corev1.EnvVar) bool {
			xMap := make(map[string]string)
			yMap := make(map[string]string)
			for _, env := range x {
				xMap[env.Name] = env.Value
			}
			for _, env := range y {
				yMap[env.Name] = env.Value
			}
			return reflect.DeepEqual(xMap, yMap)
		}),
	}
)
View Source
var SecretDiffOpts = cmp.Options{
	cmpopts.IgnoreFields(corev1.Secret{}, "TypeMeta", "ObjectMeta"),
}
View Source
var ServiceDefaultDiffOpts = cmp.Options{
	cmpopts.IgnoreFields(corev1.Service{}, "TypeMeta", "ObjectMeta"),
	cmp.Comparer(func(x, y corev1.ServiceSpec) bool {
		return cmp.Equal(x.Ports, y.Ports, cmpopts.IgnoreFields(corev1.ServicePort{}, "TargetPort", "NodePort")) &&
			reflect.DeepEqual(x.Selector, y.Selector)
	}),
}

Functions

func AppendFinalizer

func AppendFinalizer(cheCtx *chetypes.CheContext, finalizer string) error

func CleanUpAllFinalizers

func CleanUpAllFinalizers(cheCtx *chetypes.CheContext) error

func ConfigureProxy

func ConfigureProxy(cheCtx *chetypes.CheContext, transport *http.Transport)

ConfigureProxy adds existing proxy configuration into provided transport object.

func DeleteFinalizer

func DeleteFinalizer(cheCtx *chetypes.CheContext, finalizer string) error

func EnsurePodSecurityStandards

func EnsurePodSecurityStandards(podSpec *corev1.PodSpec, userId int64, groupId int64)

EnsurePodSecurityStandards sets SecurityContext accordingly to standards https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted

func FindCheClusterCRInNamespace

func FindCheClusterCRInNamespace(cl client.Client, namespace string) (*chev2.CheCluster, error)

FindCheClusterCRInNamespace returns CheCluster custom resource from given namespace. If namespace is empty then checluster will be found in any namespace. Only one instance of CheCluster custom resource is expected.

func GenerateProxyJavaOpts

func GenerateProxyJavaOpts(proxy *chetypes.Proxy, noProxy string) (javaOpts string)

GenerateProxyJavaOpts converts given proxy configuration into Java format.

func GetIngressSpec

func GetIngressSpec(
	cheCtx *chetypes.CheContext,
	name string,
	path string,
	serviceName string,
	servicePort int32,
	component string) (ingressUrl string, i *networking.Ingress)

GetIngressSpec returns expected ingress config for given parameters host and path are evaluated if they are empty

func GetLabelKeys

func GetLabelKeys() []string

func GetLabels

func GetLabels(component string) map[string]string

func GetLabelsAndAnnotations

func GetLabelsAndAnnotations(obj client.Object) ([]string, []string)

GetLabelsAndAnnotations extracts label and annotation keys from an object. Note: key order is non-deterministic (map iteration order).

func GetLabelsAndSelector

func GetLabelsAndSelector(component string) (map[string]string, map[string]string)

func GetLegacyLabels

func GetLegacyLabels(component string) map[string]string

func GetManagedByLabel

func GetManagedByLabel() string

func GetRouteSpec

func GetRouteSpec(
	cheCtx *chetypes.CheContext,
	name string,
	path string,
	serviceName string,
	servicePort int32,
	component string) (*routev1.Route, error)

GetRouteSpec returns default configuration of a route in Che namespace.

func GetSecretSpec

func GetSecretSpec(name string, namespace string, data map[string][]byte) *corev1.Secret

GetSecretSpec return default secret config for given data

func GetSecrets

func GetSecrets(cheCtx *chetypes.CheContext, labels map[string]string, annotations map[string]string) ([]corev1.Secret, error)

Get all secrets by labels and annotations

func GetServiceSpec

func GetServiceSpec(
	cheCtx *chetypes.CheContext,
	name string,
	portName []string,
	portNumber []int32,
	component string) *corev1.Service

func IsDevWorkspaceComponent

func IsDevWorkspaceComponent(labels map[string]string) bool

func IsOperatorManagedComponent

func IsOperatorManagedComponent(labels map[string]string, component string) bool

func MergeNonProxy

func MergeNonProxy(noProxy1 string, noProxy2 string) string

func MountConfigMaps

func MountConfigMaps(specDeployment *appsv1.Deployment, cheCtx *chetypes.CheContext) error

MountConfigMaps mounts configmaps into a container as a file or as environment variable. Configmaps are selected by the following labels: - app.kubernetes.io/part-of=che.eclipse.org - app.kubernetes.io/component=<DEPLOYMENT-NAME>-configmap

func MountSecrets

func MountSecrets(specDeployment *appsv1.Deployment, cheCtx *chetypes.CheContext) error

MountSecrets mounts secrets into a container as a file or as environment variable. Secrets are selected by the following labels: - app.kubernetes.io/part-of=che.eclipse.org - app.kubernetes.io/component=<DEPLOYMENT-NAME>-secret

func OverrideContainer

func OverrideContainer(
	namespace string,
	container *corev1.Container,
	overrideSettings *chev2.Container) error

func OverrideDeployment

func OverrideDeployment(
	cheCtx *chetypes.CheContext,
	deployment *appsv1.Deployment,
	overrideDeploymentSettings *chev2.Deployment) error

OverrideDeployment with custom settings

func ReadCheClusterProxyConfiguration

func ReadCheClusterProxyConfiguration(cheCtx *chetypes.CheContext) (*chetypes.Proxy, error)

func ReadClusterWideProxyConfiguration

func ReadClusterWideProxyConfiguration(clusterProxy *configv1.Proxy) (*chetypes.Proxy, error)

func ReloadCheClusterCR

func ReloadCheClusterCR(cheCtx *chetypes.CheContext) error

func SetStatusDetails

func SetStatusDetails(cheCtx *chetypes.CheContext, reason string, message string) (err error)

func SyncClusterRoleBindingToCluster

func SyncClusterRoleBindingToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	serviceAccountName string,
	clusterRoleName string) error

func SyncClusterRoleToCluster

func SyncClusterRoleToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	policyRule []rbac.PolicyRule) error

func SyncDeploymentSpecToCluster

func SyncDeploymentSpecToCluster(
	cheCtx *chetypes.CheContext,
	deploymentSpec *appsv1.Deployment,
	deploymentDiffOpts cmp.Options) (bool, error)

func SyncIngressToCluster

func SyncIngressToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	path string,
	serviceName string,
	servicePort int32,
	component string) (endpointUrl string, err error)

SyncIngressToCluster creates ingress to expose service with the set settings host and path are evaluated if they are empty

func SyncJobToCluster

func SyncJobToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	component string,
	image string,
	serviceAccountName string,
	env map[string]string) error

func SyncRoleBindingToCluster

func SyncRoleBindingToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	serviceAccountName string,
	roleName string,
	roleKind string) error

func SyncRoleToCluster

func SyncRoleToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	policyRule []rbac.PolicyRule) error

func SyncRouteToCluster

func SyncRouteToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	path string,
	serviceName string,
	servicePort int32,
	component string) error

func SyncSecretToCluster

func SyncSecretToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	data map[string][]byte) error

SyncSecretToCluster applies secret into cluster or external namespace

func SyncServiceAccountToCluster

func SyncServiceAccountToCluster(cheCtx *chetypes.CheContext, name string) error

func SyncServiceSpecToCluster

func SyncServiceSpecToCluster(cheCtx *chetypes.CheContext, serviceSpec *corev1.Service) error

func SyncServiceToCluster

func SyncServiceToCluster(
	cheCtx *chetypes.CheContext,
	name string,
	portName []string,
	portNumber []int32,
	component string) error

func UpdateCheCRStatus

func UpdateCheCRStatus(cheCtx *chetypes.CheContext, field string, value string) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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