Skip to content

Commit ec5a7a4

Browse files
eelgaevtsorya
authored andcommitted
NVIDIA-475,NVIDIA-473: Add ignition generator
1 parent c30411a commit ec5a7a4

395 files changed

Lines changed: 27560 additions & 3210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ linters:
3131
- name: import-shadowing
3232
exclusions:
3333
generated: lax
34+
presets:
35+
- comments
36+
- common-false-positives
37+
- legacy
38+
- std-error-handling
3439
rules:
3540
- linters:
3641
- lll

api/v1alpha1/dpfhcpprovisioner_types.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ type DPUClusterReference struct {
3636
Namespace string `json:"namespace"`
3737
}
3838

39+
// DPUDeploymentReference defines a cross-namespace reference to a DPUDeployment CR
40+
type DPUDeploymentReference struct {
41+
// Name is the name of the DPUDeployment CR
42+
// +kubebuilder:validation:Required
43+
// +required
44+
Name string `json:"name"`
45+
46+
// Namespace is the namespace of the DPUDeployment CR
47+
// +kubebuilder:validation:Required
48+
// +required
49+
Namespace string `json:"namespace"`
50+
}
51+
3952
// DPFHCPProvisionerSpec defines the desired state of DPFHCPProvisioner
4053
// +kubebuilder:validation:XValidation:rule="self.controlPlaneAvailabilityPolicy != 'HighlyAvailable' || (has(self.virtualIP) && size(self.virtualIP) > 0)",message="virtualIP is required when controlPlaneAvailabilityPolicy is HighlyAvailable"
4154
type DPFHCPProvisionerSpec struct {
@@ -130,10 +143,21 @@ type DPFHCPProvisionerSpec struct {
130143
// +immutable
131144
// +optional
132145
FlannelEnabled *bool `json:"flannelEnabled,omitempty"`
146+
147+
// DPUDeploymentRef is a cross-namespace reference to a DPUDeployment CR for ignition generation
148+
// This field is used for ignition generation to retrieve DPU flavor information
149+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="dpuDeploymentRef is immutable"
150+
// +required
151+
DPUDeploymentRef *DPUDeploymentReference `json:"dpuDeploymentRef,omitempty"`
152+
153+
// MachineOSURL is the URL for the DPU machine OS image to be used in the ignition configuration
154+
// This URL replaces the default OS image URL in the HyperShift-generated ignition
155+
// +optional
156+
MachineOSURL string `json:"machineOSURL,omitempty"`
133157
}
134158

135159
// DPFHCPProvisionerPhase represents the lifecycle phase of the DPFHCPProvisioner
136-
// +kubebuilder:validation:Enum=Pending;Provisioning;Ready;Failed;Deleting
160+
// +kubebuilder:validation:Enum=Pending;Provisioning;IgnitionGenerating;Ready;Failed;Deleting
137161
type DPFHCPProvisionerPhase string
138162

139163
const (
@@ -143,6 +167,9 @@ const (
143167
// PhaseProvisioning indicates HostedCluster and related resources are being created
144168
PhaseProvisioning DPFHCPProvisionerPhase = "Provisioning"
145169

170+
// PhaseIgnitionGenerating indicates ignition generation is in progress
171+
PhaseIgnitionGenerating DPFHCPProvisionerPhase = "IgnitionGenerating"
172+
146173
// PhaseReady indicates HostedCluster is operational, kubeconfig injected, CSR auto-approval active
147174
PhaseReady DPFHCPProvisionerPhase = "Ready"
148175

@@ -213,6 +240,9 @@ const (
213240
// MetalLBConfigured indicates whether MetalLB resources (IPAddressPool and L2Advertisement)
214241
// have been successfully created and are in sync with the DPFHCPProvisioner spec.
215242
MetalLBConfigured string = "MetalLBConfigured"
243+
244+
// IgnitionConfigured indicates whether the ignition configuration has been successfully generated and deployed
245+
IgnitionConfigured string = "IgnitionConfigured"
216246
)
217247

218248
// Condition reasons for DPFHCPProvisioner Ready status.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3838
"sigs.k8s.io/controller-runtime/pkg/webhook"
3939

40+
dpuservicev1alpha1 "github.com/nvidia/doca-platform/api/dpuservice/v1alpha1"
41+
operatorv1alpha1 "github.com/nvidia/doca-platform/api/operator/v1alpha1"
4042
dpuprovisioningv1alpha1 "github.com/nvidia/doca-platform/api/provisioning/v1alpha1"
4143
hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
4244
provisioningv1alpha1 "github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/api/v1alpha1"
@@ -47,6 +49,7 @@ import (
4749
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/dpucluster"
4850
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/finalizer"
4951
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/hostedcluster"
52+
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/ignitiongenerator"
5053
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/kubeconfiginjection"
5154
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/metallb"
5255
"github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator/internal/controller/secrets"
@@ -64,6 +67,8 @@ func init() {
6467

6568
utilruntime.Must(provisioningv1alpha1.AddToScheme(scheme))
6669
utilruntime.Must(dpuprovisioningv1alpha1.AddToScheme(scheme))
70+
utilruntime.Must(dpuservicev1alpha1.AddToScheme(scheme))
71+
utilruntime.Must(operatorv1alpha1.AddToScheme(scheme))
6772
utilruntime.Must(hyperv1.AddToScheme(scheme))
6873
utilruntime.Must(metallbv1beta1.AddToScheme(scheme))
6974
// +kubebuilder:scaffold:scheme
@@ -268,6 +273,9 @@ func main() {
268273
// Initialize Status Syncer for HostedCluster status mirroring
269274
statusSyncer := hostedcluster.NewStatusSyncer(client)
270275

276+
// Initialize Ignition Generator for DPF provisioning
277+
ignitionGenerator := ignitiongenerator.NewIgnitionGenerator(client, scheme, provisionerRecorder)
278+
271279
// Setup main DPFHCPProvisioner controller
272280
if err := (&controller.DPFHCPProvisionerReconciler{
273281
Client: client,
@@ -283,6 +291,7 @@ func main() {
283291
FinalizerManager: finalizerManager,
284292
StatusSyncer: statusSyncer,
285293
KubeconfigInjector: kubeconfigInjector,
294+
IgnitionGenerator: ignitionGenerator,
286295
}).SetupWithManager(mgr); err != nil {
287296
setupLog.Error(err, "unable to create controller", "controller", "DPFHCPProvisioner")
288297
os.Exit(1)

config/crd/bases/provisioning.dpu.hcp.io_dpfhcpprovisioners.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ spec:
101101
x-kubernetes-validations:
102102
- message: dpuClusterRef is immutable
103103
rule: self == oldSelf
104+
dpuDeploymentRef:
105+
description: |-
106+
DPUDeploymentRef is a cross-namespace reference to a DPUDeployment CR for ignition generation
107+
This field is used for ignition generation to retrieve DPU flavor information
108+
properties:
109+
name:
110+
description: Name is the name of the DPUDeployment CR
111+
type: string
112+
namespace:
113+
description: Namespace is the namespace of the DPUDeployment CR
114+
type: string
115+
required:
116+
- name
117+
- namespace
118+
type: object
119+
x-kubernetes-validations:
120+
- message: dpuDeploymentRef is immutable
121+
rule: self == oldSelf
104122
etcdStorageClass:
105123
description: |-
106124
EtcdStorageClass is the storage class name for etcd persistent volumes in the hosted cluster control plane
@@ -121,6 +139,11 @@ spec:
121139
x-kubernetes-validations:
122140
- message: flannelEnabled is immutable
123141
rule: self == oldSelf
142+
machineOSURL:
143+
description: |-
144+
MachineOSURL is the URL for the DPU machine OS image to be used in the ignition configuration
145+
This URL replaces the default OS image URL in the HyperShift-generated ignition
146+
type: string
124147
nodeSelector:
125148
additionalProperties:
126149
type: string
@@ -195,6 +218,7 @@ spec:
195218
required:
196219
- baseDomain
197220
- dpuClusterRef
221+
- dpuDeploymentRef
198222
- ocpReleaseImage
199223
- pullSecretRef
200224
- sshKeySecretRef
@@ -333,6 +357,7 @@ spec:
333357
enum:
334358
- Pending
335359
- Provisioning
360+
- IgnitionGenerating
336361
- Ready
337362
- Failed
338363
- Deleting

config/rbac/role.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ rules:
88
- ""
99
resources:
1010
- configmaps
11-
- nodes
1211
verbs:
12+
- create
1313
- get
1414
- list
15+
- patch
16+
- update
1517
- watch
1618
- apiGroups:
1719
- ""
@@ -29,6 +31,14 @@ rules:
2931
- get
3032
- list
3133
- watch
34+
- apiGroups:
35+
- ""
36+
resources:
37+
- nodes
38+
verbs:
39+
- get
40+
- list
41+
- watch
3242
- apiGroups:
3343
- ""
3444
resources:
@@ -86,6 +96,15 @@ rules:
8696
- patch
8797
- update
8898
- watch
99+
- apiGroups:
100+
- operator.dpu.nvidia.com
101+
resources:
102+
- dpfoperatorconfigs
103+
verbs:
104+
- get
105+
- list
106+
- patch
107+
- watch
89108
- apiGroups:
90109
- provisioning.dpu.hcp.io
91110
resources:
@@ -125,8 +144,17 @@ rules:
125144
- apiGroups:
126145
- provisioning.dpu.nvidia.com
127146
resources:
147+
- dpuflavors
128148
- dpus
129149
verbs:
130150
- get
131151
- list
132152
- watch
153+
- apiGroups:
154+
- svc.dpu.nvidia.com
155+
resources:
156+
- dpudeployments
157+
verbs:
158+
- get
159+
- list
160+
- watch

go.mod

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/rh-ecosystem-edge/dpf-hcp-provisioner-operator
33
go 1.25
44

55
require (
6+
github.com/coreos/ignition/v2 v2.26.0
67
github.com/nvidia/doca-platform v0.0.0-20251115082520-81369e955c6c
78
github.com/onsi/ginkgo/v2 v2.27.2
89
github.com/onsi/gomega v1.38.2
@@ -20,10 +21,14 @@ require (
2021
cel.dev/expr v0.24.0 // indirect
2122
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2223
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
24+
github.com/aws/aws-sdk-go-v2 v1.41.1 // indirect
2325
github.com/beorn7/perks v1.0.1 // indirect
2426
github.com/blang/semver/v4 v4.0.0 // indirect
2527
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
2628
github.com/cespare/xxhash/v2 v2.3.0 // indirect
29+
github.com/coreos/go-semver v0.3.1 // indirect
30+
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
31+
github.com/coreos/vcontext v0.0.0-20231102161604-685dc7299dc5 // indirect
2732
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2833
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
2934
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
@@ -52,6 +57,7 @@ require (
5257
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5358
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
5459
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
60+
github.com/opencontainers/go-digest v1.0.0 // indirect
5561
github.com/openshift/api v0.0.0-20251204193610-68ce3d906ec8 // indirect
5662
github.com/pkg/errors v0.9.1 // indirect
5763
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -60,37 +66,38 @@ require (
6066
github.com/prometheus/common v0.65.0 // indirect
6167
github.com/prometheus/procfs v0.16.1 // indirect
6268
github.com/spf13/cobra v1.9.1 // indirect
63-
github.com/spf13/pflag v1.0.7 // indirect
69+
github.com/spf13/pflag v1.0.10 // indirect
6470
github.com/stoewer/go-strcase v1.3.0 // indirect
71+
github.com/vincent-petithory/dataurl v1.0.0 // indirect
6572
github.com/x448/float16 v0.8.4 // indirect
66-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
67-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
68-
go.opentelemetry.io/otel v1.37.0 // indirect
73+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
74+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
75+
go.opentelemetry.io/otel v1.38.0 // indirect
6976
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
7077
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 // indirect
71-
go.opentelemetry.io/otel/metric v1.37.0 // indirect
72-
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
73-
go.opentelemetry.io/otel/trace v1.37.0 // indirect
78+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
79+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
80+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
7481
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
7582
go.uber.org/multierr v1.11.0 // indirect
7683
go.uber.org/zap v1.27.0 // indirect
7784
go.yaml.in/yaml/v2 v2.4.2 // indirect
7885
go.yaml.in/yaml/v3 v3.0.4 // indirect
7986
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
80-
golang.org/x/mod v0.29.0 // indirect
81-
golang.org/x/net v0.47.0 // indirect
82-
golang.org/x/oauth2 v0.30.0 // indirect
83-
golang.org/x/sync v0.18.0 // indirect
84-
golang.org/x/sys v0.38.0 // indirect
85-
golang.org/x/term v0.37.0 // indirect
86-
golang.org/x/text v0.31.0 // indirect
87-
golang.org/x/time v0.11.0 // indirect
88-
golang.org/x/tools v0.38.0 // indirect
87+
golang.org/x/mod v0.31.0 // indirect
88+
golang.org/x/net v0.49.0 // indirect
89+
golang.org/x/oauth2 v0.34.0 // indirect
90+
golang.org/x/sync v0.19.0 // indirect
91+
golang.org/x/sys v0.40.0 // indirect
92+
golang.org/x/term v0.39.0 // indirect
93+
golang.org/x/text v0.33.0 // indirect
94+
golang.org/x/time v0.14.0 // indirect
95+
golang.org/x/tools v0.40.0 // indirect
8996
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
90-
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
91-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
92-
google.golang.org/grpc v1.73.0 // indirect
93-
google.golang.org/protobuf v1.36.7 // indirect
97+
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
98+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
99+
google.golang.org/grpc v1.78.0 // indirect
100+
google.golang.org/protobuf v1.36.11 // indirect
94101
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
95102
gopkg.in/inf.v0 v0.9.1 // indirect
96103
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)