Skip to content

Commit

Permalink
fix: merge ports and ingress configs correctly in NetworkRuleConfig
Browse files Browse the repository at this point in the history
Use `replace` patch merging strategy for `portSelector.ports` and `ingress`es in `NetworkRuleConfig` document, so that they do not have duplicate entries and/or fail on port range validation.

Closes #8136.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
  • Loading branch information
utkuozdemir committed Jan 11, 2024
1 parent dea9bda commit ba88678
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/machinery/config/types/network/rule_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type RuleConfigV1Alpha1 struct {
PortSelector RulePortSelector `yaml:"portSelector"`
// description: |
// Ingress defines which source subnets are allowed to access the host ports/protocols defined by the `portSelector`.
Ingress IngressConfig `yaml:"ingress"`
Ingress IngressConfig `yaml:"ingress" merge:"replace"`
}

// RulePortSelector is a port selector for the network rule.
Expand All @@ -68,7 +68,7 @@ type RulePortSelector struct {
// examplePortRanges1()
// - value: >
// examplePortRanges2()
Ports PortRanges `yaml:"ports"`
Ports PortRanges `yaml:"ports" merge:"replace"`
// description: |
// Protocol defines traffic protocol (e.g. TCP or UDP).
// values:
Expand Down

0 comments on commit ba88678

Please sign in to comment.