Skip to content

Commit

Permalink
Merge pull request #33 from itayankri/fixed-ip
Browse files Browse the repository at this point in the history
Expose loadBalancerIP
  • Loading branch information
itayankri authored Jan 13, 2023
2 parents 909264c + 60253b8 commit 7869bba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/osrmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type ServiceSpec struct {
Type *corev1.ServiceType `json:"type,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
ExposingServices []string `json:"exposingServices,omitempty"`
LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`
}

func (spec *ServiceSpec) GetType() corev1.ServiceType {
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/osrm.itayankri_osrmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ spec:
items:
type: string
type: array
loadBalancerIP:
type: string
type:
description: Service Type string describes ingress methods for
a service
Expand Down
4 changes: 4 additions & 0 deletions internal/resource/gateway_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (builder *GatewayServiceBuilder) Update(object client.Object, siblings []ru
service.Spec.Type = builder.Instance.Spec.Service.GetType()
builder.setAnnotations(service)

if builder.Instance.Spec.Service.LoadBalancerIP != nil {
service.Spec.LoadBalancerIP = *builder.Instance.Spec.Service.LoadBalancerIP
}

if err := controllerutil.SetControllerReference(builder.Instance, service, builder.Scheme); err != nil {
return fmt.Errorf("failed setting controller reference: %v", err)
}
Expand Down

0 comments on commit 7869bba

Please sign in to comment.