Skip to content

Commit

Permalink
Update configmap to include interfaces
Browse files Browse the repository at this point in the history
Adapting to IMS update in:
openshift-kni/oran-o2ims#201

Signed-off-by: Don Penney <[email protected]>
  • Loading branch information
donpenney committed Sep 18, 2024
1 parent 9ca2001 commit cf034b1
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 478 deletions.
93 changes: 64 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ $ oc get nodepools.hardwaremanagement.oran.openshift.io -n oran-hwmgr-plugin-tes
apiVersion: hardwaremanagement.oran.openshift.io/v1alpha1
kind: NodePool
metadata:
creationTimestamp: "2024-09-05T12:50:47Z"
creationTimestamp: "2024-09-18T17:29:00Z"
finalizers:
- oran-hwmgr-plugin-test.oran.openshift.io/nodepool-finalizer
generation: 1
name: np1
namespace: oran-hwmgr-plugin-test
resourceVersion: "16208137"
uid: 5486b5e7-415b-4f63-a443-8cd88a32fef6
resourceVersion: "15851"
uid: 00be582c-3026-4421-bb92-b394415cff6b
spec:
cloudID: testcloud-1
location: ottawa
Expand All @@ -89,7 +89,7 @@ spec:
site: building-1
status:
conditions:
- lastTransitionTime: "2024-09-05T12:51:08Z"
- lastTransitionTime: "2024-09-18T17:29:21Z"
message: Created
reason: Completed
status: "True"
Expand All @@ -102,28 +102,31 @@ $ oc get nodes.hardwaremanagement.oran.openshift.io -n oran-hwmgr-plugin-test du
apiVersion: hardwaremanagement.oran.openshift.io/v1alpha1
kind: Node
metadata:
creationTimestamp: "2024-09-05T12:50:58Z"
creationTimestamp: "2024-09-18T17:29:11Z"
generation: 1
name: dummy-sp-64g-1
namespace: oran-hwmgr-plugin-test
resourceVersion: "16208107"
uid: 0838467c-f73e-4c5b-86cf-0083352243ce
resourceVersion: "15831"
uid: a0021f5a-34bc-4e5f-95c4-8372f4ce3fa3
spec:
groupName: master
hwProfile: profile-spr-single-processor-64G
nodePool: testcloud-1
status:
bmc:
address: idrac-virtualmedia+https://192.168.2.1/redfish/v1/Systems/System.Embedded.1
credentialsName: bmcSecret-dummy-sp-64g-1
bootMACAddress: c6:b6:13:a0:02:01
credentialsName: dummy-sp-64g-1-bmc-secret
conditions:
- lastTransitionTime: "2024-09-05T12:50:58Z"
- lastTransitionTime: "2024-09-18T17:29:11Z"
message: Provisioned
reason: Completed
status: "True"
type: Provisioned
hostname: dummy-sp-64g-1.localhost
interfaces:
- label: bootable-interface
macAddress: c6:b6:13:a0:02:01
name: eth0

$ oc get configmap -n oran-hwmgr-plugin-test nodelist -o yaml
apiVersion: v1
Expand All @@ -143,65 +146,97 @@ data:
hwprofile: profile-spr-dual-processor-128G
bmc:
address: "idrac-virtualmedia+https://192.168.1.0/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-dp-128g-0"
bootMACAddress: "c6:b6:13:a0:01:00"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:00"
hostname: "dummy-dp-128g-0.localhost"
dummy-dp-128g-1:
hwprofile: profile-spr-dual-processor-128G
bmc:
address: "idrac-virtualmedia+https://192.168.1.1/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-dp-128g-1"
bootMACAddress: "c6:b6:13:a0:01:01"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:01"
hostname: "dummy-dp-128g-1.localhost"
dummy-dp-128g-2:
hwprofile: profile-spr-dual-processor-128G
bmc:
address: "idrac-virtualmedia+https://192.168.1.2/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-dp-128g-2"
bootMACAddress: "c6:b6:13:a0:01:02"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:02"
hostname: "dummy-dp-128g-2.localhost"
dummy-sp-64g-0:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.0/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-sp-64g-0"
bootMACAddress: "c6:b6:13:a0:02:00"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:00"
hostname: "dummy-sp-64g-0.localhost"
dummy-sp-64g-1:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.1/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-sp-64g-1"
bootMACAddress: "c6:b6:13:a0:02:01"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:01"
hostname: "dummy-sp-64g-1.localhost"
dummy-sp-64g-2:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.2/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-sp-64g-2"
bootMACAddress: "c6:b6:13:a0:02:02"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:02"
hostname: "dummy-sp-64g-2.localhost"
dummy-sp-64g-3:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.3/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-sp-64g-3"
bootMACAddress: "c6:b6:13:a0:02:03"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:03"
hostname: "dummy-sp-64g-3.localhost"
dummy-sp-64g-4:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.4/redfish/v1/Systems/System.Embedded.1"
credentialsName: "bmcSecret-dummy-sp-64g-4"
bootMACAddress: "c6:b6:13:a0:02:04"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:04"
hostname: "dummy-sp-64g-4.localhost"
kind: ConfigMap
metadata:
creationTimestamp: "2024-09-05T12:47:59Z"
creationTimestamp: "2024-09-18T17:28:38Z"
name: nodelist
namespace: oran-hwmgr-plugin-test
resourceVersion: "16208103"
uid: f0cc6238-15a1-40fd-abf1-4dcd0e32a531
resourceVersion: "15829"
uid: e6dfe91c-0713-46d2-b3e5-b883c3d8b8c5

```

Expand Down
40 changes: 32 additions & 8 deletions configmap/example-nodelist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,85 @@ data:
address: "idrac-virtualmedia+https://192.168.1.0/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:01:00"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:00"
hostname: "dummy-dp-128g-0.localhost"
dummy-dp-128g-1:
hwprofile: profile-spr-dual-processor-128G
bmc:
address: "idrac-virtualmedia+https://192.168.1.1/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:01:01"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:01"
hostname: "dummy-dp-128g-1.localhost"
dummy-dp-128g-2:
hwprofile: profile-spr-dual-processor-128G
bmc:
address: "idrac-virtualmedia+https://192.168.1.2/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:01:02"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:01:02"
hostname: "dummy-dp-128g-2.localhost"
dummy-sp-64g-0:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.0/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:02:00"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:00"
hostname: "dummy-sp-64g-0.localhost"
dummy-sp-64g-1:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.1/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:02:01"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:01"
hostname: "dummy-sp-64g-1.localhost"
dummy-sp-64g-2:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.2/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:02:02"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:02"
hostname: "dummy-sp-64g-2.localhost"
dummy-sp-64g-3:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.3/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:02:03"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:03"
hostname: "dummy-sp-64g-3.localhost"
dummy-sp-64g-4:
hwprofile: profile-spr-single-processor-64G
bmc:
address: "idrac-virtualmedia+https://192.168.2.4/redfish/v1/Systems/System.Embedded.1"
username-base64: YWRtaW4=
password-base64: bXlwYXNz
bootMACAddress: "c6:b6:13:a0:02:04"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "c6:b6:13:a0:02:04"
hostname: "dummy-sp-64g-4.localhost"
11 changes: 4 additions & 7 deletions configmap/generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@ function nodes {
address: "idrac-virtualmedia+https://${ip}/redfish/v1/Systems/System.Embedded.1"
username-base64: ${USERNAME_BASE64}
password-base64: ${PASSWORD_BASE64}
bootMACAddress: "${mac}"
interfaces:
- name: eth0
label: bootable-interface
macAddress: "${mac}"
hostname: "${nodename}.localhost"
EOF
done
done
}

# bmc: |
# {
# "address": "idrac-virtualmedia+https://${ip}/redfish/v1/Systems/System.Embedded.1",
# "credentialsName": "bmcSecret-${nodename}"
# }

#
# Process cmdline arguments
#
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240903165820-cebcd5f0272a
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240918174245-ac8a45e122a5
k8s.io/api v0.28.3
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240903165820-cebcd5f0272a h1:ntdRx64DfNZkTriFIwXDoWMHiu/i5AvP/ekaJEQ3I24=
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240903165820-cebcd5f0272a/go.mod h1:owBMlvtNeWmBGKEdusRCmtIxdxBIFinYlCpaVRfYSoo=
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240918174245-ac8a45e122a5 h1:gff7gL/cgi8CVQGYKCxac56vki4NUZzRV6Eov65RP58=
github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20240918174245-ac8a45e122a5/go.mod h1:owBMlvtNeWmBGKEdusRCmtIxdxBIFinYlCpaVRfYSoo=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
10 changes: 5 additions & 5 deletions internal/service/hwmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ type cmBmcInfo struct {
}

type cmNodeInfo struct {
HwProfile string `json:"hwprofile" yaml:"hwprofile"`
BMC *cmBmcInfo `json:"bmc,omitempty"`
BootMACAddress string `json:"bootMACAddress,omitempty"`
Hostname string `json:"hostname,omitempty"`
HwProfile string `json:"hwprofile" yaml:"hwprofile"`
BMC *cmBmcInfo `json:"bmc,omitempty"`
Interfaces []*hwmgmtv1alpha1.Interface `json:"interfaces,omitempty"`
Hostname string `json:"hostname,omitempty"`
}

type cmResources struct {
Expand Down Expand Up @@ -351,8 +351,8 @@ func (h *HwMgrService) UpdateNodeStatus(ctx context.Context, nodename string, in
Address: info.BMC.Address,
CredentialsName: bmcSecretName(nodename),
}
node.Status.BootMACAddress = info.BootMACAddress
node.Status.Hostname = info.Hostname
node.Status.Interfaces = info.Interfaces

utils.SetStatusCondition(&node.Status.Conditions,
hwmgmtv1alpha1.Provisioned,
Expand Down

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

Loading

0 comments on commit cf034b1

Please sign in to comment.