Skip to content

feat(cmd): add kong-admin-token flag#2123

Open
VarunAthreya wants to merge 6 commits into
mainfrom
feat/admin-token-flag
Open

feat(cmd): add kong-admin-token flag#2123
VarunAthreya wants to merge 6 commits into
mainfrom
feat/admin-token-flag

Conversation

@VarunAthreya

Copy link
Copy Markdown
Member

Add --kong-admin-token flag for Kong Admin API authentication

Summary

Adds a new --kong-admin-token persistent flag that lets users authenticate against Kong's Admin API. The token is injected as a Kong-Admin-Token header on requests to the gateway.

GH: #1730

Changes

  • New --kong-admin-token flag registered on the root command. It can also be set via the DECK_KONG_ADMIN_TOKEN environment variable (bound through Viper), consistent with deck's other config options.
  • Refactored extendHeaders to accept a variadic list of optional headers via a new header{name, value} struct. Headers with an empty value are skipped, so the Kong-Admin-Token header is only added when a token is actually provided.
  • Wired the token into initConfig, appending the Kong-Admin-Token header alongside the existing User-Agent header.

Notes

  • Empty tokens are a no-op — no header is sent if the flag/env var is unset, preserving existing behavior.
  • The variadic refactor keeps the existing User-Agent injection intact while making the helper reusable for future headers.

@CLAassistant

CLAassistant commented Jun 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov-commenter

codecov-commenter commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.48%. Comparing base (25fdf95) to head (33af6ff).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/root.go 0.00% 27 Missing ⚠️
tests/integration/test_utils.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2123      +/-   ##
==========================================
+ Coverage   33.17%   36.48%   +3.30%     
==========================================
  Files          78       78              
  Lines        7433     7477      +44     
==========================================
+ Hits         2466     2728     +262     
+ Misses       4763     4503     -260     
- Partials      204      246      +42     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cmd/root.go Outdated
Comment thread cmd/root.go Outdated
Comment thread cmd/root.go
@VarunAthreya VarunAthreya force-pushed the feat/admin-token-flag branch from 998d7e9 to 1097eb2 Compare June 24, 2026 10:46
Comment thread .github/workflows/integration-enterprise.yaml
harshadixit12
harshadixit12 previously approved these changes Jun 26, 2026
Comment thread tests/integration/rbac_admin_token_test.go Outdated
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.

4 participants