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()
71
71
Entities . ToEntityMetadata ( t . BaseType ! . GenericTypeArguments [ 0 ] ) . Metadata ) )
72
72
. Select ( hook => new V1MutatingWebhook
73
73
{
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 } ",
75
75
MatchPolicy = "Exact" ,
76
76
AdmissionReviewVersions = new [ ] { "v1" } ,
77
77
SideEffects = "None" ,
@@ -110,7 +110,7 @@ internal async Task RegisterValidators()
110
110
Entities . ToEntityMetadata ( t . BaseType ! . GenericTypeArguments [ 0 ] ) . Metadata ) )
111
111
. Select ( hook => new V1ValidatingWebhook
112
112
{
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 } ",
114
114
MatchPolicy = "Exact" ,
115
115
AdmissionReviewVersions = new [ ] { "v1" } ,
116
116
SideEffects = "None" ,
@@ -140,4 +140,7 @@ internal async Task RegisterValidators()
140
140
await Client . SaveAsync ( validatorConfig ) ;
141
141
}
142
142
}
143
+
144
+ private static string Defaulted ( string ? value , string defaultValue ) =>
145
+ string . IsNullOrWhiteSpace ( value ) ? defaultValue : value ;
143
146
}
You can’t perform that action at this time.
0 commit comments