Skip to content

Commit

Permalink
refactor(webhook): add defaulter webhook for cable driver
Browse files Browse the repository at this point in the history
  • Loading branch information
tunahanertekin committed Apr 4, 2024
1 parent 4e4214e commit 1a79a60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/v1alpha1/submariner_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func (r *Submariner) Default() {

r.SetName(GlobalSubmarinerResourceName)
r.setInstanceType()
r.setCableDriver()

if instanceType := r.getInstanceType(); instanceType == InstanceTypeCloud {
r.generatePresharedKey()
Expand Down Expand Up @@ -136,6 +137,12 @@ func (r *Submariner) setInstanceType() {
r.Spec.InstanceType = r.getInstanceType()
}

func (r *Submariner) setCableDriver() {
if r.Spec.CableDriver == "" {
r.Spec.CableDriver = "libreswan"
}
}

func (r *Submariner) getInstanceType() InstanceType {
tenancy := r.GetTenancySelectors()
if tenancy.RobolaunchPhysicalInstance != "" {
Expand Down

0 comments on commit 1a79a60

Please sign in to comment.