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) 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) 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
- Variables
- func Add(mgr manager.Manager) error
- func EvaluateCheServerVersion(cr *orgv1.CheCluster) string
- func GetOpenshiftOAuth(runtimeClient client.Client) (*oauthv1.OAuth, error)
- func ValidateCheCR(checluster *orgv1.CheCluster, isOpenshift bool) error
- type K8sApiPermissionChecker
- type OpenShiftOAuthUserHandler
- type OpenShiftOAuthUserOperatorHandler
- type PermissionChecker
- type ReconcileChe
- func (r *ReconcileChe) DeleteOAuthFinalizer(instance *orgv1.CheCluster) (err error)
- func (r *ReconcileChe) DeleteWorkspacesInSameNamespaceWithChePermissions(instance *orgv1.CheCluster, cli client.Client) error
- func (r *ReconcileChe) GenerateAndSaveFields(deployContext *deploy.DeployContext, request reconcile.Request) (err error)
- func (r *ReconcileChe) GetCR(request reconcile.Request) (instance *orgv1.CheCluster, err error)
- func (r *ReconcileChe) GetEffectiveDeployment(instance *orgv1.CheCluster, name string) (deployment *appsv1.Deployment, err error)
- func (r *ReconcileChe) GetOAuthClient(oAuthClientName string) (oAuthClient *oauth.OAuthClient, err error)
- func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, error)
- func (r *ReconcileChe) ReconcileCheWorkspacesClusterPermissionsFinalizer(instance *orgv1.CheCluster) (err error)
- func (r *ReconcileChe) ReconcileFinalizer(instance *orgv1.CheCluster) (err error)
- func (r *ReconcileChe) ReconcileIdentityProvider(instance *orgv1.CheCluster, isOpenShift4 bool) (deleted bool, err error)
- func (r *ReconcileChe) RemoveCheWorkspacesClusterPermissions(instance *orgv1.CheCluster) (err error)
- func (r *ReconcileChe) SetCheAvailableStatus(instance *orgv1.CheCluster, request reconcile.Request, protocol string, ...) (err error)
- func (r *ReconcileChe) SetCheRollingUpdateStatus(instance *orgv1.CheCluster, request reconcile.Request) (err error)
- func (r *ReconcileChe) SetCheUnavailableStatus(instance *orgv1.CheCluster, request reconcile.Request) (err error)
- func (r *ReconcileChe) SetStatusDetails(instance *orgv1.CheCluster, request reconcile.Request, reason string, ...) (err error)
- func (r *ReconcileChe) UpdateCheCRSpec(instance *orgv1.CheCluster, updatedField string, value string) (err error)
- func (r *ReconcileChe) UpdateCheCRSpecByFields(instance *orgv1.CheCluster, fields map[string]string) (err error)
- func (r *ReconcileChe) UpdateCheCRStatus(instance *orgv1.CheCluster, updatedField string, value string) (err error)
Constants ¶
const ( AvailableStatus = "Available" RollingUpdateInProgressStatus = "Available: Rolling update in progress" )
const ( // EditClusterRoleName - default "edit" cluster role. This role is pre-created on the cluster. // See more: https://kubernetes.io/blog/2017/10/using-rbac-generally-available-18/#granting-access-to-users EditClusterRoleName = "edit" // EditRoleBindingName - "edit" rolebinding for che-server. EditRoleBindingName = "che" // CheWorkspacesServiceAccount - service account created for Che workspaces. CheWorkspacesServiceAccount = "che-workspace" // ViewRoleBindingName - "view" role for "che-workspace" service account. ViewRoleBindingName = "che-workspace-view" // ExecRoleBindingName - "exec" role for "che-workspace" service account. ExecRoleBindingName = "che-workspace-exec" // CheWorkspacesNamespaceClusterRoleNameTemplate - manage namespaces "cluster role" and "clusterrolebinding" template name CheWorkspacesNamespaceClusterRoleNameTemplate = "%s-cheworkspaces-namespaces-clusterrole" // CheWorkspacesClusterRoleNameTemplate - manage workspaces "cluster role" and "clusterrolebinding" template name CheWorkspacesClusterRoleNameTemplate = "%s-cheworkspaces-clusterrole" )
const (
AddIdentityProviderMessage = "Openshift oAuth was disabled. How to add identity provider read in the Help Link:"
)
Variables ¶
var (
// CheServiceAccountName - service account name for che-server.
CheServiceAccountName = "che"
)
Functions ¶
func Add ¶
Add creates a new CheCluster Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.
func EvaluateCheServerVersion ¶
func EvaluateCheServerVersion(cr *orgv1.CheCluster) string
EvaluateCheServerVersion evaluate che version based on Checluster information and image defaults from env variables
func GetOpenshiftOAuth ¶
GetOpenshiftOAuth returns Openshift oAuth object.
func ValidateCheCR ¶
func ValidateCheCR(checluster *orgv1.CheCluster, isOpenshift bool) error
ValidateCheCR checks Che CR configuration. It should detect: - configurations which miss required field(s) to deploy Che - self-contradictory configurations - configurations with which it is impossible to deploy Che
Types ¶
type K8sApiPermissionChecker ¶
type K8sApiPermissionChecker struct {
}
func (*K8sApiPermissionChecker) GetNotPermittedPolicyRules ¶
func (pc *K8sApiPermissionChecker) GetNotPermittedPolicyRules(policies []rbac.PolicyRule, namespace string) ([]rbac.PolicyRule, error)
type OpenShiftOAuthUserHandler ¶
type OpenShiftOAuthUserHandler interface {
SyncOAuthInitialUser(openshiftOAuth *oauthv1.OAuth, deployContext *deploy.DeployContext) (bool, error)
DeleteOAuthInitialUser(deployContext *deploy.DeployContext) error
}
OpenShiftOAuthUserHandler - handler to create or delete new Openshift oAuth user.
func NewOpenShiftOAuthUserHandler ¶
func NewOpenShiftOAuthUserHandler(runtimeClient client.Client) OpenShiftOAuthUserHandler
NewOpenShiftOAuthUserHandler - create new OpenShiftOAuthUserHandler instance
type OpenShiftOAuthUserOperatorHandler ¶
type OpenShiftOAuthUserOperatorHandler struct {
OpenShiftOAuthUserHandler
// contains filtered or unexported fields
}
OpenShiftOAuthUserOperatorHandler - OpenShiftOAuthUserHandler implementation.
func (*OpenShiftOAuthUserOperatorHandler) DeleteOAuthInitialUser ¶
func (iuh *OpenShiftOAuthUserOperatorHandler) DeleteOAuthInitialUser(deployContext *deploy.DeployContext) error
DeleteOAuthInitialUser - removes initial user, htpasswd provider, htpasswd secret and Che secret with username and password.
func (*OpenShiftOAuthUserOperatorHandler) SyncOAuthInitialUser ¶
func (iuh *OpenShiftOAuthUserOperatorHandler) SyncOAuthInitialUser(openshiftOAuth *oauthv1.OAuth, deployContext *deploy.DeployContext) (bool, error)
SyncOAuthInitialUser - creates new htpasswd provider with inital user with Che flavor name if Openshift cluster hasn't got identity providers, otherwise do nothing. It usefull for good first user expirience. User can't use kube:admin or system:admin user in the Openshift oAuth. That's why we provide initial user for good first meeting with Eclipse Che.
type PermissionChecker ¶
type PermissionChecker interface {
GetNotPermittedPolicyRules(policies []rbac.PolicyRule, namespace string) ([]rbac.PolicyRule, error)
}
type ReconcileChe ¶
type ReconcileChe struct {
// contains filtered or unexported fields
}
ReconcileChe reconciles a CheCluster object
func (*ReconcileChe) DeleteOAuthFinalizer ¶
func (r *ReconcileChe) DeleteOAuthFinalizer(instance *orgv1.CheCluster) (err error)
func (*ReconcileChe) DeleteWorkspacesInSameNamespaceWithChePermissions ¶
func (r *ReconcileChe) DeleteWorkspacesInSameNamespaceWithChePermissions(instance *orgv1.CheCluster, cli client.Client) error
DeleteWorkspacesInSameNamespaceWithChePermissions - removes workspaces in same namespace with Che role and rolebindings.
func (*ReconcileChe) GenerateAndSaveFields ¶
func (r *ReconcileChe) GenerateAndSaveFields(deployContext *deploy.DeployContext, request reconcile.Request) (err error)
func (*ReconcileChe) GetCR ¶
func (r *ReconcileChe) GetCR(request reconcile.Request) (instance *orgv1.CheCluster, err error)
func (*ReconcileChe) GetEffectiveDeployment ¶
func (r *ReconcileChe) GetEffectiveDeployment(instance *orgv1.CheCluster, name string) (deployment *appsv1.Deployment, err error)
func (*ReconcileChe) GetOAuthClient ¶
func (r *ReconcileChe) GetOAuthClient(oAuthClientName string) (oAuthClient *oauth.OAuthClient, err error)
func (*ReconcileChe) Reconcile ¶
Reconcile reads that state of the cluster for a CheCluster object and makes changes based on the state read and what is in the CheCluster.Spec. The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
func (*ReconcileChe) ReconcileCheWorkspacesClusterPermissionsFinalizer ¶
func (r *ReconcileChe) ReconcileCheWorkspacesClusterPermissionsFinalizer(instance *orgv1.CheCluster) (err error)
func (*ReconcileChe) ReconcileFinalizer ¶
func (r *ReconcileChe) ReconcileFinalizer(instance *orgv1.CheCluster) (err error)
func (*ReconcileChe) ReconcileIdentityProvider ¶
func (r *ReconcileChe) ReconcileIdentityProvider(instance *orgv1.CheCluster, isOpenShift4 bool) (deleted bool, err error)
func (*ReconcileChe) RemoveCheWorkspacesClusterPermissions ¶
func (r *ReconcileChe) RemoveCheWorkspacesClusterPermissions(instance *orgv1.CheCluster) (err error)
func (*ReconcileChe) SetCheAvailableStatus ¶
func (r *ReconcileChe) SetCheAvailableStatus(instance *orgv1.CheCluster, request reconcile.Request, protocol string, cheHost string) (err error)
func (*ReconcileChe) SetCheRollingUpdateStatus ¶
func (r *ReconcileChe) SetCheRollingUpdateStatus(instance *orgv1.CheCluster, request reconcile.Request) (err error)
func (*ReconcileChe) SetCheUnavailableStatus ¶
func (r *ReconcileChe) SetCheUnavailableStatus(instance *orgv1.CheCluster, request reconcile.Request) (err error)
func (*ReconcileChe) SetStatusDetails ¶
func (r *ReconcileChe) SetStatusDetails(instance *orgv1.CheCluster, request reconcile.Request, reason string, message string, helpLink string) (err error)
func (*ReconcileChe) UpdateCheCRSpec ¶
func (r *ReconcileChe) UpdateCheCRSpec(instance *orgv1.CheCluster, updatedField string, value string) (err error)
UpdateCheCRSpec - updates Che CR "spec" by field
func (*ReconcileChe) UpdateCheCRSpecByFields ¶
func (r *ReconcileChe) UpdateCheCRSpecByFields(instance *orgv1.CheCluster, fields map[string]string) (err error)
UpdateCheCRSpecByFields - updates Che CR "spec" fields by field map
func (*ReconcileChe) UpdateCheCRStatus ¶
func (r *ReconcileChe) UpdateCheCRStatus(instance *orgv1.CheCluster, updatedField string, value string) (err error)