Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: helmcharts to deploy Eclipse Che #1184

Merged
merged 4 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/bin/check-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# - next olm bundle
# - Dockerfile & operator.yaml
# - DW resources
# - Helm charts

set -e

Expand Down Expand Up @@ -136,6 +137,19 @@ checkRoles() {
fi
}

checkHelmCharts() {
changedFiles=(
$(git diff --name-only)
)
if [[ " ${changedFiles[*]} " =~ helmcharts ]]; then
echo "[ERROR] Helm Charts are not up to date"
echo "[ERROR] Run 'make update-resources -s' to update them."
exit 1
else
echo "[INFO] Helm Charts are up to date."
fi
}

installOperatorSDK

pushd "${ROOT_PROJECT_DIR}" || true
Expand All @@ -146,6 +160,7 @@ checkRoles
checkNextOlmBundle
checkDockerfile
checkOperatorYaml
checkHelmCharts

popd || true

Expand Down
30 changes: 29 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ get-next-version-increment:
echo "$${incrementPart}"

update-resources: SHELL := /bin/bash
update-resources: check-requirements update-resource-images update-roles
update-resources: check-requirements update-resource-images update-roles update-helmcharts
for platform in 'openshift' 'kubernetes'
do
for channel in 'next-all-namespaces' 'next'
Expand All @@ -792,6 +792,34 @@ update-resources: check-requirements update-resource-images update-roles
done
done

update-helmcharts: add-license-download check-requirements update-resource-images update-roles
HELMCHARTS_TEMPLATES="helmcharts/templates"
HELMCHARTS_CRDS="helmcharts/crds"

cp config/manager/manager.yaml $${HELMCHARTS_TEMPLATES}
cp config/rbac/cluster_role.yaml $${HELMCHARTS_TEMPLATES}
cp config/rbac/cluster_rolebinding.yaml $${HELMCHARTS_TEMPLATES}
cp config/rbac/service_account.yaml $${HELMCHARTS_TEMPLATES}
cp config/rbac/role.yaml $${HELMCHARTS_TEMPLATES}
cp config/rbac/role_binding.yaml $${HELMCHARTS_TEMPLATES}
cp config/samples/org.eclipse.che_v1_checluster.yaml $${HELMCHARTS_TEMPLATES}

cp config/crd/bases/org_v1_che_crd.yaml $${HELMCHARTS_CRDS}
cp config/crd/bases/org.eclipse.che_chebackupserverconfigurations_crd.yaml $${HELMCHARTS_CRDS}
cp config/crd/bases/org.eclipse.che_checlusterbackups_crd.yaml $${HELMCHARTS_CRDS}
cp config/crd/bases/org.eclipse.che_checlusterrestores_crd.yaml $${HELMCHARTS_CRDS}

## Set references to values
yq -riY ".spec.k8s.ingressDomain |= \"{{ .Values.k8s.ingressDomain }}\"" $${HELMCHARTS_TEMPLATES}/org.eclipse.che_v1_checluster.yaml

yq -riY '.metadata.namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/manager.yaml
yq -riY '.metadata.namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/service_account.yaml
yq -riY '.metadata.namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/role.yaml
yq -riY '.metadata.namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/role_binding.yaml
yq -riY '.metadata.namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/org.eclipse.che_v1_checluster.yaml
yq -riY '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${HELMCHARTS_TEMPLATES}/cluster_rolebinding.yaml

$(MAKE) add-license $$(find ./helmcharts -name "*.yaml")
check-requirements:
. olm/check-yq.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.40.0-377.next-all-namespaces
name: eclipse-che-preview-openshift.v7.40.0-378.next-all-namespaces
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1439,4 +1439,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.40.0-377.next-all-namespaces
version: 7.40.0-378.next-all-namespaces
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-kubernetes.v7.40.0-377.next
name: eclipse-che-preview-kubernetes.v7.40.0-378.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1406,4 +1406,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.40.0-377.next
version: 7.40.0-378.next
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.40.0-377.next
name: eclipse-che-preview-openshift.v7.40.0-378.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1439,4 +1439,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.40.0-377.next
version: 7.40.0-378.next
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: checlusterrestores.org.eclipse.che
spec:
group: org.eclipse.che
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: che-operator
namespace: system
namespace: eclipse-che
labels:
app: che-operator
app.kubernetes.io/name: che
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/cluster_rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: che-operator
# namespace: eclipse-che
namespace: eclipse-che
roleRef:
kind: ClusterRole
name: che-operator
Expand Down
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: che-operator
app.kubernetes.io/instance: che
Expand Down
16 changes: 16 additions & 0 deletions helmcharts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2019-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
#

apiVersion: v1
description: A Helm chart for deploying Eclipse Che on a Kubernetes
name: che
version: 1.0.0
29 changes: 29 additions & 0 deletions helmcharts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Eclipse Che Helm Charts

- [Charts](#charts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me none of the headlines was clear. Maybe we should have:
Title
- Prerequisites (K8s & Helm versions)
- Installation

- [Prerequisites](#prerequisites)
- [Installation](#installation)


## Charts

Helm charts to deploy [Eclipse Che](https://www.eclipse.org/che/)

### Prerequisites

* Minimal Kubernetes version is 1.19
* Minimal Helm version is 3.2.2

### Installation

Create a Namespace and install the Helm Charts for Eclipse Che Operator.

```
NAMESPACE=eclipse-che
DOMAIN=<KUBERNETES_CLUSTER_DOMAIN>

kubectl create namespace $NAMESPACE

# Install charts
helm install che --set k8s.ingressDomain=$DOMAIN --namespace $NAMESPACE .
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#
# Copyright (c) 2019-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
#

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: chebackupserverconfigurations.org.eclipse.che
spec:
group: org.eclipse.che
names:
kind: CheBackupServerConfiguration
listKind: CheBackupServerConfigurationList
plural: chebackupserverconfigurations
singular: chebackupserverconfiguration
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: The `CheBackupServerConfiguration` custom resource allows defining
and managing Eclipse Che Backup Server Configurations
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource
this object represents. Servers may infer this from the endpoint the
client submits requests to. Cannot be updated. In CamelCase. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CheBackupServerConfigurationSpec defines the desired state
of CheBackupServerConfiguration Only one type of backup server is
allowed to be configured per CR.
properties:
awss3:
description: Amazon S3 or compatible alternatives.
properties:
awsAccessKeySecretRef:
description: Reference to secret that contains awsAccessKeyId
and awsSecretAccessKey keys.
type: string
hostname:
description: Server hostname, defaults to 's3.amazonaws.com'.
Might be customized in case of alternative server.
type: string
port:
description: Backup server port. Usually default value is used.
Might be customized in case of alternative server.
type: integer
protocol:
description: Protocol to use when connection to the server.
Might be customized in case of alternative server.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Bucket name and repository, e.g. bucket/repo
type: string
required:
- awsAccessKeySecretRef
- repositoryPasswordSecretRef
- repositoryPath
type: object
rest:
description: Rest backup server configuration.
properties:
credentialsSecretRef:
description: Secret that contains username and password fields
to login into restic server. Note, each repository is encrypted
with own password. See ResticRepoPasswordSecretRef field.
type: string
hostname:
description: Backup server host
type: string
port:
description: Backup server port
type: integer
protocol:
description: Protocol to use when connection to the server Defaults
to https.
type: string
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Restic repository path
type: string
required:
- hostname
- repositoryPasswordSecretRef
type: object
sftp:
description: Sftp backup server configuration.
properties:
hostname:
description: Backup server host
type: string
port:
description: Backup server port
type: integer
repositoryPasswordSecretRef:
description: Holds reference to a secret with restic repository
password under 'repo-password' field to encrypt / decrypt
its content.
type: string
repositoryPath:
description: Restic repository path, relative or absolute, e.g.
/srv/repo
type: string
sshKeySecretRef:
description: Private ssh key under 'ssh-privatekey' field for
passwordless login
type: string
username:
description: User login on the remote server
type: string
required:
- hostname
- repositoryPasswordSecretRef
- repositoryPath
- sshKeySecretRef
- username
type: object
type: object
status:
description: CheBackupServerConfigurationStatus defines the observed
state of CheBackupServerConfiguration
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading