Skip to content

Commit

Permalink
Update conditions under which metal3 pod would be deployed
Browse files Browse the repository at this point in the history
Update code to accomodate baremetal UPI deployments where the platform
type would be Baremetal without a need to deploy the metal3 pod.
  • Loading branch information
sadasu committed May 11, 2020
1 parent f6f0498 commit e11509b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pkg/operator/baremetal_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ type BaremetalProvisioningConfig struct {
ProvisioningOSDownloadURL string
}

func isBaremetalProvisioningConfigAvailable(dc dynamic.Interface, configName string) bool {
provisioningClient := dc.Resource(provisioningGVR)
_, err := provisioningClient.Get(context.Background(), configName, metav1.GetOptions{})
if err != nil {
return false
}
return true
}

func getBaremetalProvisioningConfig(dc dynamic.Interface, configName string) (BaremetalProvisioningConfig, error) {
provisioningClient := dc.Resource(provisioningGVR)
provisioningConfig, err := provisioningClient.Get(context.Background(), configName, metav1.GetOptions{})
Expand Down
7 changes: 4 additions & 3 deletions pkg/operator/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ func (optr *Operator) syncAll(config *OperatorConfig) error {
}
glog.V(3).Info("Synced up all machine-api-controller components")

// In addition, if the Provider is BareMetal, then bring up
// the baremetal-operator pod
if config.BaremetalControllers.BaremetalOperator != "" {
// In addition, if the Provider is BareMetal and a provisioning config is available,
// then bring up the baremetal-operator pod
if config.BaremetalControllers.BaremetalOperator != "" &&
isBaremetalProvisioningConfigAvailable(optr.dynamicClient, baremetalProvisioningCR) {
if err := optr.syncBaremetalControllers(config); err != nil {
if err := optr.statusDegraded(err.Error()); err != nil {
// Just log the error here. We still want to
Expand Down

0 comments on commit e11509b

Please sign in to comment.