Skip to content

Commit

Permalink
Default firewall rule protocols as promised. (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Feb 15, 2024
1 parent d077dc4 commit ae33d76
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/metal-api/internal/service/machine-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,10 @@ func createMachineAllocationSpec(ds *datastore.RethinkStore, machineRequest v1.M
for _, ruleSpec := range firewallRequest.FirewallRules.Egress {
ruleSpec := ruleSpec

if ruleSpec.Protocol == "" {
ruleSpec.Protocol = string(metal.ProtocolTCP)
}

protocol, err := metal.ProtocolFromString(ruleSpec.Protocol)
if err != nil {
return nil, err
Expand All @@ -1068,6 +1072,10 @@ func createMachineAllocationSpec(ds *datastore.RethinkStore, machineRequest v1.M
for _, ruleSpec := range firewallRequest.FirewallRules.Ingress {
ruleSpec := ruleSpec

if ruleSpec.Protocol == "" {
ruleSpec.Protocol = string(metal.ProtocolTCP)
}

protocol, err := metal.ProtocolFromString(ruleSpec.Protocol)
if err != nil {
return nil, err
Expand Down

0 comments on commit ae33d76

Please sign in to comment.