Skip to content

Commit

Permalink
fix: k8s tools server values symlinked for validation commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurice Faber committed Aug 31, 2021
1 parent 669e600 commit 32504ba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .values/.secrets.sample
Expand Up @@ -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=''
Expand Down
4 changes: 2 additions & 2 deletions src/common/hf.ts
Expand Up @@ -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'

Expand Down Expand Up @@ -105,7 +105,7 @@ export const values = async (opts?: ValuesOptions): Promise<Record<string, any>>
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
Expand Down
5 changes: 4 additions & 1 deletion 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'
Expand Down Expand Up @@ -56,8 +57,10 @@ app.get('/commit', async (req: Request, res: Response) => {
}
})

export const startServer = (): void => {
export const startServer = async (): Promise<void> => {
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`)
}

Expand Down
7 changes: 2 additions & 5 deletions values/otomi-api/otomi-api.gotmpl
Expand Up @@ -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" }}
Expand All @@ -82,8 +81,6 @@ core:

tools:
enabled: {{ $sopsEnabled }}
env:
VERBOSITY: '2'
{{- if $sopsEnabled }}
image:
repository: otomi/core
Expand Down

0 comments on commit 32504ba

Please sign in to comment.