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: Add ability to set up Che workspace and Postgres pvc class names using arguments. #461

Merged
merged 2 commits into from
Jan 16, 2020
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,15 @@ OPTIONS
--plugin-registry-url=plugin-registry-url
The URL of the external plugin registry.

--postgres-pvc-storage-class-name=postgres-pvc-storage-class-name
persistent volume storage class name to use to store Eclipse Che Postgres database

--self-signed-cert
Authorize usage of self signed certificates for encryption. Note that `self-signed-cert` secret with CA certificate
must be created in the configured namespace.

--workspace-pvc-storage-class-name=workspace-pvc-storage-class-name
persistent volume(s) storage class name to use to store Eclipse Che workspaces data
```

_See code: [src/commands/server/start.ts](https://github.com/che-incubator/chectl/blob/v0.0.2/src/commands/server/start.ts)_
Expand Down
7 changes: 5 additions & 2 deletions src/api/kube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,17 +964,20 @@ export class KubeHelper {
}
yamlCr.spec.server.selfSignedCert = flags['self-signed-cert']
yamlCr.spec.k8s.ingressDomain = flags.domain
let pluginRegistryUrl = flags['plugin-registry-url']
const pluginRegistryUrl = flags['plugin-registry-url']
if (pluginRegistryUrl) {
yamlCr.spec.server.pluginRegistryUrl = pluginRegistryUrl
yamlCr.spec.server.externalPluginRegistry = true
}
let devfileRegistryUrl = flags['devfile-registry-url']
const devfileRegistryUrl = flags['devfile-registry-url']
if (devfileRegistryUrl) {
yamlCr.spec.server.devfileRegistryUrl = devfileRegistryUrl
yamlCr.spec.server.externalDevfileRegistry = true
}

yamlCr.spec.storage.postgresPVCStorageClassName = flags['postgres-pvc-storage-class-name']
yamlCr.spec.storage.workspacePVCStorageClassName = flags['workspace-pvc-storage-class-name']

if (flags.cheimage === DEFAULT_CHE_IMAGE &&
yamlCr.spec.server.cheImageTag !== 'nightly' &&
yamlCr.spec.server.cheImageTag !== 'latest') {
Expand Down
9 changes: 9 additions & 0 deletions src/commands/server/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ export default class Start extends Command {
directory: string({
char: 'd',
description: 'Directory to store logs into'
}),
'workspace-pvc-storage-class-name': string({
description: 'persistent volume(s) storage class name to use to store Eclipse Che workspaces data',
env: 'CHE_INFRA_KUBERNETES_PVC_STORAGE__CLASS__NAME',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe CHE_INFRA_KUBERNETES_WORKSPACE_PVC_STORAGE__CLASS__NAME

default: ''
}),
'postgres-pvc-storage-class-name': string({
description: 'persistent volume storage class name to use to store Eclipse Che Postgres database',
default: ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

env: 'CHE_INFRA_KUBERNETES_POSTGRESS_PVC_STORAGE__CLASS__NAME',

})
}

Expand Down
8 changes: 8 additions & 0 deletions src/tasks/installers/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ error: E_COMMAND_FAILED`)
ctx.isDevfileRegistryDeployed = true
}

if (flags['workspace-pvc-storage-class-name']) {
setOptions.push(`--set global.cheWorkspacePVCStorageClassName=${flags['workspace-pvc-storage-class-name']}`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wondering if we don't face any errors if storage class name is undefined

}

if (flags['postgres-pvc-storage-class-name']) {
setOptions.push(`--set global.chePostgresPVCStorageClassName=${flags['postgres-pvc-storage-class-name']}`)
}

setOptions.push(`--set global.ingressDomain=${flags.domain}`)
setOptions.push(`--set cheImage=${flags.cheimage}`)
setOptions.push(`--set global.cheWorkspacesNamespace=${flags.chenamespace}`)
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1677,11 +1677,11 @@ ecc-jsbn@~0.1.1:

"eclipse-che-operator@git://github.com/eclipse/che-operator#master":
version "0.0.0"
resolved "git://github.com/eclipse/che-operator#2e47c3331782868d7b120718ded7be5f5e64c9da"
resolved "git://github.com/eclipse/che-operator#18758810310ee6b163cf59719dcffb9e5b33ea28"

"eclipse-che@git://github.com/eclipse/che#master":
version "0.0.0"
resolved "git://github.com/eclipse/che#dfdc304120cb3286071f4f8a0ded2df0d9b805e4"
resolved "git://github.com/eclipse/che#5ced53ef23269513de294be9689d91c4117fce95"

editorconfig@^0.15.0:
version "0.15.3"
Expand Down