Skip to content

Commit

Permalink
Update validation of egress gateway (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
lou-lan authored Nov 7, 2023
1 parent 53fbfbf commit eaf8460
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/egressgateway/egress_gateway_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func (egw *EgressGatewayWebhook) EgressGatewayValidate(ctx context.Context, req
return webhook.Denied(fmt.Sprintf("json unmarshal EgressGateway with error: %v", err))
}

if newEg.Spec.NodeSelector.Selector == nil ||
(len(newEg.Spec.NodeSelector.Selector.MatchLabels) == 0 && len(newEg.Spec.NodeSelector.Selector.MatchExpressions) == 0) {
return webhook.Denied("The field spec.nodeSelector.selector is not set")
}

if egw.Config.FileConfig.EnableIPv4 && !egw.Config.FileConfig.EnableIPv6 {
if len(newEg.Spec.Ippools.IPv6) != 0 {
return webhook.Denied("Please do not configure spec.ippools.ipv6, as the current installation settings have not enabled IPv6")
Expand Down

0 comments on commit eaf8460

Please sign in to comment.