@@ -142,6 +142,9 @@ type crdInfo struct {
142
142
spec * apiextensionsv1.CustomResourceDefinitionSpec
143
143
acceptedNames * apiextensionsv1.CustomResourceDefinitionNames
144
144
145
+ // Deprecated per version
146
+ deprecated map [string ]bool
147
+
145
148
// Warnings per version
146
149
warnings map [string ][]string
147
150
@@ -329,6 +332,7 @@ func (r *crdHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
329
332
return
330
333
}
331
334
335
+ deprecated := crdInfo .deprecated [requestInfo .APIVersion ]
332
336
for _ , w := range crdInfo .warnings [requestInfo .APIVersion ] {
333
337
warning .AddWarning (req .Context (), "" , w )
334
338
}
@@ -370,7 +374,7 @@ func (r *crdHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
370
374
}
371
375
372
376
if handlerFunc != nil {
373
- handlerFunc = metrics .InstrumentHandlerFunc (verb , requestInfo .APIGroup , requestInfo .APIVersion , resource , subresource , scope , metrics .APIServerComponent , false , "" , handlerFunc )
377
+ handlerFunc = metrics .InstrumentHandlerFunc (verb , requestInfo .APIGroup , requestInfo .APIVersion , resource , subresource , scope , metrics .APIServerComponent , deprecated , "" , handlerFunc )
374
378
handler := genericfilters .WithWaitGroup (handlerFunc , longRunningFilter , crdInfo .waitGroup )
375
379
handler .ServeHTTP (w , req )
376
380
return
@@ -620,6 +624,7 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
620
624
storages := map [string ]customresource.CustomResourceStorage {}
621
625
statusScopes := map [string ]* handlers.RequestScope {}
622
626
scaleScopes := map [string ]* handlers.RequestScope {}
627
+ deprecated := map [string ]bool {}
623
628
warnings := map [string ][]string {}
624
629
625
630
equivalentResourceRegistry := runtime .NewEquivalentResourceRegistry ()
@@ -881,6 +886,7 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
881
886
statusScopes [v .Name ] = & statusScope
882
887
883
888
if v .Deprecated {
889
+ deprecated [v .Name ] = true
884
890
if utilfeature .DefaultFeatureGate .Enabled (features .WarningHeaders ) {
885
891
if v .DeprecationWarning != nil {
886
892
warnings [v .Name ] = append (warnings [v .Name ], * v .DeprecationWarning )
@@ -898,6 +904,7 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
898
904
requestScopes : requestScopes ,
899
905
scaleRequestScopes : scaleScopes ,
900
906
statusRequestScopes : statusScopes ,
907
+ deprecated : deprecated ,
901
908
warnings : warnings ,
902
909
storageVersion : storageVersion ,
903
910
waitGroup : & utilwaitgroup.SafeWaitGroup {},
0 commit comments