From 32504ba5ea160c16704b9599726e16be9329570a Mon Sep 17 00:00:00 2001 From: Maurice Faber Date: Tue, 31 Aug 2021 03:21:51 +0200 Subject: [PATCH] fix: k8s tools server values symlinked for validation commands --- .values/.secrets.sample | 2 +- src/common/hf.ts | 4 ++-- src/server/index.ts | 5 ++++- values/otomi-api/otomi-api.gotmpl | 7 ++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.values/.secrets.sample b/.values/.secrets.sample index b28af01bfa..e496bb3ff7 100644 --- a/.values/.secrets.sample +++ b/.values/.secrets.sample @@ -4,7 +4,7 @@ GIT_EMAIL='' GIT_PASSWORD='' # KMS access from here on # Google (paste json key here without newlines) -GCLOUD_SERVICE_KEY='' +GCLOUD_SERVICE_KEY='{}' # Azure: AZURE_TENANT_ID='' AZURE_CLIENT_ID='' diff --git a/src/common/hf.ts b/src/common/hf.ts index 35551536c4..cc157ed347 100644 --- a/src/common/hf.ts +++ b/src/common/hf.ts @@ -2,7 +2,7 @@ import { load } from 'js-yaml' import { Transform } from 'stream' import { $, ProcessOutput, ProcessPromise } from 'zx' import { env } from './envalid' -import { asArray, getParsedArgs, logLevels, terminal } from './utils' +import { asArray, getParsedArgs, logLevels, rootDir, terminal } from './utils' import { Arguments } from './yargs-opts' import { ProcessOutputTrimmed, Streams } from './zx-enhance' @@ -105,7 +105,7 @@ export const values = async (opts?: ValuesOptions): Promise> return value.clean } } - const output = await hf({ fileOpts: `${process.cwd()}/helmfile.tpl/helmfile-dump.yaml`, args: 'build' }) + const output = await hf({ fileOpts: `${rootDir}/helmfile.tpl/helmfile-dump.yaml`, args: 'build' }) value.clean = (load(output.stdout) as any).renderedvalues value.rp = (load(replaceHFPaths(output.stdout)) as any).renderedvalues return opts?.replacePath ? value.rp : value.clean diff --git a/src/server/index.ts b/src/server/index.ts index 19efb67e5d..bf9ca98f0d 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/require-await */ import express, { Request, Response } from 'express' +import { existsSync, symlinkSync } from 'fs' import { Server } from 'http' import { commit } from '../cmd/commit' import { validateValues } from '../cmd/validate-values' @@ -56,8 +57,10 @@ app.get('/commit', async (req: Request, res: Response) => { } }) -export const startServer = (): void => { +export const startServer = async (): Promise => { server = app.listen(17771, '0.0.0.0') + const k8sPath = '/tmp/otomi-values' + if (existsSync(k8sPath)) symlinkSync(k8sPath, 'env') debug.log(`Container listening on http://0.0.0.0:17771`) } diff --git a/values/otomi-api/otomi-api.gotmpl b/values/otomi-api/otomi-api.gotmpl index 8f31689857..c0392cc0d8 100644 --- a/values/otomi-api/otomi-api.gotmpl +++ b/values/otomi-api/otomi-api.gotmpl @@ -55,9 +55,8 @@ secrets: {{- $sopsEnv | nindent 2 }} env: - # DEBUG: '*' - VERBOSE: '1' - VERBOSITY: '2' + DEBUG: '*' + VERBOSITY: '1' GIT_REPO_URL: {{ $o | get "git.repoUrl" $giteaValuesUrl }} GIT_BRANCH: {{ $o | get "git.branch" "main" }} {{- if hasKey $o "disableSync" }} @@ -82,8 +81,6 @@ core: tools: enabled: {{ $sopsEnabled }} - env: - VERBOSITY: '2' {{- if $sopsEnabled }} image: repository: otomi/core