Skip to content

Commit

Permalink
feat: make docker machine bootstrap timeout configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Salas <carlos.salas@suse.com>
  • Loading branch information
salasberryfin committed Jan 3, 2024
1 parent 624f892 commit cb28f82
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
4 changes: 4 additions & 0 deletions test/infrastructure/docker/api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,7 @@ func Convert_v1beta1_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemp
func Convert_v1beta1_DockerLoadBalancer_To_v1alpha4_DockerLoadBalancer(in *infrav1.DockerLoadBalancer, out *DockerLoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1beta1_DockerLoadBalancer_To_v1alpha4_DockerLoadBalancer(in, out, s)
}

func Convert_v1beta1_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in *infrav1.DockerMachineSpec, out *DockerMachineSpec, s apiconversion.Scope) error {
return autoConvert_v1beta1_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in, out, s)
}
16 changes: 6 additions & 10 deletions test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go

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

5 changes: 5 additions & 0 deletions test/infrastructure/docker/api/v1beta1/dockermachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ type DockerMachineSpec struct {
// When removing also remove from staticcheck exclude-rules for SA1019 in golangci.yml.
// +optional
Bootstrapped bool `json:"bootstrapped,omitempty"`

// BootstrapTimeout is the total time (in minutes) to wait for the machine to bootstrap before timing out.
// Defaults to 3 minutes if not set.
// +optional
BootstrapTimeout int `json:"bootstrapTimeout,omitempty"`
}

// Mount specifies a host volume to mount into a container.
Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ func (r *DockerMachineReconciler) reconcileNormal(ctx context.Context, cluster *

// if the machine isn't bootstrapped, only then run bootstrap scripts
if !dockerMachine.Spec.Bootstrapped {
timeoutCtx, cancel := context.WithTimeout(ctx, 3*time.Minute)
if dockerMachine.Spec.BootstrapTimeout == 0 {
dockerMachine.Spec.BootstrapTimeout = 3
}
timeoutCtx, cancel := context.WithTimeout(ctx, time.Duration(dockerMachine.Spec.BootstrapTimeout)*time.Minute)
defer cancel()

// Check for bootstrap success
Expand Down

0 comments on commit cb28f82

Please sign in to comment.