Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#997 from rabi/baremetal_im…
Browse files Browse the repository at this point in the history
…ages

Allow users to override baremetal provisioning images
  • Loading branch information
openshift-merge-bot[bot] authored Aug 6, 2024
2 parents fb128d7 + 5f33462 commit e49b0ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
12 changes: 1 addition & 11 deletions controllers/dataplane/openstackdataplanenodeset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,18 +368,8 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
instance.Status.Conditions.MarkUnknown(dataplanev1.NodeSetBareMetalProvisionReadyCondition,
condition.InitReason, condition.InitReason)

// Set Images
if containerImages.OsContainerImage != nil {
instance.Spec.BaremetalSetTemplate.OSContainerImageURL = *containerImages.OsContainerImage
}
if containerImages.AgentImage != nil {
instance.Spec.BaremetalSetTemplate.AgentImageURL = *containerImages.AgentImage
}
if containerImages.ApacheImage != nil {
instance.Spec.BaremetalSetTemplate.ApacheImageURL = *containerImages.ApacheImage
}
isReady, err := deployment.DeployBaremetalSet(ctx, helper, instance,
allIPSets, dnsDetails.ServerAddresses)
allIPSets, dnsDetails.ServerAddresses, containerImages)
if err != nil || !isReady {
return ctrl.Result{}, err
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/dataplane/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
utils "github.com/openstack-k8s-operators/lib-common/modules/common/util"
baremetalv1 "github.com/openstack-k8s-operators/openstack-baremetal-operator/api/v1beta1"
openstackv1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
dataplanev1 "github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1"
)

Expand All @@ -38,6 +39,7 @@ func DeployBaremetalSet(
ctx context.Context, helper *helper.Helper, instance *dataplanev1.OpenStackDataPlaneNodeSet,
ipSets map[string]infranetworkv1.IPSet,
dnsAddresses []string,
containerImages openstackv1.ContainerImages,
) (bool, error) {
baremetalSet := &baremetalv1.OpenStackBaremetalSet{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -52,6 +54,17 @@ func DeployBaremetalSet(
utils.LogForObject(helper, "Reconciling BaremetalSet", instance)
_, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), baremetalSet, func() error {
instance.Spec.BaremetalSetTemplate.DeepCopyInto(&baremetalSet.Spec)
// Set Images
if containerImages.OsContainerImage != nil && instance.Spec.BaremetalSetTemplate.OSContainerImageURL == "" {
baremetalSet.Spec.OSContainerImageURL = *containerImages.OsContainerImage
}
if containerImages.AgentImage != nil && instance.Spec.BaremetalSetTemplate.AgentImageURL == "" {
baremetalSet.Spec.AgentImageURL = *containerImages.AgentImage
}
if containerImages.ApacheImage != nil && instance.Spec.BaremetalSetTemplate.ApacheImageURL == "" {
baremetalSet.Spec.ApacheImageURL = *containerImages.ApacheImage
}

for _, node := range instance.Spec.Nodes {
hostName := node.HostName
ipSet, ok := ipSets[hostName]
Expand Down

0 comments on commit e49b0ae

Please sign in to comment.