Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: set KIC's UserAgent #5019

Merged
merged 1 commit into from
Oct 30, 2023
Merged

feat: set KIC's UserAgent #5019

merged 1 commit into from
Oct 30, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Oct 30, 2023

What this PR does / why we need it:

This sets KIC's user agent so that it can be easily identified in Kubernetes Audit logs:

{
  "kind": "Event",
  "apiVersion": "audit.k8s.io/v1",
  "level": "Request",
  "auditID": "0f4fafa0-6f44-4c3a-b937-717a9cc6b042",
  "stage": "ResponseStarted",
  "requestURI": "/api/v1/services?allowWatchBookmarks=true&resourceVersion=362177&timeoutSeconds=367&watch=true",
  "verb": "watch",
  "user": {
    "username": "kubernetes-admin",
    "groups": [
      "system:masters",
      "system:authenticated"
    ]
  },
  "sourceIPs": [
    "172.18.0.1"
  ],
  "userAgent": "kong-ingress-controller/v2.12.0-189-g5a4d76638",
  "objectRef": {
    "resource": "services",
    "apiVersion": "v1"
  },
  "responseStatus": {
    "metadata": {},
    "code": 200
  },
  "requestReceivedTimestamp": "2023-10-30T17:16:50.566806Z",
  "stageTimestamp": "2023-10-30T17:16:50.567532Z",
  "annotations": {
    "authorization.k8s.io/decision": "allow",
    "authorization.k8s.io/reason": ""
  }
}

Without this change it uses the default user agent: "main/v0.0.0 (linux/arm64) kubernetes/$Format"

Special notes for reviewers

Is kubernetes-ingress-controller/<VERSION> something we want or do we want to use something different?

@pmalek pmalek self-assigned this Oct 30, 2023
@pmalek pmalek requested a review from a team as a code owner October 30, 2023 17:21
Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

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

🆒

in description of the PR it should be

"userAgent": "kong-ingress-controller/v2.12.0-189-g5a4d76638",

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c727d9) 75.3% compared to head (7eece07) 75.3%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5019   +/-   ##
=====================================
  Coverage   75.3%   75.3%           
=====================================
  Files        167     167           
  Lines      18719   18721    +2     
=====================================
+ Hits       14097   14114   +17     
+ Misses      3794    3781   -13     
+ Partials     828     826    -2     
Files Coverage Δ
internal/adminapi/backoff_strategy_konnect.go 100.0% <ø> (ø)
internal/adminapi/client.go 55.8% <ø> (ø)
internal/adminapi/endpoints.go 84.2% <ø> (ø)
internal/adminapi/kong.go 61.9% <ø> (ø)
internal/adminapi/konnect.go 0.0% <ø> (ø)
internal/admission/adminapi_provider.go 89.4% <ø> (ø)
internal/admission/handler.go 59.5% <ø> (ø)
internal/admission/utils.go 81.0% <ø> (ø)
...ion/validation/consumers/credentials/validation.go 96.2% <ø> (ø)
internal/admission/validation/gateway/httproute.go 90.0% <ø> (ø)
... and 109 more

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

@rainest rainest merged commit daa6bc0 into main Oct 30, 2023
44 checks passed
@rainest rainest deleted the set-user-agent branch October 30, 2023 23:49
@pmalek
Copy link
Member Author

pmalek commented Oct 31, 2023

🆒

in description of the PR it should be

"userAgent": "kong-ingress-controller/v2.12.0-189-g5a4d76638",

edited, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants