From 50c43253972d8e6466481868fe603e65eee3ba96 Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Thu, 21 May 2026 09:35:28 +0200 Subject: [PATCH 1/2] feat: remove server related code and tools sidecar dependencies --- .vscode/launch.json | 14 ----- charts/otomi-api/templates/deployment.yaml | 22 -------- charts/otomi-api/values.yaml | 13 ----- docker-compose.yml | 18 ------ helmfile.d/snippets/defaults.yaml | 7 --- package.json | 1 - src/cmd/index.ts | 3 - src/cmd/server.ts | 28 --------- src/server.ts | 66 ---------------------- 9 files changed, 172 deletions(-) delete mode 100644 src/cmd/server.ts delete mode 100644 src/server.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index b18a70c04b..2e2a5e7c62 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -36,20 +36,6 @@ "restart": true, "cwd": "${workspaceRoot}" }, - { - "name": "Debug node server", - "type": "node", - "request": "launch", - "program": "${workspaceRoot}/node_modules/.bin/tsx", - "runtimeArgs": ["--nolazy"], - "args": ["src/server.ts"], - "envFile": ".env", - "console": "integratedTerminal", - "cwd": "${workspaceRoot}", - "internalConsoleOptions": "openOnSessionStart", - "skipFiles": ["/**", "node_modules/**"], - "resolveSourceMapLocations": ["${workspaceFolder}/src/**"] - }, { "name": "Debug all tests", "type": "node", diff --git a/charts/otomi-api/templates/deployment.yaml b/charts/otomi-api/templates/deployment.yaml index aaf05d74f7..ac414a3a9a 100644 --- a/charts/otomi-api/templates/deployment.yaml +++ b/charts/otomi-api/templates/deployment.yaml @@ -73,28 +73,6 @@ spec: - name: core-values mountPath: /etc/otomi/core.yaml subPath: core.yaml - - name: {{ .Chart.Name }}-tools - image: "{{ .Values.tools.image.repository }}:{{ .Values.tools.image.tag }}" - imagePullPolicy: {{ .Values.tools.image.pullPolicy }} - command: ['sh'] - args: ['-c', 'binzx/otomi server -vv'] - envFrom: - - secretRef: - name: {{ include "otomi-api.fullname" . }} - {{- with .Values.gitConfig.existingSecret }} - - secretRef: - name: {{ . }} - {{- end }} - - configMapRef: - name: {{ include "otomi-api.fullname" . }} - ports: - - name: http - containerPort: 17771 - protocol: TCP - resources: {{- toYaml .Values.tools.resources | nindent 12 }} - volumeMounts: - - name: repo - mountPath: /tmp {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/otomi-api/values.yaml b/charts/otomi-api/values.yaml index e92b834e24..1bf3e327ba 100644 --- a/charts/otomi-api/values.yaml +++ b/charts/otomi-api/values.yaml @@ -109,16 +109,3 @@ env: core: {} -tools: - image: - repository: docker.io/linode/apl-core - tag: main - pullPolicy: IfNotPresent - - resources: {} - # limits: - # cpu: 500m - # memory: 500Mi - # requests: - # cpu: 100m - # memory: 100Mi diff --git a/docker-compose.yml b/docker-compose.yml index f36cdca4fa..564d668755 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,6 @@ services: - ${PWD}/core.yaml:/etc/otomi/core.yaml - tmp:/tmp environment: - TOOLS_HOST: tools CLUSTER_ID: ${CLUSTER_ID:-google/dev} GIT_LOCAL_PATH: /tmp/otomi-values-core GIT_REPO_URL: ${GIT_REPO_URL:-github.com/redkubes/otomi-values.git} @@ -23,23 +22,6 @@ services: GIT_PASSWORD: ${GIT_PASSWORD} CLUSTER_APISERVER: http://127.0.0.1:8080 - tools: - container_name: tools - image: linode/apl-core:${TOOLS_TAG:-latest} - user: ${USER_ID}:${GROUP_ID} - command: npm run compile && node --no-warnings ./dist/src/otomi.js -- server - depends_on: - - api - expose: - - 17771 - ports: - - 17771:192019 - volumes: - - tmp:/tmp - - $PWD:/home/app/stack - environment: - ENV_DIR: /tmp/otomi-values-core - GCLOUD_SERVICE_KEY: ${GCLOUD_SERVICE_KEY} web: image: linode/apl-console:${WEB_TAG:-latest} diff --git a/helmfile.d/snippets/defaults.yaml b/helmfile.d/snippets/defaults.yaml index 5a2854c289..7270963a09 100644 --- a/helmfile.d/snippets/defaults.yaml +++ b/helmfile.d/snippets/defaults.yaml @@ -801,13 +801,6 @@ environments: requests: cpu: 100m memory: 256Mi - tools: - limits: - cpu: "1" - memory: 1Gi - requests: - cpu: 300m - memory: 256Mi otomi-console: _rawValues: {} resources: diff --git a/package.json b/package.json index 8a524ac439..52ec6484b6 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,6 @@ "release:github": "github-release-from-changelog", "release:bump:minor": "standard-version --skip.changelog true --release-as minor", "score-templates": "binzx/otomi score-templates", - "server": "binzx/otomi server", "spellcheck": "cspell 'docs/**/*.md' 'values-schema.yaml' '*.md' '.values/README.md'", "tasks:copy-certs": "binzx/otomi task -n copyCerts", "test": "run-s test:ts lint validate-values validate-templates bootstrap-dev", diff --git a/src/cmd/index.ts b/src/cmd/index.ts index 5e5da655ec..7e6dc3f33b 100644 --- a/src/cmd/index.ts +++ b/src/cmd/index.ts @@ -18,7 +18,6 @@ import { module as migrateModule } from './migrate' import { module as playgroundModule } from './playground' import { module as pullModule } from './pull' import { module as scoreTemplatesModule } from './score-templates' -import { module as serverModule } from './server' import { module as statusModule } from './status' import { module as syncModule } from './sync' import { module as templateModule } from './template' @@ -47,7 +46,6 @@ export { module as lint } from './lint' export { module as migrate } from './migrate' export { module as pull } from './pull' export { module as scoreTemplates } from './score-templates' -export { module as server } from './server' export { module as status } from './status' export { module as sync } from './sync' export { module as template } from './template' @@ -77,7 +75,6 @@ export const commands: CommandModule[] = [ playgroundModule, pullModule, scoreTemplatesModule, - serverModule, statusModule, syncModule, templateModule, diff --git a/src/cmd/server.ts b/src/cmd/server.ts deleted file mode 100644 index 0bcb82fac2..0000000000 --- a/src/cmd/server.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { prepareEnvironment } from 'src/common/cli' -import { terminal } from 'src/common/debug' -import { getFilename } from 'src/common/utils' -import { BasicArguments, setParsedArgs } from 'src/common/yargs' -import { startServer } from 'src/server' -import { Argv } from 'yargs' - -type Arguments = BasicArguments - -const cmdName = getFilename(__filename) - -const server = (): void => { - const d = terminal(`cmd:${cmdName}:server`) - d.info('Starting server') - startServer() -} - -export const module = { - command: cmdName, - describe: undefined, - builder: (parser: Argv): Argv => parser, - - handler: async (argv: Arguments): Promise => { - setParsedArgs(argv) - await prepareEnvironment({ skipAllPreChecks: true }) - server() - }, -} diff --git a/src/server.ts b/src/server.ts deleted file mode 100644 index 347cb12e5b..0000000000 --- a/src/server.ts +++ /dev/null @@ -1,66 +0,0 @@ -import express, { Request, Response } from 'express' -import { Server } from 'http' -import { terminal } from 'src/common/debug' -import { hfValues } from './common/hf' -import { objectToYaml } from './common/values' - -const d = terminal('server') -const app = express() -let server: Server - -export const stopServer = (): void => { - server?.close() -} -// Return statement is not needed anymore in express 5.x and above -app.get('/', async (req: Request, res: Response): Promise => { - res.send({ status: 'ok' }) -}) - -type QueryParams = { - envDir: string -} - -function parseBoolean(string: any, defaultValue = false): boolean { - return string === 'true' ? true : string === 'false' ? false : defaultValue -} -app.get('/otomi/values', async (req: Request, res: Response): Promise => { - const { envDir } = req.query as QueryParams - - const filesOnly = parseBoolean(req.query.filesOnly, true) - const excludeSecrets = parseBoolean(req.query.excludeSecrets, true) - const withWorkloadValues = parseBoolean(req.query.withWorkloadValues, true) - d.log('Get otomi values', req.query) - try { - const data = await hfValues({ filesOnly, excludeSecrets, withWorkloadValues }, envDir) - res.setHeader('Content-type', 'text/plain') - const yamlData = objectToYaml(data!) - res.status(200).send(yamlData) - } catch (error) { - const status = 500 - d.error(error) - res.status(status).send(error) - } -}) - -export const startServer = (): void => { - server = app - .listen(17771, '127.0.0.1', () => { - d.log(`Server listening on http://127.0.0.1:17771`) - }) - .on('error', (e) => { - console.error(e) - }) -} - -// Add this at the bottom of the file or in a lifecycle manager -process.on('SIGINT', () => { - d.info('Shutting down server') - stopServer() - process.exit(0) -}) - -process.on('SIGTERM', () => { - d.info('Shutting down server') - stopServer() - process.exit(0) -}) From 738a5cc355cbcefe7de9638d5b2f4ae8dc456b98 Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Thu, 21 May 2026 10:58:25 +0200 Subject: [PATCH 2/2] fix: otomi-api template --- values/otomi-api/otomi-api.gotmpl | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/values/otomi-api/otomi-api.gotmpl b/values/otomi-api/otomi-api.gotmpl index ae8fe79618..9f6b586094 100644 --- a/values/otomi-api/otomi-api.gotmpl +++ b/values/otomi-api/otomi-api.gotmpl @@ -8,9 +8,6 @@ {{- $httpRoute := tpl (readFile "../../helmfile.d/snippets/routes.gotmpl") $v | fromYaml }} {{- $version := $v.versions | get "api" }} {{- $isSemver := regexMatch "^[0-9.]+" $version }} -{{- $coreVersion := $v.otomi.version }} -{{- $coreIsSemver := regexMatch "^[0-9.]+" $coreVersion }} - replicaCount: 1 clusterDomainSuffix: {{ $v.cluster.domainSuffix }} resources: {{- $o.resources.api | toYaml | nindent 2 }} @@ -22,18 +19,6 @@ image: tag: {{ printf "%s%s" ($isSemver | ternary "v" "") $version }} pullPolicy: {{ $isSemver | ternary "IfNotPresent" "Always" }} -tools: - image: - {{- if $v.otomi.linodeLkeImageRepository }} - repository: "{{ $v.otomi.linodeLkeImageRepository }}/docker/linode/apl-core" - {{- end }} - tag: {{ $coreVersion | quote }} - pullPolicy: {{ $coreIsSemver | ternary "IfNotPresent" "Always" }} - resources: {{- $o.resources.tools | toYaml | nindent 4 }} - env: - DEBUG: '*' - VERBOSITY: '1' - secrets: GIT_USER: {{ $git.username | quote }} GIT_EMAIL: {{ $git.email | quote }}