Skip to content

Commit 7fb1973

Browse files
authored
Allow Processing BootConfigs without IgnitionSecRefs and Remove deprecated MachineBootConfig Reconciler (#104)
1 parent 473ef3e commit 7fb1973

11 files changed

+35
-263
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ issues:
1818
- lll
1919
- path: "server/*"
2020
linters:
21+
- dupl
2122
- lll
2223
- path: "cmd/*"
2324
linters:

api/v1alpha1/httpbootconfig_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
// HTTPBootConfigSpec defines the desired state of HTTPBootConfig
1212
type HTTPBootConfigSpec struct {
13-
SystemUUID string `json:"systemUUID,omitempty"`
14-
IgnitionSecretRef *corev1.ObjectReference `json:"ignitionSecretRef,omitempty"`
15-
SystemIPs []string `json:"systemIPs,omitempty"`
16-
UKIURL string `json:"ukiURL,omitempty"`
13+
SystemUUID string `json:"systemUUID,omitempty"`
14+
IgnitionSecretRef *corev1.LocalObjectReference `json:"ignitionSecretRef,omitempty"`
15+
SystemIPs []string `json:"systemIPs,omitempty"`
16+
UKIURL string `json:"ukiURL,omitempty"`
1717
}
1818

1919
// HTTPBootConfigStatus defines the observed state of HTTPBootConfig

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ var (
4343

4444
const (
4545
// core controllers
46-
machineBootConfigControllerHttp = "machinebootconfighttp"
47-
ipxeBootConfigController = "ipxebootconfig"
48-
serverBootConfigControllerPxe = "serverbootconfigpxe"
49-
httpBootConfigController = "httpbootconfig"
50-
serverBootConfigControllerHttp = "serverbootconfighttp"
46+
ipxeBootConfigController = "ipxebootconfig"
47+
serverBootConfigControllerPxe = "serverbootconfigpxe"
48+
httpBootConfigController = "httpbootconfig"
49+
serverBootConfigControllerHttp = "serverbootconfighttp"
5150
)
5251

5352
func init() {
@@ -76,7 +75,6 @@ func main() {
7675
var ipxeServiceProtocol string
7776
var ipxeServicePort int
7877
var imageServerURL string
79-
var bootconfigNamespace string
8078

8179
flag.IntVar(&ipxeServicePort, "ipxe-service-port", 5000, "IPXE Service port to listen on.")
8280
flag.StringVar(&ipxeServiceProtocol, "ipxe-service-protocol", "http", "IPXE Service Protocol.")
@@ -85,7 +83,6 @@ func main() {
8583
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
8684
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
8785
flag.StringVar(&bootserverAddr, "boot-server-address", ":8082", "The address the boot-server binds to.")
88-
flag.StringVar(&bootconfigNamespace, "machinebootconfig-namespace", "default", "The namespace in which HTTPBootConfigs should be created for MachineBootConfiguration Controller.")
8986
flag.StringVar(&imageProxyServerAddr, "image-proxy-server-address", ":8083", "The address the image-proxy-server binds to.")
9087
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
9188
"Enable leader election for controller manager. "+
@@ -100,7 +97,6 @@ func main() {
10097
ipxeBootConfigController,
10198
serverBootConfigControllerPxe,
10299
serverBootConfigControllerHttp,
103-
machineBootConfigControllerHttp,
104100
httpBootConfigController,
105101
)
106102

@@ -213,18 +209,6 @@ func main() {
213209
}
214210
}
215211

216-
if controllers.Enabled(machineBootConfigControllerHttp) {
217-
if err = (&controller.MachineBootConfigurationHTTPReconciler{
218-
Client: mgr.GetClient(),
219-
Scheme: mgr.GetScheme(),
220-
ImageServerURL: imageServerURL,
221-
BootConfigNamespace: bootconfigNamespace,
222-
}).SetupWithManager(mgr); err != nil {
223-
setupLog.Error(err, "unable to create controller", "controller", "MachineBootConfigHttp")
224-
os.Exit(1)
225-
}
226-
}
227-
228212
if controllers.Enabled(httpBootConfigController) {
229213
if err = (&controller.HTTPBootConfigReconciler{
230214
Client: mgr.GetClient(),

config/crd/bases/boot.ironcore.dev_httpbootconfigs.yaml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,47 +47,19 @@ spec:
4747
description: HTTPBootConfigSpec defines the desired state of HTTPBootConfig
4848
properties:
4949
ignitionSecretRef:
50-
description: ObjectReference contains enough information to let you
51-
inspect or modify the referred object.
50+
description: |-
51+
LocalObjectReference contains enough information to let you locate the
52+
referenced object inside the same namespace.
5253
properties:
53-
apiVersion:
54-
description: API version of the referent.
55-
type: string
56-
fieldPath:
57-
description: |-
58-
If referring to a piece of an object instead of an entire object, this string
59-
should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
60-
For example, if the object reference is to a container within a pod, this would take on a value like:
61-
"spec.containers{name}" (where "name" refers to the name of the container that triggered
62-
the event) or if no container name is specified "spec.containers[2]" (container with
63-
index 2 in this pod). This syntax is chosen only to have some well-defined way of
64-
referencing a part of an object.
65-
type: string
66-
kind:
67-
description: |-
68-
Kind of the referent.
69-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
70-
type: string
7154
name:
55+
default: ""
7256
description: |-
7357
Name of the referent.
58+
This field is effectively required, but due to backwards compatibility is
59+
allowed to be empty. Instances of this type with an empty value here are
60+
almost certainly wrong.
7461
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
7562
type: string
76-
namespace:
77-
description: |-
78-
Namespace of the referent.
79-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
80-
type: string
81-
resourceVersion:
82-
description: |-
83-
Specific resourceVersion to which this reference is made, if any.
84-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
85-
type: string
86-
uid:
87-
description: |-
88-
UID of the referent.
89-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
90-
type: string
9163
type: object
9264
x-kubernetes-map-type: atomic
9365
systemIPs:

config/rbac/role.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ rules:
6363
- apiGroups:
6464
- metal.ironcore.dev
6565
resources:
66-
- bootconfigurations
67-
- machines
6866
- serverbootconfigurations
6967
- servers
7068
verbs:
@@ -74,14 +72,12 @@ rules:
7472
- apiGroups:
7573
- metal.ironcore.dev
7674
resources:
77-
- bootconfigurations/finalizers
7875
- serverbootconfigurations/finalizers
7976
verbs:
8077
- update
8178
- apiGroups:
8279
- metal.ironcore.dev
8380
resources:
84-
- bootconfigurations/status
8581
- serverbootconfigurations/status
8682
verbs:
8783
- get

internal/controller/httpbootconfig_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (r *HTTPBootConfigReconciler) ensureIgnition(ctx context.Context, _ logr.Lo
7575
// Verify if the IgnitionRef is set, and it has the intended data key.
7676
if HTTPBootConfig.Spec.IgnitionSecretRef != nil {
7777
IgnitionSecret := &corev1.Secret{}
78-
if err := r.Get(ctx, client.ObjectKey{Name: HTTPBootConfig.Spec.IgnitionSecretRef.Name, Namespace: HTTPBootConfig.Spec.IgnitionSecretRef.Namespace}, IgnitionSecret); err != nil {
78+
if err := r.Get(ctx, client.ObjectKey{Name: HTTPBootConfig.Spec.IgnitionSecretRef.Name, Namespace: HTTPBootConfig.Namespace}, IgnitionSecret); err != nil {
7979
return bootv1alpha1.HTTPBootConfigStateError, err
8080
// TODO: Add some validation steps to ensure that the IgntionData is compliant, if necessary.
8181
// Assume for now, that it's going to json format.
@@ -143,7 +143,7 @@ func (r *HTTPBootConfigReconciler) enqueueHTTPBootConfigReferencingIgnitionSecre
143143
for _, HTTPBootConfig := range list.Items {
144144
if HTTPBootConfig.Spec.IgnitionSecretRef != nil &&
145145
HTTPBootConfig.Spec.IgnitionSecretRef.Name == secretObj.Name &&
146-
HTTPBootConfig.Spec.IgnitionSecretRef.Namespace == secretObj.Namespace {
146+
HTTPBootConfig.Namespace == secretObj.Namespace {
147147
requests = append(requests, reconcile.Request{
148148
NamespacedName: types.NamespacedName{
149149
Name: HTTPBootConfig.Name,

internal/controller/machinebootconfiguration_http_controller.go

Lines changed: 0 additions & 183 deletions
This file was deleted.

0 commit comments

Comments
 (0)