From 8e44f0a15657e90c288eb9130dad3d5cead276fa Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:12:15 +0200 Subject: [PATCH 1/7] feat: configurable intervals and timouts --- charts/apl-operator/templates/deployment.yaml | 10 ++++++++++ charts/apl-operator/values.yaml | 7 +++++++ src/operator/git-repository.ts | 6 +++++- src/operator/main.ts | 1 + src/operator/validators.ts | 3 ++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/charts/apl-operator/templates/deployment.yaml b/charts/apl-operator/templates/deployment.yaml index f4599761e3..8087a67a1c 100644 --- a/charts/apl-operator/templates/deployment.yaml +++ b/charts/apl-operator/templates/deployment.yaml @@ -46,6 +46,16 @@ spec: env: - name: CI value: "true" + - name: POLL_INTERVAL_MS + value: {{ .Values.operator.pollIntervalMs | quote }} + - name: RECONCILE_INTERVAL_MS + value: {{ .Values.operator.reconcileIntervalMs | quote }} + - name: GIT_OP_TIMEOUT + value: {{ .Values.operator.gitOpTimeout | quote }} + - name: INSTALL_RETRIES + value: {{ .Values.operator.installRetries | quote }} + - name: INSTALL_MAX_TIMEOUT_MS + value: {{ .Values.operator.installMaxTimeoutMs | quote }} envFrom: - secretRef: name: apl-sops-secrets diff --git a/charts/apl-operator/values.yaml b/charts/apl-operator/values.yaml index 55e3bd6aed..22ca12e07e 100644 --- a/charts/apl-operator/values.yaml +++ b/charts/apl-operator/values.yaml @@ -62,6 +62,13 @@ commandArgs: [] env: {} +operator: + pollIntervalMs: 15000 + reconcileIntervalMs: 300000 + gitOpTimeout: 10000 + installRetries: 1000 + installMaxTimeoutMs: 10000 + kms: {} # example: # sops: diff --git a/src/operator/git-repository.ts b/src/operator/git-repository.ts index 8f841b5075..7270c1734e 100644 --- a/src/operator/git-repository.ts +++ b/src/operator/git-repository.ts @@ -15,6 +15,7 @@ export interface GitRepositoryConfig { branch: string username?: string email: string + gitOpTimeoutMs?: number } export class GitRepository { @@ -34,7 +35,10 @@ export class GitRepository { this.branch = config.branch this.username = config.username ?? 'otomi-admin' this.email = config.email - this.git = simpleGit(this.repoPath) + this.git = simpleGit({ + baseDir: this.repoPath, + ...(config.gitOpTimeoutMs && { timeout: { block: config.gitOpTimeoutMs } }), + }) this._config = { repoUrl: config.repoUrl, authenticatedUrl: config.authenticatedUrl, diff --git a/src/operator/main.ts b/src/operator/main.ts index c9cb0e0082..55948f9de2 100644 --- a/src/operator/main.ts +++ b/src/operator/main.ts @@ -27,6 +27,7 @@ async function loadConfig(aplOps: AplOperations): Promise { const gitRepository = new GitRepository({ ...gitConfig, repoPath: env.ENV_DIR, + gitOpTimeoutMs: operatorEnv.GIT_OP_TIMEOUT, }) return { diff --git a/src/operator/validators.ts b/src/operator/validators.ts index 09ac7dd5c4..7a31ac055c 100644 --- a/src/operator/validators.ts +++ b/src/operator/validators.ts @@ -12,8 +12,9 @@ export const operatorEnv = cleanEnv(process.env, { desc: 'Path to the gitops manifests global', default: 'env/manifests/global', }), - POLL_INTERVAL_MS: num({ desc: 'Interval in which the operator polls Git', default: 1000 }), + POLL_INTERVAL_MS: num({ desc: 'Interval in which the operator polls Git', default: 15000 }), RECONCILE_INTERVAL_MS: num({ desc: 'Interval in which the operator reconciles the cluster in', default: 300_000 }), + GIT_OP_TIMEOUT: num({ desc: 'Timeout in milliseconds for a single git operation', default: 10000 }), INSTALL_RETRIES: num({ desc: 'Number of installation retry attempts', default: 1000 }), INSTALL_MAX_TIMEOUT_MS: num({ desc: 'Maximum timeout for installation retries in milliseconds', default: 10000 }), }) From b11c310b20ef60e97dc550760c4de5efde66e309 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:04:26 +0200 Subject: [PATCH 2/7] feat: operator params --- chart/apl/templates/deployment.yaml | 10 ++++++++-- chart/apl/values.yaml | 6 +++++- charts/apl-operator/templates/deployment.yaml | 4 ++-- charts/apl-operator/values.yaml | 2 +- src/operator/main.ts | 4 ++-- src/operator/validators.ts | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/chart/apl/templates/deployment.yaml b/chart/apl/templates/deployment.yaml index 30a1600715..9eeb1731df 100644 --- a/chart/apl/templates/deployment.yaml +++ b/chart/apl/templates/deployment.yaml @@ -74,9 +74,15 @@ spec: - name: GIT_REPO value: {{ .Values.operator.gitRepo | default "values" | quote }} - name: POLL_INTERVAL_MS - value: {{ .Values.operator.pollIntervalMs | default "30000" | quote }} + value: {{ .Values.operator.pollIntervalMs | quote }} - name: RECONCILE_INTERVAL_MS - value: {{ .Values.operator.reconcileIntervalMs | default "300000" | quote }} + value: {{ .Values.operator.reconcileIntervalMs | quote }} + - name: GIT_OP_TIMEOUT_MS + value: {{ .Values.operator.gitOpTimeoutMs | quote }} + - name: INSTALL_RETRIES + value: {{ .Values.operator.installRetries | quote }} + - name: INSTALL_MAX_TIMEOUT_MS + value: {{ .Values.operator.installMaxTimeoutMs | quote }} envFrom: - secretRef: name: apl-git-credentials diff --git a/chart/apl/values.yaml b/chart/apl/values.yaml index 9ec9beee63..24cbb4bf98 100644 --- a/chart/apl/values.yaml +++ b/chart/apl/values.yaml @@ -145,9 +145,13 @@ operator: # Git repository name (will be configured during installation) gitRepo: "values" # Polling interval for git changes (milliseconds) - pollIntervalMs: 1000 + pollIntervalMs: 30000 # Reconcile interval for applying changes (milliseconds) reconcileIntervalMs: 300000 + gitOpTimeoutMs: 10000 + installRetries: 1000 + installMaxTimeoutMs: 10000 + installation: mode: standard diff --git a/charts/apl-operator/templates/deployment.yaml b/charts/apl-operator/templates/deployment.yaml index 8087a67a1c..ff8b9dcfae 100644 --- a/charts/apl-operator/templates/deployment.yaml +++ b/charts/apl-operator/templates/deployment.yaml @@ -50,8 +50,8 @@ spec: value: {{ .Values.operator.pollIntervalMs | quote }} - name: RECONCILE_INTERVAL_MS value: {{ .Values.operator.reconcileIntervalMs | quote }} - - name: GIT_OP_TIMEOUT - value: {{ .Values.operator.gitOpTimeout | quote }} + - name: GIT_OP_TIMEOUT_MS + value: {{ .Values.operator.gitOpTimeoutMs | quote }} - name: INSTALL_RETRIES value: {{ .Values.operator.installRetries | quote }} - name: INSTALL_MAX_TIMEOUT_MS diff --git a/charts/apl-operator/values.yaml b/charts/apl-operator/values.yaml index 22ca12e07e..fcb2ac6b73 100644 --- a/charts/apl-operator/values.yaml +++ b/charts/apl-operator/values.yaml @@ -65,7 +65,7 @@ env: {} operator: pollIntervalMs: 15000 reconcileIntervalMs: 300000 - gitOpTimeout: 10000 + gitOpTimeoutMs: 10000 installRetries: 1000 installMaxTimeoutMs: 10000 diff --git a/src/operator/main.ts b/src/operator/main.ts index 55948f9de2..f746a4d243 100644 --- a/src/operator/main.ts +++ b/src/operator/main.ts @@ -2,6 +2,7 @@ import * as dotenv from 'dotenv' import fs from 'fs' import process from 'node:process' import path from 'path' +import { retryInstallStep } from '../cmd/install' import { terminal } from '../common/debug' import { env } from '../common/envalid' import { getStoredGitRepoConfig } from '../common/git-config' @@ -11,7 +12,6 @@ import { GitRepository } from './git-repository' import { Installer } from './installer' import { getErrorMessage } from './utils' import { operatorEnv } from './validators' -import { retryInstallStep } from '../cmd/install' dotenv.config() @@ -27,7 +27,7 @@ async function loadConfig(aplOps: AplOperations): Promise { const gitRepository = new GitRepository({ ...gitConfig, repoPath: env.ENV_DIR, - gitOpTimeoutMs: operatorEnv.GIT_OP_TIMEOUT, + gitOpTimeoutMs: operatorEnv.GIT_OP_TIMEOUT_MS, }) return { diff --git a/src/operator/validators.ts b/src/operator/validators.ts index 7a31ac055c..482b262cc1 100644 --- a/src/operator/validators.ts +++ b/src/operator/validators.ts @@ -14,7 +14,7 @@ export const operatorEnv = cleanEnv(process.env, { }), POLL_INTERVAL_MS: num({ desc: 'Interval in which the operator polls Git', default: 15000 }), RECONCILE_INTERVAL_MS: num({ desc: 'Interval in which the operator reconciles the cluster in', default: 300_000 }), - GIT_OP_TIMEOUT: num({ desc: 'Timeout in milliseconds for a single git operation', default: 10000 }), + GIT_OP_TIMEOUT_MS: num({ desc: 'Timeout in milliseconds for a single git operation', default: 10000 }), INSTALL_RETRIES: num({ desc: 'Number of installation retry attempts', default: 1000 }), INSTALL_MAX_TIMEOUT_MS: num({ desc: 'Maximum timeout for installation retries in milliseconds', default: 10000 }), }) From 82524e6252bcecfcf361c2448229ce1d8bb1daf3 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 11:56:43 +0200 Subject: [PATCH 3/7] feat: operator params --- charts/apl-operator/values.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/charts/apl-operator/values.yaml b/charts/apl-operator/values.yaml index fcb2ac6b73..020a91d690 100644 --- a/charts/apl-operator/values.yaml +++ b/charts/apl-operator/values.yaml @@ -49,6 +49,16 @@ resources: {} # memory: 128Mi +## APL Operator configuration +operator: + # Git organization/user name (will be configured during installation) + gitOrg: "otomi" + # Git repository name (will be configured during installation) + gitRepo: "values" + # Polling interval for git changes (milliseconds) + pollIntervalMs: 1000 + # Reconcile interval for applying changes (milliseconds) + reconcileIntervalMs: 300000 nodeSelector: {} From 7961cdac22de6533128ead370f2d4daa51420601 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:20:15 +0200 Subject: [PATCH 4/7] fix: rework --- src/operator/git-repository.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/operator/git-repository.ts b/src/operator/git-repository.ts index 7270c1734e..bcfede4ab9 100644 --- a/src/operator/git-repository.ts +++ b/src/operator/git-repository.ts @@ -15,7 +15,7 @@ export interface GitRepositoryConfig { branch: string username?: string email: string - gitOpTimeoutMs?: number + gitOpTimeoutMs: number } export class GitRepository { @@ -37,7 +37,7 @@ export class GitRepository { this.email = config.email this.git = simpleGit({ baseDir: this.repoPath, - ...(config.gitOpTimeoutMs && { timeout: { block: config.gitOpTimeoutMs } }), + ...{ timeout: { block: config.gitOpTimeoutMs } }, }) this._config = { repoUrl: config.repoUrl, From a6fe1eb8294449d759f69eef6e1c21aff627a1d3 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:22:11 +0200 Subject: [PATCH 5/7] fix: rework --- src/operator/git-repository.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/operator/git-repository.test.ts b/src/operator/git-repository.test.ts index a0992d52b6..62eac2bb6e 100644 --- a/src/operator/git-repository.test.ts +++ b/src/operator/git-repository.test.ts @@ -51,6 +51,7 @@ describe('GitRepository', () => { branch: 'main', username: 'testuser', email: 'test@example.com', + gitOpTimeoutMs: 10000, } const simpleGit = require('simple-git') @@ -368,6 +369,7 @@ describe('GitRepository', () => { branch: 'feature-branch', username: 'testuser', email: 'test@example.com', + gitOpTimeoutMs: 10000, }) mockGit.fetch.mockResolvedValue(undefined) From 56e1032e43bb341c171b298537d9420949479170 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 16:03:23 +0200 Subject: [PATCH 6/7] refactor: rework --- charts/apl-operator/values.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/charts/apl-operator/values.yaml b/charts/apl-operator/values.yaml index a4585a09de..73bdd8ec76 100644 --- a/charts/apl-operator/values.yaml +++ b/charts/apl-operator/values.yaml @@ -53,10 +53,11 @@ operator: gitOrg: "otomi" # Git repository name (will be configured during installation) gitRepo: "values" - # Polling interval for git changes (milliseconds) - pollIntervalMs: 1000 - # Reconcile interval for applying changes (milliseconds) + pollIntervalMs: 15000 reconcileIntervalMs: 300000 + gitOpTimeoutMs: 10000 + installRetries: 1000 + installMaxTimeoutMs: 10000 nodeSelector: {} @@ -70,12 +71,7 @@ commandArgs: [] env: {} -operator: - pollIntervalMs: 15000 - reconcileIntervalMs: 300000 - gitOpTimeoutMs: 10000 - installRetries: 1000 - installMaxTimeoutMs: 10000 + kms: {} # example: From a05d8b0ef7b8296211a480be776887ed85cc68af Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Thu, 18 Jun 2026 16:04:23 +0200 Subject: [PATCH 7/7] refactor: rework --- src/operator/git-repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator/git-repository.ts b/src/operator/git-repository.ts index bcfede4ab9..1469be0ff8 100644 --- a/src/operator/git-repository.ts +++ b/src/operator/git-repository.ts @@ -37,7 +37,7 @@ export class GitRepository { this.email = config.email this.git = simpleGit({ baseDir: this.repoPath, - ...{ timeout: { block: config.gitOpTimeoutMs } }, + timeout: { block: config.gitOpTimeoutMs }, }) this._config = { repoUrl: config.repoUrl,