Skip to content

Commit 2bf17ce

Browse files
Merge pull request #134803 from enj/enj/f/constrained_impersonation
KEP-5284: Implement Constrained Impersonation Kubernetes-commit: 3d595e369174450a4d81269ca8f97032cf0b4ab6
2 parents d7d2bca + d2152ec commit 2bf17ce

26 files changed

+2735
-75
lines changed

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ require (
4848
gopkg.in/evanphx/json-patch.v4 v4.13.0
4949
gopkg.in/go-jose/go-jose.v2 v2.6.3
5050
gopkg.in/natefinch/lumberjack.v2 v2.2.1
51-
k8s.io/api v0.0.0-20251101152117-8b150d50efc9
52-
k8s.io/apimachinery v0.0.0-20251101151749-05faff5a672c
53-
k8s.io/client-go v0.0.0-20251103194327-6f5c1adc653d
51+
k8s.io/api v0.0.0-20251105002758-78deebe13046
52+
k8s.io/apimachinery v0.0.0-20251104194212-729c13d7df38
53+
k8s.io/client-go v0.0.0-20251105003230-5aa3ca7f2ac5
5454
k8s.io/component-base v0.0.0-20251101153715-0c7fa86d2ef3
5555
k8s.io/klog/v2 v2.130.1
5656
k8s.io/kms v0.0.0-20251031154137-67fac28309db
@@ -123,3 +123,5 @@ require (
123123
gopkg.in/inf.v0 v0.9.1 // indirect
124124
gopkg.in/yaml.v3 v3.0.1 // indirect
125125
)
126+
127+
replace k8s.io/api => k8s.io/api v0.0.0-20251105002758-60b622f4f36b

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,12 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs
299299
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
300300
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
301301
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
302-
k8s.io/api v0.0.0-20251101152117-8b150d50efc9 h1:P1VJ0Cta+1g3ZOAduWfXlwivtOut0RkvBLl2U6IKJIk=
303-
k8s.io/api v0.0.0-20251101152117-8b150d50efc9/go.mod h1:KCNAyXzKdz0tzxA8m4XMnxPRckvU84IskGAh7Qf/5wE=
304-
k8s.io/apimachinery v0.0.0-20251101151749-05faff5a672c h1:s4JMRNZUE03qLV8X6sQaP94dfl0HG+dQcSBnYYY+28g=
305-
k8s.io/apimachinery v0.0.0-20251101151749-05faff5a672c/go.mod h1:dR9KPaf5L0t2p9jZg/wCGB4b3ma2sXZ2zdNqILs+Sak=
306-
k8s.io/client-go v0.0.0-20251103194327-6f5c1adc653d h1:XT0xyDV32YoL7HGeSosDNnbOJ2PK7tZsOId030YgeNU=
307-
k8s.io/client-go v0.0.0-20251103194327-6f5c1adc653d/go.mod h1:x5bqc6UixzIl5pYceAWeJOBZOUoZoghDVHHokZarYXk=
302+
k8s.io/api v0.0.0-20251105002758-60b622f4f36b h1:kQIH9+m06rrUrGSlYZfgU4NVTT1MXFxDczGsNAndlQA=
303+
k8s.io/api v0.0.0-20251105002758-60b622f4f36b/go.mod h1:WAtHXlm214kKcYg1bP2G5eefhLoi/NCF6sxUeTjUXMs=
304+
k8s.io/apimachinery v0.0.0-20251104194212-729c13d7df38 h1:5jRAlNQwmLaPNhf9mfhacvZKFF8fE4nfULiBul0PrGM=
305+
k8s.io/apimachinery v0.0.0-20251104194212-729c13d7df38/go.mod h1:dR9KPaf5L0t2p9jZg/wCGB4b3ma2sXZ2zdNqILs+Sak=
306+
k8s.io/client-go v0.0.0-20251105003230-5aa3ca7f2ac5 h1:zfG89yYdzEweXvymwXD810niLOIvcKD0qq67yJVKxbQ=
307+
k8s.io/client-go v0.0.0-20251105003230-5aa3ca7f2ac5/go.mod h1:0nAtsAwkk8yBzjuzDlbrxZghpDWfhA2alzTAVP+GyyM=
308308
k8s.io/component-base v0.0.0-20251101153715-0c7fa86d2ef3 h1:LSl5cFypu2A5v/GO96gWryJRrythlDlQOBX/XtXyq04=
309309
k8s.io/component-base v0.0.0-20251101153715-0c7fa86d2ef3/go.mod h1:Hg4vHzdLBfaiC57ocfXXPqSKTvLogos0Z5t/YAezWgU=
310310
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=

pkg/apis/audit/types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ type Event struct {
9797
// Impersonated user information.
9898
// +optional
9999
ImpersonatedUser *authnv1.UserInfo
100+
// AuthenticationMetadata contains details about how the request was authenticated.
101+
// +optional
102+
AuthenticationMetadata *AuthenticationMetadata
103+
100104
// Source IPs, from where the request originated and intermediate proxies.
101105
// The source IPs are listed from (in order):
102106
// 1. X-Forwarded-For request header IPs
@@ -147,6 +151,13 @@ type Event struct {
147151
Annotations map[string]string
148152
}
149153

154+
type AuthenticationMetadata struct {
155+
// ImpersonationConstraint is the verb associated with the constrained impersonation mode that was used to authorize
156+
// the ImpersonatedUser associated with this audit event. It is only set when constrained impersonation was used.
157+
// +optional
158+
ImpersonationConstraint string
159+
}
160+
150161
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
151162

152163
// EventList is a list of audit Events.

pkg/apis/audit/v1/generated.pb.go

Lines changed: 188 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/audit/v1/generated.proto

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/audit/v1/generated.protomessage.pb.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/audit/v1/types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ type Event struct {
9090
// Impersonated user information.
9191
// +optional
9292
ImpersonatedUser *authnv1.UserInfo `json:"impersonatedUser,omitempty" protobuf:"bytes,7,opt,name=impersonatedUser"`
93+
// AuthenticationMetadata contains details about how the request was authenticated.
94+
// +optional
95+
AuthenticationMetadata *AuthenticationMetadata `json:"authenticationMetadata,omitempty" protobuf:"bytes,17,opt,name=authenticationMetadata"`
9396
// Source IPs, from where the request originated and intermediate proxies.
9497
// The source IPs are listed from (in order):
9598
// 1. X-Forwarded-For request header IPs
@@ -142,6 +145,13 @@ type Event struct {
142145
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,15,rep,name=annotations"`
143146
}
144147

148+
type AuthenticationMetadata struct {
149+
// ImpersonationConstraint is the verb associated with the constrained impersonation mode that was used to authorize
150+
// the ImpersonatedUser associated with this audit event. It is only set when constrained impersonation was used.
151+
// +optional
152+
ImpersonationConstraint string `json:"impersonationConstraint,omitempty" protobuf:"bytes,1,opt,name=impersonationConstraint"`
153+
}
154+
145155
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
146156

147157
// EventList is a list of audit Events.

0 commit comments

Comments
 (0)