diff --git a/.gitignore b/.gitignore index 52a8ff81..4acd69ad 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ vault.init super-linter.log /archive +ocp-connection.txt diff --git a/charts/hub/devspaces/.helmignore b/charts/hub/devspaces/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/hub/devspaces/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/hub/devspaces/Chart.yaml b/charts/hub/devspaces/Chart.yaml new file mode 100644 index 00000000..e04893f7 --- /dev/null +++ b/charts/hub/devspaces/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: devspaces +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/charts/hub/devspaces/templates/_helpers.tpl b/charts/hub/devspaces/templates/_helpers.tpl new file mode 100644 index 00000000..dbb9600f --- /dev/null +++ b/charts/hub/devspaces/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "devspaces.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "devspaces.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "devspaces.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "devspaces.labels" -}} +helm.sh/chart: {{ include "devspaces.chart" . }} +{{ include "devspaces.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "devspaces.selectorLabels" -}} +app.kubernetes.io/name: {{ include "devspaces.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "devspaces.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "devspaces.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/hub/devspaces/templates/devspaces-instance.yaml b/charts/hub/devspaces/templates/devspaces-instance.yaml new file mode 100644 index 00000000..276282a3 --- /dev/null +++ b/charts/hub/devspaces/templates/devspaces-instance.yaml @@ -0,0 +1,43 @@ +apiVersion: org.eclipse.che/v2 +kind: CheCluster +metadata: + name: devspaces + labels: + {{- include "devspaces.labels" . | nindent 4 }} +spec: + devEnvironments: + defaultEditor: che-incubator/che-code/insiders + defaultNamespace: + template: -devspaces + secondsOfInactivityBeforeIdling: -1 + secondsOfRunBeforeIdling: -1 + storage: + pvcStrategy: per-user + components: + cheServer: + debug: false + logLevel: INFO + dashboard: {} + database: + credentialsSecretName: postgres-credentials + externalDb: false + postgresDb: dbche + postgresHostName: postgres + postgresPort: "5432" + pvc: + claimSize: 1Gi + devWorkspace: {} + devfileRegistry: {} + imagePuller: + enable: false + spec: {} + metrics: + enable: true + pluginRegistry: {} + containerRegistry: {} + networking: + auth: + gateway: + configLabels: + app: che + component: che-gateway-config diff --git a/charts/hub/devspaces/templates/git-oauth-credentials-external-secret.yaml b/charts/hub/devspaces/templates/git-oauth-credentials-external-secret.yaml new file mode 100644 index 00000000..6b6db60f --- /dev/null +++ b/charts/hub/devspaces/templates/git-oauth-credentials-external-secret.yaml @@ -0,0 +1,36 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: git-oauth-credentials + labels: + {{- include "devspaces.labels" . | nindent 4 }} +spec: + refreshInterval: 1h + secretStoreRef: + name: {{ $.Values.secretStore.name }} + kind: {{ $.Values.secretStore.kind }} + target: + name: github-oauth-config + creationPolicy: Owner + template: + metadata: + labels: + app.kubernetes.io/part-of: che.eclipse.org + app.kubernetes.io/component: oauth-scm-configuration + annotations: + che.eclipse.org/oauth-scm-server: github + che.eclipse.org/scm-server-endpoint: https://github.com + data: + id: "{{ "{{" }} .clientID {{ "}}" }}" + secret: "{{ "{{" }} .clientSecret {{ "}}" }}" + data: + - secretKey: clientID + remoteRef: + key: secret/data/hub/github-devspaces + #version: provider-key-version + property: client-id + - secretKey: clientSecret + remoteRef: + key: secret/data/hub/github-devspaces + #version: provider-key-version + property: client-secret diff --git a/charts/hub/devspaces/values.yaml b/charts/hub/devspaces/values.yaml new file mode 100644 index 00000000..bd9b7009 --- /dev/null +++ b/charts/hub/devspaces/values.yaml @@ -0,0 +1,3 @@ +secretStore: + name: vault-backend + kind: ClusterSecretStore \ No newline at end of file diff --git a/values-hub.yaml b/values-hub.yaml index a34db075..bf166170 100644 --- a/values-hub.yaml +++ b/values-hub.yaml @@ -15,6 +15,7 @@ clusterGroup: - devsecops-ci - openshift-storage - quay-enterprise + - openshift-devspaces # subscriptions: OpenShift Operator subscriptions from OLM/OperatorHub # - name: the Operator package name (required) @@ -44,6 +45,11 @@ clusterGroup: namespace: openshift-operators channel: stable-3.7 + devspaces: + name: devspaces + namespace: openshift-operators + channel: stable + # The following section is used by # OpenShift GitOps (ArgoCD) # Projects are just ArgoCD groupings that can be filtered on. @@ -51,6 +57,7 @@ clusterGroup: - hub - opp - external-secrets + - devspaces applications: acm: @@ -123,6 +130,12 @@ clusterGroup: project: hub path: charts/hub/cli-tools + devspaces: + name: devspaces + namespace: openshift-devspaces + project: devspaces + path: charts/hub/devspaces + imperative: # NOTE: We *must* use lists and not hashes. As hashes lose ordering once parsed by helm # The default schedule is every 10 minutes: imperative.schedule