Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lb uuid to docluster spec #291

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ type DOLoadBalancer struct {
// An object specifying health check settings for the Load Balancer. If omitted, default values will be provided.
// +optional
HealthCheck DOLoadBalancerHealthCheck `json:"healthCheck,omitempty"`
// The DO load balancer UUID. If omitted, a new load balancer will be created.
// +optional
ResourceID string `json:"resourceId,omitempty"`
}

// DOVPC define the DigitalOcean VPC configuration.
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/v1alpha4/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ type DOLoadBalancer struct {
// An object specifying health check settings for the Load Balancer. If omitted, default values will be provided.
// +optional
HealthCheck DOLoadBalancerHealthCheck `json:"healthCheck,omitempty"`
// The DO load balancer UUID. If omitted, a new load balancer will be created.
// +optional
ResourceID string `json:"resourceId,omitempty"`
}

// DOVPC define the DigitalOcean VPC configuration.
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ type DOLoadBalancer struct {
// An object specifying health check settings for the Load Balancer. If omitted, default values will be provided.
// +optional
HealthCheck DOLoadBalancerHealthCheck `json:"healthCheck,omitempty"`
// The DO load balancer UUID. If omitted, a new load balancer will be created.
// +optional
ResourceID string `json:"resourceId,omitempty"`
}

// DOVPC define the DigitalOcean VPC configuration.
Expand Down
12 changes: 12 additions & 0 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_doclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ spec:
maximum: 65535
minimum: 1
type: integer
resourceId:
description: The DO load balancer UUID. If omitted, a new
load balancer will be created.
type: string
type: object
vpc:
description: VPC defines the VPC configuration.
Expand Down Expand Up @@ -323,6 +327,10 @@ spec:
maximum: 65535
minimum: 1
type: integer
resourceId:
description: The DO load balancer UUID. If omitted, a new
load balancer will be created.
type: string
type: object
vpc:
description: VPC defines the VPC configuration.
Expand Down Expand Up @@ -500,6 +508,10 @@ spec:
maximum: 65535
minimum: 1
type: integer
resourceId:
description: The DO load balancer UUID. If omitted, a new
load balancer will be created.
type: string
type: object
vpc:
description: VPC defines the VPC configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ spec:
maximum: 65535
minimum: 1
type: integer
resourceId:
description: The DO load balancer UUID. If omitted,
a new load balancer will be created.
type: string
type: object
vpc:
description: VPC defines the VPC configuration.
Expand Down
9 changes: 8 additions & 1 deletion controllers/docluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ func (r *DOClusterReconciler) reconcile(ctx context.Context, clusterScope *scope
apiServerLoadbalancer.ApplyDefault()

apiServerLoadbalancerRef := clusterScope.APIServerLoadbalancersRef()
loadbalancer, err := networkingsvc.GetLoadBalancer(apiServerLoadbalancerRef.ResourceID)
lbUUID := apiServerLoadbalancerRef.ResourceID

if apiServerLoadbalancer.ResourceID != "" {
lbUUID = apiServerLoadbalancer.ResourceID
}

loadbalancer, err := networkingsvc.GetLoadBalancer(lbUUID)
if err != nil {
return reconcile.Result{}, err
}
Expand All @@ -148,6 +154,7 @@ func (r *DOClusterReconciler) reconcile(ctx context.Context, clusterScope *scope

apiServerLoadbalancerRef.ResourceID = loadbalancer.ID
apiServerLoadbalancerRef.ResourceStatus = infrav1.DOResourceStatus(loadbalancer.Status)
apiServerLoadbalancer.ResourceID = loadbalancer.ID

if apiServerLoadbalancerRef.ResourceStatus != infrav1.DOResourceStatusRunning && loadbalancer.IP == "" {
clusterScope.Info("Waiting on API server Global IP Address")
Expand Down