Skip to content

[module-sdk] expose readonly Settings on ApplicationHookInput#103

Merged
ipaqsa merged 2 commits into
mainfrom
feature/application-hook-settings
Apr 23, 2026
Merged

[module-sdk] expose readonly Settings on ApplicationHookInput#103
ipaqsa merged 2 commits into
mainfrom
feature/application-hook-settings

Conversation

@Fkuloff
Copy link
Copy Markdown
Contributor

@Fkuloff Fkuloff commented Apr 22, 2026

Adds a readonly Settings field to ApplicationHookInput, symmetrical to how module hooks receive ConfigValues. Typed as pkg.ReadableValuesCollector (no Set/Remove). Reuses the existing CONFIG_VALUES_PATH channel — no new env var, no addon-operator changes.

Example hook:

func Handle(_ context.Context, input *pkg.ApplicationHookInput) error {
    enabled, ok := input.Settings.GetOk("apiServersDiscovery.enabled")
    if !ok || !enabled.Bool() {
        input.Logger.Info("apiServersDiscovery.enabled is not set — skipping")
        return nil
    }
    // ...discover apiserver pods and write into values
}

Unit test in main_test.go covers both branches (gate closed → Values.Set not called; gate open → called with expected pods).

Cluster-verified on a live Deckhouse cluster via artem-test, gating on triggersEnabled:

// gate closed (default false)
{"msg":"triggersEnabled is not set — skipping","hook_module":"default.test","time":"2026-04-22T15:36:53Z"}

// gate open (after k patch ... triggersEnabled:true + matching pod)
{"msg":"discover triggers","hook_module":"default.test","time":"2026-04-22T15:40:43Z"}
{"msg":"discovered triggers","hook_pods":["trigger-demo"],"hook_module":"default.test","time":"2026-04-22T15:40:43Z"}

@Fkuloff Fkuloff requested a review from ipaqsa April 22, 2026 11:04
@Fkuloff Fkuloff self-assigned this Apr 22, 2026
@Fkuloff Fkuloff force-pushed the feature/application-hook-settings branch from dba5505 to 71f84d4 Compare April 22, 2026 11:35
Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
@Fkuloff Fkuloff force-pushed the feature/application-hook-settings branch from 71f84d4 to 3c66808 Compare April 22, 2026 11:48
Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
@Fkuloff Fkuloff marked this pull request as ready for review April 22, 2026 15:46
@ipaqsa ipaqsa merged commit 905697b into main Apr 23, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants