deploy

package
v0.0.0-...-a5cbdf7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: EPL-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2020 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2018-2020 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

REMINDER: when updating versions below, see also pkg/apis/org/v1/che_types.go and deploy/crds/org_v1_che_cr.yaml

Copyright (c) 2012-2020 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2020 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2020-2021 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Copyright (c) 2012-2019 Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0

Contributors:

Red Hat, Inc. - initial API and implementation

Index

Constants

View Source
const (
	DefaultChePostgresUser     = "pgche"
	DefaultChePostgresHostName = "postgres"
	DefaultChePostgresPort     = "5432"
	DefaultChePostgresDb       = "dbche"
	DefaultPvcStrategy         = "common"
	DefaultPvcClaimSize        = "1Gi"
	DefaultIngressClass        = "nginx"

	DefaultKeycloakAdminUserName   = "admin"
	DefaultCheLogLevel             = "INFO"
	DefaultCheDebug                = "false"
	DefaultCheMultiUser            = "true"
	DefaultCheMetricsPort          = int32(8087)
	DefaultCheDebugPort            = int32(8000)
	DefaultCheVolumeMountPath      = "/data"
	DefaultCheVolumeClaimName      = "che-data-volume"
	DefaultPostgresVolumeClaimName = "postgres-data"

	DefaultJavaOpts          = "-XX:MaxRAMPercentage=85.0"
	DefaultWorkspaceJavaOpts = "-XX:MaxRAM=150m -XX:MaxRAMFraction=2 -XX:+UseParallelGC " +
		"-XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 " +
		"-Dsun.zip.disableMemoryMapping=true " +
		"-Xms20m -Djava.security.egd=file:/dev/./urandom"
	DefaultSecurityContextFsGroup   = "1724"
	DefaultSecurityContextRunAsUser = "1724"

	KubernetesImagePullerOperatorCSV = "kubernetes-imagepuller-operator.v0.0.4"

	DefaultServerExposureStrategy           = "multi-host"
	DefaultKubernetesSingleHostExposureType = "native"
	DefaultOpenShiftSingleHostExposureType  = "gateway"

	// This is only to correctly  manage defaults during the transition
	// from Upstream 7.0.0 GA to the next version
	// That fixed bug https://github.com/eclipse/che/issues/13714
	OldDefaultKeycloakUpstreamImageToDetect = "eclipse/che-keycloak:7.0.0"
	OldDefaultPvcJobsUpstreamImageToDetect  = "registry.access.redhat.com/ubi8-minimal:8.0-127"
	OldDefaultPostgresUpstreamImageToDetect = "centos/postgresql-96-centos7:9.6"

	OldDefaultCodeReadyServerImageRepo = "registry.redhat.io/codeready-workspaces/server-rhel8"
	OldDefaultCodeReadyServerImageTag  = "1.2"
	OldCrwPluginRegistryUrl            = "https://che-plugin-registry.openshift.io"

	// kubernetes default labels
	KubernetesComponentLabelKey = "app.kubernetes.io/component"
	KubernetesPartOfLabelKey    = "app.kubernetes.io/part-of"
	KubernetesManagedByLabelKey = "app.kubernetes.io/managed-by"
	KubernetesInstanceLabelKey  = "app.kubernetes.io/instance"
	KubernetesNameLabelKey      = "app.kubernetes.io/name"

	CheEclipseOrg         = "che.eclipse.org"
	OAuthScmConfiguration = "oauth-scm-configuration"

	// che.eclipse.org annotations
	CheEclipseOrgMountPath              = "che.eclipse.org/mount-path"
	CheEclipseOrgMountAs                = "che.eclipse.org/mount-as"
	CheEclipseOrgEnvName                = "che.eclipse.org/env-name"
	CheEclipseOrgNamespace              = "che.eclipse.org/namespace"
	CheEclipseOrgGithubOAuthCredentials = "che.eclipse.org/github-oauth-credentials"
	CheEclipseOrgOAuthScmServer         = "che.eclipse.org/oauth-scm-server"
	CheEclipseOrgScmServerEndpoint      = "che.eclipse.org/scm-server-endpoint"

	// components
	IdentityProviderName = "keycloak"
	DevfileRegistryName  = "devfile-registry"
	PluginRegistryName   = "plugin-registry"
	PostgresName         = "postgres"

	// limits
	DefaultPluginRegistryMemoryLimit   = "256Mi"
	DefaultPluginRegistryMemoryRequest = "32Mi"
	DefaultPluginRegistryCpuLimit      = "500m"
	DefaultPluginRegistryCpuRequest    = "100m"

	DefaultDevfileRegistryMemoryLimit   = "256Mi"
	DefaultDevfileRegistryMemoryRequest = "32Mi"
	DefaultDevfileRegistryCpuLimit      = "500m"
	DefaultDevfileRegistryCpuRequest    = "100m"

	DefaultServerMemoryLimit   = "1024Mi"
	DefaultServerMemoryRequest = "512Mi"
	DefaultServerCpuLimit      = "1"
	DefaultServerCpuRequest    = "100m"

	DefaultIdentityProviderMemoryLimit   = "1536Mi"
	DefaultIdentityProviderMemoryRequest = "1024Mi"
	DefaultIdentityProviderCpuLimit      = "2"
	DefaultIdentityProviderCpuRequest    = "100m"

	DefaultPostgresMemoryLimit   = "1024Mi"
	DefaultPostgresMemoryRequest = "512Mi"
	DefaultPostgresCpuLimit      = "500m"
	DefaultPostgresCpuRequest    = "100m"

	BitBucketOAuthConfigMountPath   = "/che-conf/oauth/bitbucket"
	BitBucketOAuthConfigPrivateKey  = "private.key"
	BitBucketOAuthConfigConsumerKey = "consumer.key"
)
View Source
const (
	// ViewRoleName role to get k8s object needed for Workspace components(metrics plugin, Che terminals, tasks etc.)
	ViewRoleName = "view"
	// ExecRoleName - role name to create Che terminals and tasks in the workspace.
	ExecRoleName = "exec"
)
View Source
const (
	CheTLSJobServiceAccountName           = "che-tls-job-service-account"
	CheTLSJobRoleName                     = "che-tls-job-role"
	CheTLSJobRoleBindingName              = "che-tls-job-role-binding"
	CheTLSJobName                         = "che-tls-job"
	CheTLSJobComponentName                = "che-create-tls-secret-job"
	CheTLSSelfSignedCertificateSecretName = "self-signed-certificate"
	DefaultCheTLSSecretName               = "che-tls"

	// CheCACertsConfigMapLabelKey is the label key which marks config map with additional CA certificates
	CheCACertsConfigMapLabelKey = "app.kubernetes.io/component"
	// CheCACertsConfigMapLabelKey is the label value which marks config map with additional CA certificates
	CheCACertsConfigMapLabelValue = "ca-bundle"
	// CheAllCACertsConfigMapName is the name of config map which contains all additional trusted by Che TLS CA certificates
	CheAllCACertsConfigMapName = "ca-certs-merged"
	// CheMergedCAConfigMapRevisionsAnnotationKey is annotation name which holds versions of included config maps in format: cm-name1=ver1,cm-name2=ver2
	CheMergedCAConfigMapRevisionsAnnotationKey = "che.eclipse.org/included-configmaps"
)

TLS related constants

View Source
const (
	CheServiceName = "che-host"
)
View Source
const (
	// host name template: `<route-name>-<route-namespace>.<domain>`
	HostNameTemplate = "%s-%s.%s"
)

Variables

View Source
var (
	DefaultSingleHostGatewayConfigMapLabels = map[string]string{
		"app":       "che",
		"component": "che-gateway-config",
	}
)
View Source
var DeploymentDiffOpts = 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{}, "TerminationMessagePath", "TerminationMessagePolicy", "SecurityContext"),
	cmpopts.IgnoreFields(corev1.PodSpec{}, "DNSPolicy", "SchedulerName", "SecurityContext", "DeprecatedServiceAccount"),
	cmpopts.IgnoreFields(corev1.ConfigMapVolumeSource{}, "DefaultMode"),
	cmpopts.IgnoreFields(corev1.SecretVolumeSource{}, "DefaultMode"),
	cmpopts.IgnoreFields(corev1.VolumeSource{}, "EmptyDir"),
	cmp.Comparer(func(x, y resource.Quantity) bool {
		return x.Cmp(y) == 0
	}),
}

Functions

func CheckNeededImagePullerApis

func CheckNeededImagePullerApis(ctx *DeployContext) (bool, bool, bool, error)

Check if the API server can discover the API groups for packages.operators.coreos.com, operators.coreos.com, and che.eclipse.org. Returns: foundPackagesAPI - true if the server discovers the packages.operators.coreos.com API foundOperatorsAPI - true if the server discovers the operators.coreos.com API foundKubernetesImagePullerAPI - true if the server discovers the che.eclipse.org API error - any error returned by the call to discoveryClient.ServerGroups()

func CompareExpectedSubscription

func CompareExpectedSubscription(ctx *DeployContext, packageManifest *packagesv1.PackageManifest) (bool, error)

func ConfigureProxy

func ConfigureProxy(deployContext *DeployContext, transport *http.Transport)

ConfigureProxy adds existing proxy configuration into provided transport object.

func Create

func Create(deployContext *DeployContext, key client.ObjectKey, blueprint metav1.Object) (bool, error)

func CreateIfNotExists

func CreateIfNotExists(deployContext *DeployContext, objectMeta metav1.Object) (bool, error)

func CreateImagePullerSubscription

func CreateImagePullerSubscription(ctx *DeployContext, packageManifest *packagesv1.PackageManifest) (bool, error)

func CreateKubernetesImagePuller

func CreateKubernetesImagePuller(ctx *DeployContext) (bool, error)

func CreateOperatorGroupIfNotFound

func CreateOperatorGroupIfNotFound(ctx *DeployContext) (bool, error)

Create an OperatorGroup in the CheCluster namespace if it does not exist. Returns true if the OperatorGroup was created, and any error returned during the List and Create operation

func CreateTLSSecretFromEndpoint

func CreateTLSSecretFromEndpoint(deployContext *DeployContext, url string, name string) (err error)

CreateTLSSecretFromEndpoint creates TLS secret with given name which contains certificates obtained from the given url. If the url is empty string, then cluster default certificate will be obtained. Does nothing if secret with given name already exists.

func DefaultCheFlavor

func DefaultCheFlavor(cr *orgv1.CheCluster) string

func DefaultCheIdentityPostgresSecret

func DefaultCheIdentityPostgresSecret() string

func DefaultCheIdentitySecret

func DefaultCheIdentitySecret() string

func DefaultChePostgresSecret

func DefaultChePostgresSecret() string

func DefaultCheServerImage

func DefaultCheServerImage(cr *orgv1.CheCluster) string

func DefaultCheServerSecureExposerJwtProxyImage

func DefaultCheServerSecureExposerJwtProxyImage(cr *orgv1.CheCluster) string

func DefaultCheTLSSecretsCreationJobImage

func DefaultCheTLSSecretsCreationJobImage() string

func DefaultCheVersion

func DefaultCheVersion() string

func DefaultCheWorkspacePluginBrokerArtifactsImage

func DefaultCheWorkspacePluginBrokerArtifactsImage(cr *orgv1.CheCluster) string

func DefaultCheWorkspacePluginBrokerMetadataImage

func DefaultCheWorkspacePluginBrokerMetadataImage(cr *orgv1.CheCluster) string

func DefaultConsoleLinkDisplayName

func DefaultConsoleLinkDisplayName() string

func DefaultConsoleLinkImage

func DefaultConsoleLinkImage() string

func DefaultConsoleLinkName

func DefaultConsoleLinkName() string
func DefaultConsoleLinkSection() string

func DefaultDevfileRegistryImage

func DefaultDevfileRegistryImage(cr *orgv1.CheCluster) string

func DefaultKeycloakImage

func DefaultKeycloakImage(cr *orgv1.CheCluster) string

func DefaultKubernetesImagePullerOperatorCSV

func DefaultKubernetesImagePullerOperatorCSV() string

func DefaultPluginRegistryImage

func DefaultPluginRegistryImage(cr *orgv1.CheCluster) string

func DefaultPostgresImage

func DefaultPostgresImage(cr *orgv1.CheCluster) string

func DefaultPullPolicyFromDockerImage

func DefaultPullPolicyFromDockerImage(dockerImage string) string

func DefaultPvcJobsImage

func DefaultPvcJobsImage(cr *orgv1.CheCluster) string

func DefaultServerTrustStoreConfigMapName

func DefaultServerTrustStoreConfigMapName() string

func DefaultSingleHostGatewayConfigSidecarImage

func DefaultSingleHostGatewayConfigSidecarImage(cr *orgv1.CheCluster) string

func DefaultSingleHostGatewayImage

func DefaultSingleHostGatewayImage(cr *orgv1.CheCluster) string

func DeleteClusterRole

func DeleteClusterRole(clusterRoleName string, client runtimeClient.Client) error

func DeleteClusterRoleBinding

func DeleteClusterRoleBinding(clusterRoleBindingName string, client runtimeClient.Client) error

func DeleteImagePullerFinalizer

func DeleteImagePullerFinalizer(ctx *DeployContext) (err error)

func DeleteIngressIfExists

func DeleteIngressIfExists(name string, deployContext *DeployContext) error

DeleteIngressIfExists removes specified ingress if any

func DeleteRole

func DeleteRole(name string, namespace string, client runtimeClient.Client) error

func DeleteRoleBinding

func DeleteRoleBinding(name string, namespace string, client runtimeClient.Client) error

func DeleteRouteIfExists

func DeleteRouteIfExists(name string, deployContext *DeployContext) error

func DeleteSecret

func DeleteSecret(secretName string, namespace string, runtimeClient client.Client) error

DeleteSecret - delete secret by name and namespace

func GenerateProxyJavaOpts

func GenerateProxyJavaOpts(proxy *Proxy, noProxy string) (javaOpts string, err error)

GenerateProxyJavaOpts converts given proxy configuration into Java format.

func Get

func Get(deployContext *DeployContext, key client.ObjectKey, objectMeta metav1.Object) (*runtime.Object, error)

Gets object by key

func GetAdditionalCACertsConfigMapVersion

func GetAdditionalCACertsConfigMapVersion(deployContext *DeployContext) string

GetAdditionalCACertsConfigMapVersion returns revision of merged additional CA certs config map

func GetCheMultiUser

func GetCheMultiUser(cr *orgv1.CheCluster) string

func GetClusterConfigMap

func GetClusterConfigMap(name string, namespace string, client runtimeClient.Client) (*corev1.ConfigMap, error)

GetClusterConfigMap reads config map from cluster

func GetClusterDeployment

func GetClusterDeployment(name string, namespace string, client runtimeClient.Client) (*appsv1.Deployment, error)

func GetClusterIngress

func GetClusterIngress(name string, namespace string, client runtimeClient.Client) (*v1beta1.Ingress, error)

GetClusterIngress returns actual ingress config by provided name and namespace

func GetClusterRole

func GetClusterRole(name string, client runtimeClient.Client) (*rbac.ClusterRole, error)

func GetClusterRoleBiding

func GetClusterRoleBiding(name string, client runtimeClient.Client) (*rbac.ClusterRoleBinding, error)

func GetClusterRoute

func GetClusterRoute(name string, namespace string, client runtimeClient.Client) (*routev1.Route, error)

GetClusterRoute returns existing route.

func GetEndpointTLSCrtBytes

func GetEndpointTLSCrtBytes(deployContext *DeployContext, endpointURL string) (certificates []byte, err error)

GetEndpointTLSCrtBytes extracts certificate chain from given endpoint. Creates a test TLS route/ingress if endpoint url is empty. There's an easier way which is to read tls secret in default (3.11) or openshift-ingress (4.0) namespace which however requires extra privileges for operator service account

func GetEndpointTLSCrtChain

func GetEndpointTLSCrtChain(deployContext *DeployContext, endpointURL string) ([]*x509.Certificate, error)

GetEndpointTLSCrtChain retrieves TLS certificates chain from given endpoint. If endpoint is not specified, then a test route/ingress will be created and used to get router certificates.

func GetExpectedKubernetesImagePuller

func GetExpectedKubernetesImagePuller(ctx *DeployContext) *chev1alpha1.KubernetesImagePuller

func GetExpectedSubscription

func GetExpectedSubscription(ctx *DeployContext, packageManifest *packagesv1.PackageManifest) *operatorsv1alpha1.Subscription

func GetLabels

func GetLabels(cheCluster *orgv1.CheCluster, component string) map[string]string

func GetLabelsAndSelector

func GetLabelsAndSelector(cheCluster *orgv1.CheCluster, component string) (map[string]string, map[string]string)

func GetLegacyLabels

func GetLegacyLabels(cheCluster *orgv1.CheCluster, component string) map[string]string

func GetPackageManifest

func GetPackageManifest(ctx *DeployContext) (*packagesv1.PackageManifest, error)

Search for the kubernetes-imagepuller-operator PackageManifest

func GetSecret

func GetSecret(deployContext *DeployContext, name string, namespace string) (*corev1.Secret, error)

GetSecret retrieves given secret from cluster

func GetSecrets

func GetSecrets(deployContext *DeployContext, labels map[string]string, annotations map[string]string) ([]corev1.Secret, error)

Get all secrets by labels and annotations

func GetSingleHostExposureType

func GetSingleHostExposureType(cr *orgv1.CheCluster) string

func GetSpecConfigMap

func GetSpecConfigMap(
	deployContext *DeployContext,
	name string,
	data map[string]string,
	component string) (*corev1.ConfigMap, error)

GetSpecConfigMap returns config map spec template

func GetSpecIngress

func GetSpecIngress(
	deployContext *DeployContext,
	name string,
	host string,
	serviceName string,
	servicePort int,
	ingressCustomSettings orgv1.IngressCustomSettings,
	component string) (*v1beta1.Ingress, error)

GetSpecIngress returns expected ingress config for given parameters

func GetSpecRoute

func GetSpecRoute(
	deployContext *DeployContext,
	name string,
	host string,
	serviceName string,
	servicePort int32,
	routeCustomSettings orgv1.RouteCustomSettings,
	component string) (*routev1.Route, error)

GetSpecRoute returns default configuration of a route in Che namespace.

func GetSpecSecret

func GetSpecSecret(deployContext *DeployContext, name string, namespace string, data map[string][]byte) (*corev1.Secret, error)

GetSpecSecret return default secret config for given data

func GetSpecService

func GetSpecService(
	deployContext *DeployContext,
	name string,
	portName []string,
	portNumber []int32,
	component string) (*corev1.Service, error)

func HasImagePullerFinalizer

func HasImagePullerFinalizer(instance *orgv1.CheCluster) bool

func InitDefaults

func InitDefaults(defaultsPath string)

func InitDefaultsFromEnv

func InitDefaultsFromEnv()

func InitDefaultsFromFile

func InitDefaultsFromFile(defaultsPath string)

func InitTestDefaultsFromDeployment

func InitTestDefaultsFromDeployment(deploymentFile string) error

func IsExists

func IsExists(deployContext *DeployContext, key client.ObjectKey, objectMeta metav1.Object) (bool, error)

Indicates if objects exists

func IsSelfSignedCertificateUsed

func IsSelfSignedCertificateUsed(deployContext *DeployContext) (bool, error)

IsSelfSignedCertificateUsed detects whether endpoints are/should be secured by self-signed certificate.

func K8sHandleCheTLSSecrets

func K8sHandleCheTLSSecrets(deployContext *DeployContext) (reconcile.Result, error)

K8sHandleCheTLSSecrets handles TLS secrets required for Che deployment on Kubernetes infrastructure.

func MergeLabels

func MergeLabels(labels map[string]string, additionalLabels string)

func MergeNonProxy

func MergeNonProxy(noProxy1 string, noProxy2 string) string

func MigratingToCRW2_0

func MigratingToCRW2_0(cr *orgv1.CheCluster) bool

func MountSecrets

func MountSecrets(specDeployment *appsv1.Deployment, deployContext *DeployContext) 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 NewOAuthClient

func NewOAuthClient(name string, oauthSecret string, keycloakURL string, keycloakRealm string, isOpenShift4 bool) *oauth.OAuthClient

func ReconcileImagePuller

func ReconcileImagePuller(ctx *DeployContext) (reconcile.Result, error)

Reconcile the imagePuller section of the CheCluster CR. If imagePuller.enable is set to true, install the Kubernetes Image Puller operator and create a KubernetesImagePuller CR. Add a finalizer to the CheCluster CR. If false, remove the KubernetesImagePuller CR, uninstall the operator, and remove the finalizer.

func ReconcileImagePullerFinalizer

func ReconcileImagePullerFinalizer(ctx *DeployContext) (err error)

func SubscriptionsAreEqual

func SubscriptionsAreEqual(expected *operatorsv1alpha1.Subscription, actual *operatorsv1alpha1.Subscription) bool

Returns true if the expected and actual Subscription specs have the same fields during Image Puller installation

func Sync

func Sync(deployContext *DeployContext, blueprint metav1.Object, diffOpts cmp.Option) (bool, error)

Sync syncs the blueprint to the cluster in a generic (as much as Go allows) manner. Returns true if the object was created or updated, false if there was no change detected.

func SyncAdditionalCACertsConfigMapToCluster

func SyncAdditionalCACertsConfigMapToCluster(deployContext *DeployContext) (*corev1.ConfigMap, error)

SyncAdditionalCACertsConfigMapToCluster makes sure that additional CA certs config map is up to date if any

func SyncClusterRoleBindingToCluster

func SyncClusterRoleBindingToCluster(
	deployContext *DeployContext,
	name string,
	serviceAccountName string,
	clusterRoleName string) (*rbac.ClusterRoleBinding, error)

func SyncClusterRoleToCheCluster

func SyncClusterRoleToCheCluster(
	deployContext *DeployContext,
	name string,
	policyRule []rbac.PolicyRule) (bool, error)

func SyncConfigMapToCluster

func SyncConfigMapToCluster(deployContext *DeployContext, specConfigMap *corev1.ConfigMap) (*corev1.ConfigMap, error)

SyncConfigMapToCluster makes sure that given config map spec is actual. It compares config map data and labels. If returned config map is nil then it means that the config map update is in progress and reconcile loop probably should be restarted.

func SyncDeploymentToCluster

func SyncDeploymentToCluster(
	deployContext *DeployContext,
	specDeployment *appsv1.Deployment,
	clusterDeployment *appsv1.Deployment,
	additionalDeploymentDiffOpts cmp.Options,
	additionalDeploymentMerge func(*appsv1.Deployment, *appsv1.Deployment) *appsv1.Deployment) (bool, error)

func SyncExecRoleToCluster

func SyncExecRoleToCluster(deployContext *DeployContext) (*rbac.Role, error)

func SyncIngressToCluster

func SyncIngressToCluster(
	deployContext *DeployContext,
	name string,
	host string,
	serviceName string,
	servicePort int,
	ingressCustomSettings orgv1.IngressCustomSettings,
	component string) (*v1beta1.Ingress, error)

func SyncJobToCluster

func SyncJobToCluster(
	deployContext *DeployContext,
	name string,
	component string,
	image string,
	serviceAccountName string,
	env map[string]string) (*batchv1.Job, error)

func SyncRoleBindingToCluster

func SyncRoleBindingToCluster(
	deployContext *DeployContext,
	name string,
	serviceAccountName string,
	roleName string,
	roleKind string) (*rbac.RoleBinding, error)

func SyncRoleToCluster

func SyncRoleToCluster(
	deployContext *DeployContext,
	name string,
	policyRule []rbac.PolicyRule) (*rbac.Role, error)

func SyncRouteToCluster

func SyncRouteToCluster(
	deployContext *DeployContext,
	name string,
	host string,
	serviceName string,
	servicePort int32,
	routeCustomSettings orgv1.RouteCustomSettings,
	component string) (*routev1.Route, error)

func SyncSecret

func SyncSecret(
	deployContext *DeployContext,
	name string,
	namespace string,
	data map[string][]byte) (*corev1.Secret, error)

SyncSecret applies secret into cluster or external namespace

func SyncServiceAccountToCluster

func SyncServiceAccountToCluster(deployContext *DeployContext, name string) (*corev1.ServiceAccount, error)

func SyncTLSRoleToCluster

func SyncTLSRoleToCluster(deployContext *DeployContext) (*rbac.Role, error)

func SyncViewRoleToCluster

func SyncViewRoleToCluster(deployContext *DeployContext) (*rbac.Role, error)

func UninstallImagePullerOperator

func UninstallImagePullerOperator(ctx *DeployContext) (bool, error)

Unisntall the CSV, OperatorGroup, Subscription, KubernetesImagePuller, and update the CheCluster to remove the image puller spec. Returns true if the CheCluster was updated

func Update

func Update(deployContext *DeployContext, actual runtime.Object, blueprint metav1.Object, diffOpts cmp.Option) (bool, error)

func UpdateCheCRSpec

func UpdateCheCRSpec(deployContext *DeployContext, updatedField string, value string) (err error)

func UpdateCheCRStatus

func UpdateCheCRStatus(deployContext *DeployContext, updatedField string, value string) (err error)

func UpdateImagePullerSpecIfEmpty

func UpdateImagePullerSpecIfEmpty(ctx *DeployContext) (orgv1.CheClusterSpecImagePuller, error)

Update the CheCluster ImagePuller spec if the default values are not set returns the updated spec and an error during update

Types

type ClusterAPI

type ClusterAPI struct {
	Client          client.Client
	NonCachedClient client.Client
	DiscoveryClient discovery.DiscoveryInterface
	Scheme          *runtime.Scheme
}

type DeployContext

type DeployContext struct {
	CheCluster      *orgv1.CheCluster
	ClusterAPI      ClusterAPI
	Proxy           *Proxy
	InternalService InternalService
	DefaultCheHost  string
}

type InternalService

type InternalService struct {
	KeycloakHost        string
	DevfileRegistryHost string
	PluginRegistryHost  string
	CheHost             string
}

type PVCProvisioningStatus

type PVCProvisioningStatus struct {
	ProvisioningStatus
}

func SyncPVCToCluster

func SyncPVCToCluster(
	deployContext *DeployContext,
	name string,
	claimSize string,
	component string) PVCProvisioningStatus

type ProvisioningStatus

type ProvisioningStatus struct {
	Continue bool
	Requeue  bool
	Err      error
}

type Proxy

type Proxy struct {
	HttpProxy    string
	HttpUser     string
	HttpPassword string
	HttpHost     string
	HttpPort     string

	HttpsProxy    string
	HttpsUser     string
	HttpsPassword string
	HttpsHost     string
	HttpsPort     string

	NoProxy          string
	TrustedCAMapName string
}

func ReadCheClusterProxyConfiguration

func ReadCheClusterProxyConfiguration(checluster *orgv1.CheCluster) (*Proxy, error)

func ReadClusterWideProxyConfiguration

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

type ServiceProvisioningStatus

type ServiceProvisioningStatus struct {
	ProvisioningStatus
}

func DoSyncServiceToCluster

func DoSyncServiceToCluster(deployContext *DeployContext, specService *corev1.Service) ServiceProvisioningStatus

func SyncServiceToCluster

func SyncServiceToCluster(
	deployContext *DeployContext,
	name string,
	portName []string,
	portNumber []int32,
	component string) ServiceProvisioningStatus

Jump to

Keyboard shortcuts

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