Skip to content

Commit 974f1fd

Browse files
committed
pkg/infra/clusterapi: add BootstrapHasPublicIP
Adds a method to the cluster-api-provider interface to indicate whether a platform expects its bootstrap node to have a public IP address in a public cluster. We can use this value to determine whether the external IP should be waited for during the machine ready checks. This ensures that the external IP will be populated if it is needed for gather bootstrap.
1 parent 3a7f60a commit 974f1fd

File tree

9 files changed

+38
-0
lines changed

9 files changed

+38
-0
lines changed

pkg/infrastructure/aws/clusterapi/aws.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type Provider struct{}
3939
// Name gives the name of the provider, AWS.
4040
func (*Provider) Name() string { return awstypes.Name }
4141

42+
// BootstrapHasPublicIP indicates that machine ready checks
43+
// should wait for an ExternalIP in the status.
44+
func (*Provider) BootstrapHasPublicIP() bool { return true }
45+
4246
// PreProvision creates the IAM roles used by all nodes in the cluster.
4347
func (*Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionInput) error {
4448
if err := createIAMRoles(ctx, in.InfraID, in.InstallConfig); err != nil {

pkg/infrastructure/azure/azure.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ func (p *Provider) Name() string {
5151
return aztypes.Name
5252
}
5353

54+
// BootstrapHasPublicIP indicates that an ExternalIP is not
55+
// required in the machine ready checks.
56+
func (*Provider) BootstrapHasPublicIP() bool { return false }
57+
5458
// PreProvision is called before provisioning using CAPI controllers has begun.
5559
func (p *Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionInput) error {
5660
session, err := in.InstallConfig.Azure.Session()

pkg/infrastructure/clusterapi/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ import (
1818
type Provider interface {
1919
// Name provides the name for the cloud platform.
2020
Name() string
21+
22+
// BootstrapHasPublicIP indicates whether a public IP address
23+
// is expected on the bootstrap node in a public cluster.
24+
// When BootstrapHasPublicIP returns true, the machine ready checks
25+
// wait for an ExternalIP address to be populated in the machine status.
26+
BootstrapHasPublicIP() bool
2127
}
2228

2329
// PreProvider defines the PreProvision hook, which is called prior to

pkg/infrastructure/gcp/clusterapi/clusterapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func (p Provider) Name() string {
3737
return gcptypes.Name
3838
}
3939

40+
// BootstrapHasPublicIP indicates that machine ready checks
41+
// should wait for an ExternalIP in the status.
42+
func (Provider) BootstrapHasPublicIP() bool { return true }
43+
4044
// PreProvision is called before provisioning using CAPI controllers has initiated.
4145
// GCP resources that are not created by CAPG (and are required for other stages of the install) are
4246
// created here using the gcp sdk.

pkg/infrastructure/ibmcloud/clusterapi/clusterapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ func (p Provider) Name() string {
1818
return ibmcloudtypes.Name
1919
}
2020

21+
// BootstrapHasPublicIP indicates that an ExternalIP is not
22+
// required in the machine ready checks.
23+
func (Provider) BootstrapHasPublicIP() bool { return false }
24+
2125
// PreProvision creates the IBM Cloud objects required prior to running capibmcloud.
2226
func (p Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionInput) error {
2327
return nil

pkg/infrastructure/nutanix/clusterapi/clusterapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ func (p Provider) Name() string {
2323
return nutanixtypes.Name
2424
}
2525

26+
// BootstrapHasPublicIP indicates that an ExternalIP is not
27+
// required in the machine ready checks.
28+
func (Provider) BootstrapHasPublicIP() bool { return false }
29+
2630
// PreProvision creates the resources required prior to running capi nutanix controller.
2731
func (p Provider) PreProvision(ctx context.Context, in infracapi.PreProvisionInput) error {
2832
// create categories with name "kubernetes-io-cluster-<cluster_id>" and values ["owned", "shared"].

pkg/infrastructure/openstack/clusterapi/clusterapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func (p Provider) Name() string {
3131
return openstack.Name
3232
}
3333

34+
// BootstrapHasPublicIP indicates that an ExternalIP is not
35+
// required in the machine ready checks.
36+
func (Provider) BootstrapHasPublicIP() bool { return false }
37+
3438
var _ clusterapi.PreProvider = Provider{}
3539

3640
// PreProvision tags the VIP ports, and creates the security groups and the

pkg/infrastructure/powervs/clusterapi/powervs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ func (p Provider) Name() string {
3838
return powervstypes.Name
3939
}
4040

41+
// BootstrapHasPublicIP indicates that an ExternalIP is not
42+
// required in the machine ready checks.
43+
func (Provider) BootstrapHasPublicIP() bool { return false }
44+
4145
func leftInContext(ctx context.Context) time.Duration {
4246
deadline, ok := ctx.Deadline()
4347
if !ok {

pkg/infrastructure/vsphere/clusterapi/clusterapi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ func (p Provider) Name() string {
2727
return vsphere.Name
2828
}
2929

30+
// BootstrapHasPublicIP indicates that an ExternalIP is not
31+
// required in the machine ready checks.
32+
func (Provider) BootstrapHasPublicIP() bool { return false }
33+
3034
func initializeFoldersAndTemplates(ctx context.Context, cachedImage string, failureDomain vsphere.FailureDomain, session *session.Session, diskType vsphere.DiskType, clusterID, tagID string) error {
3135
finder := session.Finder
3236

0 commit comments

Comments
 (0)