Skip to content

Add NAIS source kind for instance group env vars#402

Merged
jhrv merged 3 commits intomainfrom
add-nais-source-kind
Apr 17, 2026
Merged

Add NAIS source kind for instance group env vars#402
jhrv merged 3 commits intomainfrom
add-nais-source-kind

Conversation

@jhrv
Copy link
Copy Markdown
Contributor

@jhrv jhrv commented Apr 16, 2026

Summary

  • Splits SPEC in InstanceGroupValueSourceKind into SPEC (user-defined in .spec.env) and NAIS (platform-injected by naiserator)
  • Looks up the Application CRD via AppWatcher to determine which inline env vars the user actually defined
  • fieldRef/resourceFieldRef and projected volume subPath fallback are always classified as NAIS
  • Falls back to NAIS when Application CRD is not found (conservative default)

This makes it easier for CLI and Console to distinguish platform-injected values from user-defined ones without client-side heuristics.

…ser-defined

Split the SPEC value in InstanceGroupValueSourceKind into SPEC (user-defined
in nais.yaml .spec.env) and NAIS (injected by naiserator). Uses the Application
CRD via AppWatcher to determine which inline env vars the user actually defined.

fieldRef and resourceFieldRef are always classified as NAIS.
@jhrv jhrv requested a review from a team as a code owner April 16, 2026 15:04

"""
The value is defined inline in the workload spec.
The value is defined inline in the workload spec (user-defined in nais.yaml).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nais.yaml might not be right name, app.yaml

jhrv and others added 2 commits April 17, 2026 09:44
- Add APP_ENV to Application CRD spec.env so it's classified as SPEC
- Add NAIS_APP_NAME to ReplicaSet pod spec only (not in CRD) to test NAIS classification
- Update integration test expectations to cover both SPEC and NAIS env vars
- Improve SPEC enum description: 'application manifest' instead of 'nais.yaml'
@jhrv jhrv enabled auto-merge (squash) April 17, 2026 07:47
@jhrv jhrv merged commit e7efb1f into main Apr 17, 2026
11 checks passed
@jhrv jhrv deleted the add-nais-source-kind branch April 17, 2026 07:49
jhrv added a commit to nais/cli that referenced this pull request Apr 17, 2026
nais-api now distinguishes user-defined SPEC values from platform-
injected NAIS values (see nais/api#402). Render NAIS-sourced entries
as 'Nais/<name>' while keeping SPEC rendering unchanged.

Rename 'ConfigMaps' to 'Configs' in 'nais app files' help text for
consistency with the user-facing 'Config/<name>' rendering.

Also fix the schema update tasks to use the promoted top-level 'api'
command (was 'alpha api') so 'mise run update:graphql-schema:{live,local}'
works again after the command promotion.
jhrv added a commit to nais/console-frontend that referenced this pull request Apr 17, 2026
nais-api now returns a distinct NAIS source kind for platform-injected
env vars and mounted files (see nais/api#402), so the client no longer
needs to parse the application manifest YAML to classify SPEC entries.

Stop fetching 'manifest { content }' on the instance group detail page,
remove the 'yaml' import and the 'specEnvNames' derivation, and switch
labeling directly on 'source.kind':
- SECRET   -> 'Secret'
- CONFIG   -> 'Config'    (was 'ConfigMap')
- SPEC     -> 'Application manifest'
- NAIS     -> 'Nais'      (fallback until schema.graphql is synced)
jhrv added a commit to nais/cli that referenced this pull request Apr 17, 2026
nais-api now distinguishes user-defined SPEC values from platform-
injected NAIS values (see nais/api#402). Render NAIS-sourced entries
as 'Nais/<name>' while keeping SPEC rendering unchanged.

Rename 'ConfigMaps' to 'Configs' in 'nais app files' help text for
consistency with the user-facing 'Config/<name>' rendering.

Also fix the schema update tasks to use the promoted top-level 'api'
command (was 'alpha api') so 'mise run update:graphql-schema:{live,local}'
works again after the command promotion.
jhrv added a commit to nais/console-frontend that referenced this pull request Apr 17, 2026
nais-api now returns a distinct NAIS source kind for platform-injected
env vars and mounted files (see nais/api#402), so the client no longer
needs to parse the application manifest YAML to classify SPEC entries.

Stop fetching 'manifest { content }' on the instance group detail page,
remove the 'yaml' import and the 'specEnvNames' derivation, and switch
labeling directly on 'source.kind':
- SECRET   -> 'Secret'
- CONFIG   -> 'Config'    (was 'ConfigMap')
- SPEC     -> 'Application manifest'
- NAIS     -> 'Nais'      (fallback until schema.graphql is synced)
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