Skip to content
Open
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/onsi/ginkgo/v2 v2.26.0
github.com/onsi/gomega v1.38.2
github.com/openshift/api v3.9.0+incompatible
github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251004061941-fc4a6b62f14f
github.com/openstack-k8s-operators/cinder-operator/api v0.6.1-0.20251002160033-d2a363bddc32
github.com/openstack-k8s-operators/designate-operator/api v0.6.1-0.20251002063410-b6cf1b1e0e23
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87 h1:JtLhaGpSEconE+1IKmIgCOof/Len5ceG6H1pk43yv5U=
github.com/openshift/client-go v0.0.0-20240528061634-b054aa794d87/go.mod h1:3IPD4U0qyovZS4EFady2kqY32m8lGcbs/Wx+yprg9z8=
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251004061941-fc4a6b62f14f h1:x+5NGi9zVckLt4bWi1mv7sABcHjInev3BgTOhBMcOCg=
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251004061941-fc4a6b62f14f/go.mod h1:8ANa5p+Iv4lhYVTOVzRYF7usutis46e3v70ljCAmKQI=
github.com/openstack-k8s-operators/cinder-operator/api v0.6.1-0.20251002160033-d2a363bddc32 h1:COOGq+Dq2SXj5LD8W00iyE2lmn3bFt2b+wjJyTmS94I=
Expand Down
7 changes: 7 additions & 0 deletions pkg/dataplane/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper,
// add the NodeSet name variable
nodeSetGroup.Vars["edpm_nodeset_name"] = instance.Name

// add ID of the RHOSO cluster to the ansible variables
nodeSetGroup.Vars["edpm_rhoso_cluster_id"], err = util.GetRhosoClusterID(ctx, instance.Namespace)
if err != nil {
utils.LogErrorForObject(helper, err, "could not get OpenShift Cluster ID", instance)
return "", err
}

isDisconnected, err := util.IsDisconnectedOCP(ctx, helper)
if err != nil {
return "", err
Expand Down
40 changes: 40 additions & 0 deletions pkg/dataplane/util/cluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2025.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package util //nolint:revive // util is an acceptable package name in this context

import (
"context"
"fmt"

configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
ctrl "sigs.k8s.io/controller-runtime"
)

// GetRhosoClusterID - retrieves the RHOSO cluster ID
func GetRhosoClusterID(ctx context.Context, namespace string) (string, error) {
configClient, err := configv1client.NewForConfig(ctrl.GetConfigOrDie())
if err != nil {
return "", err
}
clusterVersion, err := configClient.ClusterVersions().Get(ctx, "version", metav1.GetOptions{})
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%s", clusterVersion.Spec.ClusterID, namespace), nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,24 @@ var _ = Describe("Dataplane NodeSet Test", func() {
})
})

When("A Dataplane nodeset is created", func() {
BeforeEach(func() {
DeferCleanup(th.DeleteInstance, CreateNetConfig(dataplaneNetConfigName, DefaultNetConfigSpec()))
DeferCleanup(th.DeleteInstance, CreateDNSMasq(dnsMasqName, DefaultDNSMasqSpec()))
DeferCleanup(th.DeleteInstance, CreateDataplaneNodeSet(dataplaneNodeSetName, DefaultDataPlaneNoNodeSetSpec(false)))
CreateSSHSecret(dataplaneSSHSecretName)
CreateCABundleSecret(caBundleSecretName)
SimulateDNSMasqComplete(dnsMasqName)
SimulateIPSetComplete(dataplaneNodeName)
SimulateDNSDataComplete(dataplaneNodeSetName)
})
It("should have the RHOSO cluster ID set in the Ansible inventory", func() {
secret := th.GetSecret(dataplaneSecretName)
Expect(secret.Data["inventory"]).Should(
ContainSubstring("edpm_rhoso_cluster_id"))
})
})

When("TLS is enabled", func() {
tlsEnabled := true
When("A Dataplane resource is created with PreProvisioned nodes, no deployment", func() {
Expand Down