File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/KubeOps.Operator.Web/Webhooks Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ internal async Task RegisterMutators()
7171 Entities . ToEntityMetadata ( t . BaseType ! . GenericTypeArguments [ 0 ] ) . Metadata ) )
7272 . Select ( hook => new V1MutatingWebhook
7373 {
74- Name = $ "mutate.{ hook . Metadata . SingularName } .{ hook . Metadata . Group } .{ hook . Metadata . Version } ",
74+ Name = $ "mutate.{ hook . Metadata . SingularName } .{ Defaulted ( hook . Metadata . Group , "core" ) } .{ hook . Metadata . Version } ",
7575 MatchPolicy = "Exact" ,
7676 AdmissionReviewVersions = new [ ] { "v1" } ,
7777 SideEffects = "None" ,
@@ -110,7 +110,7 @@ internal async Task RegisterValidators()
110110 Entities . ToEntityMetadata ( t . BaseType ! . GenericTypeArguments [ 0 ] ) . Metadata ) )
111111 . Select ( hook => new V1ValidatingWebhook
112112 {
113- Name = $ "validate.{ hook . Metadata . SingularName } .{ hook . Metadata . Group } .{ hook . Metadata . Version } ",
113+ Name = $ "validate.{ hook . Metadata . SingularName } .{ Defaulted ( hook . Metadata . Group , "core" ) } .{ hook . Metadata . Version } ",
114114 MatchPolicy = "Exact" ,
115115 AdmissionReviewVersions = new [ ] { "v1" } ,
116116 SideEffects = "None" ,
@@ -140,4 +140,7 @@ internal async Task RegisterValidators()
140140 await Client . SaveAsync ( validatorConfig ) ;
141141 }
142142 }
143+
144+ private static string Defaulted ( string ? value , string defaultValue ) =>
145+ string . IsNullOrWhiteSpace ( value ) ? defaultValue : value ;
143146}
You can’t perform that action at this time.
0 commit comments