Skip to content

Commit adbecd0

Browse files
Merge pull request #257 from jacobweinstock/update-crd-generation
Update Machine CRD: ## Description <!--- Please describe what this PR is going to change --> Update most all provider options to be optional and to have the json struct tags with `omitempty`. ## Why is this needed <!--- Link to issue you have raised --> Fixes: # ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## How are existing users impacted? What migration steps/scripts do we need? <!--- Fixes a bug, unblocks installation, removes a component of the stack etc --> <!--- Requires a DB migration script, etc. --> ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents c5afdbb + 8096773 commit adbecd0

File tree

3 files changed

+28
-36
lines changed

3 files changed

+28
-36
lines changed

api/v1alpha1/provider_opts.go

+28-24
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,38 @@ import (
99
// RedfishOptions contains the redfish provider specific options.
1010
type RedfishOptions struct {
1111
// Port that redfish will use for calls.
12-
Port int `json:"port"`
12+
// +optional
13+
Port int `json:"port,omitempty"`
1314
// UseBasicAuth for redfish calls. The default is false which means token based auth is used.
14-
UseBasicAuth bool `json:"useBasicAuth"`
15+
// +optional
16+
UseBasicAuth bool `json:"useBasicAuth,omitempty"`
1517
// SystemName is the name of the system to use for redfish calls.
1618
// With redfish implementations that manage multiple systems via a single endpoint, this allows for specifying the system to manage.
17-
SystemName string `json:"systemName"`
19+
// +optional
20+
SystemName string `json:"systemName,omitempty"`
1821
}
1922

2023
// IPMITOOLOptions contains the ipmitool provider specific options.
2124
type IPMITOOLOptions struct {
2225
// Port that ipmitool will use for calls.
2326
// +optional
24-
Port int `json:"port"`
27+
Port int `json:"port,omitempty"`
2528
// CipherSuite that ipmitool will use for calls.
2629
// +optional
27-
CipherSuite string `json:"cipherSuite"`
30+
CipherSuite string `json:"cipherSuite,omitempty"`
2831
}
2932

3033
// IntelAMTOptions contains the intelAMT provider specific options.
3134
type IntelAMTOptions struct {
3235
// Port that intelAMT will use for calls.
33-
Port int `json:"port"`
36+
// +optional
37+
Port int `json:"port,omitempty"`
3438

3539
// HostScheme determines whether to use http or https for intelAMT calls.
3640
// +optional
3741
// +kubebuilder:validation:Enum=http;https
3842
// +kubebuilder:default:=http
39-
HostScheme string `json:"hostScheme"`
43+
HostScheme string `json:"hostScheme,omitempty"`
4044
}
4145

4246
// HMACAlgorithm is a type for HMAC algorithms.
@@ -53,72 +57,72 @@ type RPCOptions struct {
5357
ConsumerURL string `json:"consumerURL"`
5458
// LogNotificationsDisabled determines whether responses from rpc consumer/listeners will be logged or not.
5559
// +optional
56-
LogNotificationsDisabled bool `json:"logNotificationsDisabled"`
60+
LogNotificationsDisabled bool `json:"logNotificationsDisabled,omitempty"`
5761
// Request is the options used to create the rpc HTTP request.
5862
// +optional
59-
Request *RequestOpts `json:"request"`
63+
Request *RequestOpts `json:"request,omitempty"`
6064
// Signature is the options used for adding an HMAC signature to an HTTP request.
6165
// +optional
62-
Signature *SignatureOpts `json:"signature"`
66+
Signature *SignatureOpts `json:"signature,omitempty"`
6367
// HMAC is the options used to create a HMAC signature.
6468
// +optional
65-
HMAC *HMACOpts `json:"hmac"`
69+
HMAC *HMACOpts `json:"hmac,omitempty"`
6670
// Experimental options.
6771
// +optional
68-
Experimental *ExperimentalOpts `json:"experimental"`
72+
Experimental *ExperimentalOpts `json:"experimental,omitempty"`
6973
}
7074

7175
// RequestOpts are the options used when creating an HTTP request.
7276
type RequestOpts struct {
7377
// HTTPContentType is the content type to use for the rpc request notification.
7478
// +optional
75-
HTTPContentType string `json:"httpContentType"`
79+
HTTPContentType string `json:"httpContentType,omitempty"`
7680
// HTTPMethod is the HTTP method to use for the rpc request notification.
7781
// +optional
78-
HTTPMethod string `json:"httpMethod"`
82+
HTTPMethod string `json:"httpMethod,omitempty"`
7983
// StaticHeaders are predefined headers that will be added to every request.
8084
// +optional
81-
StaticHeaders http.Header `json:"staticHeaders"`
85+
StaticHeaders http.Header `json:"staticHeaders,omitempty"`
8286
// TimestampFormat is the time format for the timestamp header.
8387
// +optional
84-
TimestampFormat string `json:"timestampFormat"`
88+
TimestampFormat string `json:"timestampFormat,omitempty"`
8589
// TimestampHeader is the header name that should contain the timestamp. Example: X-BMCLIB-Timestamp
8690
// +optional
87-
TimestampHeader string `json:"timestampHeader"`
91+
TimestampHeader string `json:"timestampHeader,omitempty"`
8892
}
8993

9094
// SignatureOpts are the options used for adding an HMAC signature to an HTTP request.
9195
type SignatureOpts struct {
9296
// HeaderName is the header name that should contain the signature(s). Example: X-BMCLIB-Signature
9397
// +optional
94-
HeaderName string `json:"headerName"`
98+
HeaderName string `json:"headerName,omitempty"`
9599
// AppendAlgoToHeaderDisabled decides whether to append the algorithm to the signature header or not.
96100
// Example: X-BMCLIB-Signature becomes X-BMCLIB-Signature-256
97101
// When set to true, a header will be added for each algorithm. Example: X-BMCLIB-Signature-256 and X-BMCLIB-Signature-512
98102
// +optional
99-
AppendAlgoToHeaderDisabled bool `json:"appendAlgoToHeaderDisabled"`
103+
AppendAlgoToHeaderDisabled bool `json:"appendAlgoToHeaderDisabled,omitempty"`
100104
// IncludedPayloadHeaders are headers whose values will be included in the signature payload. Example: X-BMCLIB-My-Custom-Header
101105
// All headers will be deduplicated.
102106
// +optional
103-
IncludedPayloadHeaders []string `json:"includedPayloadHeaders"`
107+
IncludedPayloadHeaders []string `json:"includedPayloadHeaders,omitempty"`
104108
}
105109

106110
// HMACOpts are the options used to create an HMAC signature.
107111
type HMACOpts struct {
108112
// PrefixSigDisabled determines whether the algorithm will be prefixed to the signature. Example: sha256=abc123
109113
// +optional
110-
PrefixSigDisabled bool `json:"prefixSigDisabled"`
114+
PrefixSigDisabled bool `json:"prefixSigDisabled,omitempty"`
111115
// Secrets are a map of algorithms to secrets used for signing.
112116
// +optional
113-
Secrets HMACSecrets `json:"secrets"`
117+
Secrets HMACSecrets `json:"secrets,omitempty"`
114118
}
115119

116120
// ExperimentalOpts are options we're still learning about and should be used carefully.
117121
type ExperimentalOpts struct {
118122
// CustomRequestPayload must be in json.
119123
// +optional
120-
CustomRequestPayload string `json:"customRequestPayload"`
124+
CustomRequestPayload string `json:"customRequestPayload,omitempty"`
121125
// DotPath is the path to the json object where the bmclib RequestPayload{} struct will be embedded. For example: object.data.body
122126
// +optional
123-
DotPath string `json:"dotPath"`
127+
DotPath string `json:"dotPath,omitempty"`
124128
}

config/crd/bases/bmc.tinkerbell.org_machines.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ spec:
9090
port:
9191
description: Port that intelAMT will use for calls.
9292
type: integer
93-
required:
94-
- port
9593
type: object
9694
ipmitool:
9795
description: IPMITOOL contains the options to customize the
@@ -120,10 +118,6 @@ spec:
120118
description: UseBasicAuth for redfish calls. The default
121119
is false which means token based auth is used.
122120
type: boolean
123-
required:
124-
- port
125-
- systemName
126-
- useBasicAuth
127121
type: object
128122
rpc:
129123
description: RPC contains the options to customize the RPC

config/crd/bases/bmc.tinkerbell.org_tasks.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ spec:
9191
port:
9292
description: Port that intelAMT will use for calls.
9393
type: integer
94-
required:
95-
- port
9694
type: object
9795
ipmitool:
9896
description: IPMITOOL contains the options to customize the
@@ -121,10 +119,6 @@ spec:
121119
description: UseBasicAuth for redfish calls. The default
122120
is false which means token based auth is used.
123121
type: boolean
124-
required:
125-
- port
126-
- systemName
127-
- useBasicAuth
128122
type: object
129123
rpc:
130124
description: RPC contains the options to customize the RPC

0 commit comments

Comments
 (0)