Skip to content

feat: add config (ConfigMap) CLI commands#678

Merged
frodesundby merged 5 commits intomainfrom
configmap
Mar 19, 2026
Merged

feat: add config (ConfigMap) CLI commands#678
frodesundby merged 5 commits intomainfrom
configmap

Conversation

@frodesundby
Copy link
Contributor

@frodesundby frodesundby commented Mar 18, 2026

Summary

  • Adds config command group with full CRUD support for ConfigMaps: list, get, create, delete, set, unset, and activity
  • Follows the existing Secret implementation pattern but simplified — no elevation, no --with-values/--reason flags (ConfigMap values are not sensitive)
  • Regenerated schema and genqlient types from API (includes both config and credentials types)

Commands

Command Description
nais config list List configs for a team
nais config get Get config details with key/value pairs
nais config create Create a new config
nais config delete Delete a config
nais config set Set key/value pairs on a config
nais config unset Remove keys from a config
nais config activity View activity log for a config

Notes

  • Command is named config (singular) — consistent with Console UI naming. The naistrix framework's built-in config command was renamed to defaults in naistrix v0.22.1, freeing the name.
  • Also updates 'nais config set team' references to 'nais defaults set team' in both config and secret packages.
  • Depends on Add support for team-managed configs (ConfigMaps) via GraphQL API api#364 being merged (ConfigMap GraphQL API) ✅

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

📝 Changelog preview

Below is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog.

v5.18.0 - 2026-03-19

Full Changelog: v5.17.0...v5.18.0

🚀 Features

  • Add configs (ConfigMap) CLI commands (19bdd3a)

🐛 Bug Fixes

  • Handle non-deletion case and stabilize time-based test in config (b8f059e)

⚙️ Miscellaneous Changes

  • Add unit tests for config package (ed28203)
  • Update GraphQL schema and regenerate client from local API (39ad253)
  • Rename configs command to config and fix activity sort order (4ad505b)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new nais configs command group to manage ConfigMaps via the Nais GraphQL API, following the existing “secrets” command structure while regenerating schema/genqlient types to include config and credential-related additions.

Changes:

  • Introduces internal/config API client + formatting helpers (CRUD value ops + activity log support).
  • Adds internal/config/command with list/get/create/delete/set/unset/activity subcommands and flags/autocomplete behavior.
  • Updates GraphQL schema and genqlient operation config, and wires the new command into the CLI root.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
schema.graphql Regenerated schema to include Config types/mutations and some activity log enum/resource updates.
genqlient.yaml Includes internal/config/**/*.go in genqlient operations.
internal/application/application.go Registers the new configs command group in the CLI.
internal/config/config.go Implements config GraphQL queries/mutations, formatting helpers, and LastModified rendering/JSON.
internal/config/config_test.go Unit tests for formatting helpers and LastModified.
internal/config/activity.go Implements config activity log fetching + mapping into CLI output models.
internal/config/activity_test.go Unit tests for activity log mapping/filtering behavior.
internal/config/command/command.go Adds configs command group and shared arg/metadata/autocomplete helpers.
internal/config/command/list.go Implements nais configs list table/JSON output and environment filtering.
internal/config/command/list_test.go Unit tests for list summarization helper.
internal/config/command/get.go Implements nais configs get with environment resolution and table/JSON output.
internal/config/command/create.go Implements nais configs create.
internal/config/command/delete.go Implements nais configs delete with confirmation flow.
internal/config/command/set.go Implements nais configs set with direct value or stdin input support.
internal/config/command/unset.go Implements nais configs unset with confirmation flow.
internal/config/command/activity.go Implements nais configs activity with filters and output formatting.
internal/config/command/environment.go Environment resolution + CLI --environment occurrence handling helpers.
internal/config/command/environment_test.go Unit tests for environment selection logic.
internal/config/command/flag/flag.go Defines flags and autocomplete behavior for the new command group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class ConfigMap (“config”) support to the CLI by introducing a new config-focused client package and a full set of CLI subcommands, alongside regenerated GraphQL schema/types to support the new API.

Changes:

  • Regenerates schema.graphql and genqlient operations/types to include Config and credentials-related GraphQL API surface.
  • Introduces internal/config (API client + formatting + activity) and internal/config/command/* (list/get/create/delete/set/unset/activity).
  • Updates a few secret command autocomplete messages and registers the new config command in the application command set.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
schema.graphql Regenerated schema adding Config/ConfigValue CRUD + activity types/resource types and credentials types/mutations.
internal/secret/command/flag/flag.go Updates missing-team autocomplete guidance text.
internal/secret/command/command.go Updates missing-team autocomplete guidance text.
internal/secret/command/activity.go Updates missing-team autocomplete guidance text.
internal/config/config.go New Config API client + helpers + table/JSON formatting.
internal/config/config_test.go Unit tests for formatting and LastModified rendering/JSON.
internal/config/activity.go New Config activity query + transformation logic.
internal/config/activity_test.go Unit tests for activity transformation logic.
internal/config/command/command.go New top-level command wiring for config CRUD + helpers/autocomplete.
internal/config/command/*.go Implements list/get/create/delete/set/unset/activity CLI subcommands.
internal/config/command/*_test.go Unit tests for env selection and list summarization.
internal/config/command/flag/flag.go Flags + autocomplete support for config commands.
internal/application/application.go Registers the new config command in the root CLI.
genqlient.yaml Adds internal/config/**/*.go to genqlient operations scanning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@frodesundby frodesundby changed the title feat: add configs (ConfigMap) CLI commands feat: add config (ConfigMap) CLI commands Mar 19, 2026
Add full ConfigMap management support via 'nais configs' command with
subcommands: list, get, create, delete, set, unset, and activity.

Follows the existing secret implementation pattern but simplified —
config values are not sensitive, so no --with-values/--reason flags
or RBAC elevation is needed.
- Rename CLI command from 'configs' to 'config' for consistency with Console UI
- Add missing sort.SliceStable in buildConfigActivity (newest-first, matching secrets)
- Update stale 'nais config set team' references to 'nais defaults set team' in both config and secret packages
@frodesundby frodesundby merged commit e060e94 into main Mar 19, 2026
19 checks passed
@frodesundby frodesundby deleted the configmap branch March 19, 2026 07:54
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