Documentation ¶
Index ¶
- Constants
- Variables
- func AppendFinalizer(deployContext *chetypes.DeployContext, finalizer string) error
- func CleanUpAllFinalizers(ctx *chetypes.DeployContext) error
- func ConfigureProxy(deployContext *chetypes.DeployContext, transport *http.Transport)
- func CreateIgnoreIfExists(deployContext *chetypes.DeployContext, blueprint client.Object) (bool, error)
- func Delete(deployContext *chetypes.DeployContext, key client.ObjectKey, ...) (bool, error)
- func DeleteByKeyWithClient(cli client.Client, key client.ObjectKey, objectMeta client.Object) (bool, error)
- func DeleteClusterObject(deployContext *chetypes.DeployContext, name string, objectMeta client.Object) (bool, error)
- func DeleteFinalizer(deployContext *chetypes.DeployContext, finalizer string) error
- func DeleteIgnoreIfNotFound(context context.Context, cli client.Client, key client.ObjectKey, ...) error
- func DeleteNamespacedObject(deployContext *chetypes.DeployContext, name string, objectMeta client.Object) (bool, error)
- func DeleteObjectWithFinalizer(deployContext *chetypes.DeployContext, key client.ObjectKey, ...) error
- func EnsurePodSecurityStandards(deployment *appsv1.Deployment, userId int64, groupId int64)
- func FindCheClusterCRInNamespace(cl client.Client, namespace string) (*chev2.CheCluster, error)
- func GenerateProxyJavaOpts(proxy *chetypes.Proxy, noProxy string) (javaOpts string, err error)
- func Get(deployContext *chetypes.DeployContext, key client.ObjectKey, ...) (bool, error)
- func GetClusterObject(deployContext *chetypes.DeployContext, name string, actual client.Object) (bool, error)
- func GetConfigMapSpec(deployContext *chetypes.DeployContext, name string, data map[string]string, ...) *corev1.ConfigMap
- func GetForClient(cli client.Client, key client.ObjectKey, actual client.Object) (bool, error)
- func GetIngressSpec(deployContext *chetypes.DeployContext, name string, path string, ...) (ingressUrl string, i *networking.Ingress)
- func GetLabels(component string) map[string]string
- func GetLabelsAndSelector(component string) (map[string]string, map[string]string)
- func GetLegacyLabels(component string) map[string]string
- func GetManagedByLabel() string
- func GetNamespacedObject(deployContext *chetypes.DeployContext, name string, actual client.Object) (bool, error)
- func GetObjectType(obj interface{}) string
- func GetRouteSpec(deployContext *chetypes.DeployContext, name string, path string, ...) (*routev1.Route, error)
- func GetSecretSpec(name string, namespace string, data map[string][]byte) *corev1.Secret
- func GetSecrets(deployContext *chetypes.DeployContext, labels map[string]string, ...) ([]corev1.Secret, error)
- func GetServiceSpec(deployContext *chetypes.DeployContext, name string, portName []string, ...) *corev1.Service
- func IsPartOfEclipseCheResourceAndManagedByOperator(labels map[string]string) bool
- func MergeNonProxy(noProxy1 string, noProxy2 string) string
- func MountConfigMaps(specDeployment *appsv1.Deployment, deployContext *chetypes.DeployContext) error
- func MountSecrets(specDeployment *appsv1.Deployment, deployContext *chetypes.DeployContext) error
- func OverrideContainer(namespace string, container *corev1.Container, ...) error
- func OverrideDeployment(ctx *chetypes.DeployContext, deployment *appsv1.Deployment, ...) error
- func ReadCheClusterProxyConfiguration(ctx *chetypes.DeployContext) (*chetypes.Proxy, error)
- func ReadClusterWideProxyConfiguration(clusterProxy *configv1.Proxy) (*chetypes.Proxy, error)
- func ReloadCheClusterCR(deployContext *chetypes.DeployContext) error
- func SetStatusDetails(deployContext *chetypes.DeployContext, reason string, message string) (err error)
- func Sync(deployContext *chetypes.DeployContext, blueprint client.Object, ...) (bool, error)
- func SyncClusterRoleBindingToCluster(deployContext *chetypes.DeployContext, name string, serviceAccountName string, ...) (bool, error)
- func SyncClusterRoleToCluster(deployContext *chetypes.DeployContext, name string, ...) (bool, error)
- func SyncConfigMapDataToCluster(deployContext *chetypes.DeployContext, name string, data map[string]string, ...) (bool, error)
- func SyncConfigMapSpecToCluster(deployContext *chetypes.DeployContext, configMapSpec *corev1.ConfigMap) (bool, error)
- func SyncDeploymentSpecToCluster(deployContext *chetypes.DeployContext, deploymentSpec *appsv1.Deployment, ...) (bool, error)
- func SyncForClient(cli client.Client, deployContext *chetypes.DeployContext, ...) (bool, error)
- func SyncIngressToCluster(deployContext *chetypes.DeployContext, name string, path string, ...) (endpointUrl string, done bool, err error)
- func SyncJobToCluster(deployContext *chetypes.DeployContext, name string, component string, ...) (bool, error)
- func SyncRoleBindingToCluster(deployContext *chetypes.DeployContext, name string, serviceAccountName string, ...) (bool, error)
- func SyncRoleToCluster(deployContext *chetypes.DeployContext, name string, ...) (bool, error)
- func SyncRouteToCluster(deployContext *chetypes.DeployContext, name string, path string, ...) (bool, error)
- func SyncSecretToCluster(deployContext *chetypes.DeployContext, name string, namespace string, ...) (bool, error)
- func SyncServiceAccountToCluster(deployContext *chetypes.DeployContext, name string) (bool, error)
- func SyncServiceSpecToCluster(deployContext *chetypes.DeployContext, serviceSpec *corev1.Service) (bool, error)
- func SyncServiceToCluster(deployContext *chetypes.DeployContext, name string, portName []string, ...) (bool, error)
- func UpdateCheCRStatus(deployContext *chetypes.DeployContext, field string, value string) (err error)
- type Reconcilable
- type ReconcileManager
Constants ¶
const (
CheServiceName = "che-host"
)
const Finalizer = "cluster-resources." + constants.FinalizerSuffix
Variables ¶
var ClusterRoleBindingDiffOpts = cmp.Options{ cmpopts.IgnoreFields(rbac.ClusterRoleBinding{}, "TypeMeta", "ObjectMeta"), }
var ClusterRoleDiffOpts = cmp.Options{ cmpopts.IgnoreFields(rbac.ClusterRole{}, "TypeMeta", "ObjectMeta"), }
var ConfigMapDiffOpts = cmp.Options{ cmpopts.IgnoreFields(corev1.ConfigMap{}, "TypeMeta"), cmp.Comparer(func(x, y metav1.ObjectMeta) bool { return reflect.DeepEqual(x.Labels, y.Labels) }), }
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", "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 }), }
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",
}
)
var RollBindingDiffOpts = cmp.Options{ cmpopts.IgnoreFields(rbac.RoleBinding{}, "TypeMeta", "ObjectMeta"), }
var SecretDiffOpts = cmp.Options{ cmpopts.IgnoreFields(corev1.Secret{}, "TypeMeta", "ObjectMeta"), }
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(deployContext *chetypes.DeployContext, finalizer string) error
func CleanUpAllFinalizers ¶
func CleanUpAllFinalizers(ctx *chetypes.DeployContext) error
func ConfigureProxy ¶
func ConfigureProxy(deployContext *chetypes.DeployContext, transport *http.Transport)
ConfigureProxy adds existing proxy configuration into provided transport object.
func CreateIgnoreIfExists ¶
func CreateIgnoreIfExists(deployContext *chetypes.DeployContext, blueprint client.Object) (bool, error)
CreateIgnoreIfExists creates object. Return true if a new object is created or object already exists, otherwise returns false. Throws error if object cannot be created otherwise returns nil.
func Delete ¶
func Delete(deployContext *chetypes.DeployContext, key client.ObjectKey, objectMeta client.Object) (bool, error)
Deletes object. Returns true if object deleted or not found otherwise returns false.
func DeleteByKeyWithClient ¶
func DeleteClusterObject ¶
func DeleteFinalizer ¶
func DeleteFinalizer(deployContext *chetypes.DeployContext, finalizer string) error
func DeleteIgnoreIfNotFound ¶
func DeleteIgnoreIfNotFound( context context.Context, cli client.Client, key client.ObjectKey, blueprint client.Object, ) error
DeleteIgnoreIfNotFound deletes object. Returns nil if object deleted or not found otherwise returns error. Return error if object cannot be deleted otherwise returns nil.
func DeleteNamespacedObject ¶
func EnsurePodSecurityStandards ¶
func EnsurePodSecurityStandards(deployment *appsv1.Deployment, userId int64, groupId int64)
EnsurePodSecurityStandards sets SecurityContext accordingly to standards https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
func FindCheClusterCRInNamespace ¶
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 ¶
GenerateProxyJavaOpts converts given proxy configuration into Java format.
func Get ¶
func Get(deployContext *chetypes.DeployContext, key client.ObjectKey, actual client.Object) (bool, error)
Get gets object. Returns true if object exists otherwise returns false. Returns error if object cannot be retrieved otherwise returns nil.
func GetClusterObject ¶
func GetClusterObject(deployContext *chetypes.DeployContext, name string, actual client.Object) (bool, error)
Gets cluster scope object by name Returns true if object exists otherwise returns false
func GetConfigMapSpec ¶
func GetForClient ¶
Get gets object. Returns true if object exists otherwise returns false. Returns error if object cannot be retrieved otherwise returns nil.
func GetIngressSpec ¶
func GetIngressSpec( deployContext *chetypes.DeployContext, name string, path string, serviceName string, servicePort int, 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 GetLabelsAndSelector ¶
func GetLegacyLabels ¶
func GetManagedByLabel ¶
func GetManagedByLabel() string
func GetNamespacedObject ¶
func GetNamespacedObject(deployContext *chetypes.DeployContext, name string, actual client.Object) (bool, error)
Gets namespaced scope object by name Returns true if object exists otherwise returns false.
func GetObjectType ¶
func GetObjectType(obj interface{}) string
func GetRouteSpec ¶
func GetRouteSpec( deployContext *chetypes.DeployContext, 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 ¶
GetSecretSpec return default secret config for given data
func GetSecrets ¶
func GetSecrets(deployContext *chetypes.DeployContext, labels map[string]string, annotations map[string]string) ([]corev1.Secret, error)
Get all secrets by labels and annotations
func GetServiceSpec ¶
func MergeNonProxy ¶
func MountConfigMaps ¶
func MountConfigMaps(specDeployment *appsv1.Deployment, deployContext *chetypes.DeployContext) 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, deployContext *chetypes.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 OverrideContainer ¶
func OverrideDeployment ¶
func OverrideDeployment( ctx *chetypes.DeployContext, deployment *appsv1.Deployment, overrideDeploymentSettings *chev2.Deployment) error
OverrideDeployment with custom settings
func ReadCheClusterProxyConfiguration ¶
func ReadCheClusterProxyConfiguration(ctx *chetypes.DeployContext) (*chetypes.Proxy, error)
func ReloadCheClusterCR ¶
func ReloadCheClusterCR(deployContext *chetypes.DeployContext) error
func SetStatusDetails ¶
func SetStatusDetails(deployContext *chetypes.DeployContext, reason string, message string) (err error)
func Sync ¶
func Sync(deployContext *chetypes.DeployContext, blueprint client.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 object is up-to-date otherwise returns false
func SyncClusterRoleToCluster ¶
func SyncClusterRoleToCluster( deployContext *chetypes.DeployContext, name string, policyRule []rbac.PolicyRule) (bool, error)
func SyncDeploymentSpecToCluster ¶
func SyncDeploymentSpecToCluster( deployContext *chetypes.DeployContext, deploymentSpec *appsv1.Deployment, deploymentDiffOpts cmp.Options) (bool, error)
func SyncForClient ¶
func SyncIngressToCluster ¶
func SyncIngressToCluster( deployContext *chetypes.DeployContext, name string, path string, serviceName string, servicePort int, component string) (endpointUrl string, done bool, err error)
SyncIngressToCluster creates ingress to expose service with the set settings host and path are evaluated if they are empty
func SyncJobToCluster ¶
func SyncRoleToCluster ¶
func SyncRoleToCluster( deployContext *chetypes.DeployContext, name string, policyRule []rbac.PolicyRule) (bool, error)
func SyncRouteToCluster ¶
func SyncSecretToCluster ¶
func SyncSecretToCluster( deployContext *chetypes.DeployContext, name string, namespace string, data map[string][]byte) (bool, error)
SyncSecret applies secret into cluster or external namespace
func SyncServiceAccountToCluster ¶
func SyncServiceAccountToCluster(deployContext *chetypes.DeployContext, name string) (bool, error)
func SyncServiceToCluster ¶
func UpdateCheCRStatus ¶
func UpdateCheCRStatus(deployContext *chetypes.DeployContext, field string, value string) (err error)
Types ¶
type Reconcilable ¶
type Reconcilable interface { // Reconcile object. Reconcile(ctx *chetypes.DeployContext) (result reconcile.Result, done bool, err error) // Does finalization (removes cluster scope objects, etc) Finalize(ctx *chetypes.DeployContext) (done bool) }
type ReconcileManager ¶
type ReconcileManager struct {
// contains filtered or unexported fields
}
func NewReconcileManager ¶
func NewReconcileManager() *ReconcileManager
func (*ReconcileManager) FinalizeAll ¶
func (manager *ReconcileManager) FinalizeAll(ctx *chetypes.DeployContext) (done bool)
func (*ReconcileManager) ReconcileAll ¶
func (manager *ReconcileManager) ReconcileAll(ctx *chetypes.DeployContext) (reconcile.Result, bool, error)
ReconcileAll reconciles all objects in an order they have been added. If reconciliation failed then CheCluster status will be updated accordingly.
func (*ReconcileManager) RegisterReconciler ¶
func (manager *ReconcileManager) RegisterReconciler(reconciler Reconcilable)