-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt chectl to fixes for TLS for helm chart
- Loading branch information
1 parent
2942905
commit 2f24668
Showing
2 changed files
with
7 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,38 +35,13 @@ export class HelmHelper { | |
}, | ||
task: async (ctx: any, task: any) => { | ||
const kh = new KubeHelper() | ||
const exists = await kh.secretExist('che-tls') | ||
const exists = await kh.secretExist('che-tls', `${flags.chenamespace}`) | ||
if (!exists) { | ||
throw new Error('TLS option is enabled but che-tls secret does not exist in default namespace. Example on how to create the secret: kubectl create secret generic che-tls [email protected]') | ||
throw new Error(`TLS option is enabled but che-tls secret does not exist in '${flags.chenamespace}' namespace. Example on how to create the secret: kubectl create secret generic che-tls [email protected]`) | ||
} | ||
const tlsEmail = await kh.getSecret('che-tls') | ||
if (tlsEmail === undefined) { | ||
throw new Error('TLS option is enabled and che-tls secret is defined but there is no ACME_EMAIL field on this secret. Example on how to create the secret: kubectl create secret generic che-tls [email protected]') | ||
} | ||
ctx.tlsEmail = tlsEmail | ||
task.title = `${task.title}...che-tls secret found.` | ||
} | ||
}, | ||
{ | ||
title: 'Check for cert-manager', | ||
// Check only if TLS is enabled | ||
enabled: () => { | ||
return flags.tls | ||
}, | ||
task: async (_ctx: any, task: any) => { | ||
const kh = new KubeHelper() | ||
const exists = await kh.apiVersionExist('certmanager.k8s.io') | ||
if (!exists) { | ||
throw new Error(`TLS option is enabled but cert-manager API has not been found. Cert Manager is probably not installed. Example on how to install it: | ||
$ kubectl create namespace cert-manager | ||
$ kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true | ||
$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.8.1/cert-manager.yaml --validate=false | ||
Please install cert-manager.`) | ||
} | ||
task.title = `${task.title}...done` | ||
} | ||
}, | ||
{ | ||
title: 'Create Tiller Role Binding', | ||
task: async (_ctx: any, task: any) => { | ||
|
@@ -202,7 +177,7 @@ error: E_COMMAND_FAILED`) | |
} | ||
|
||
if (flags.tls) { | ||
setOptions = `--set global.cheDomain=${flags.domain} --set global.tls.email='${ctx.tlsEmail}'` | ||
setOptions = `--set global.cheDomain=${flags.domain}` | ||
tlsFlag = `-f ${destDir}values/tls.yaml` | ||
} | ||
|
||
|