Skip to content

Commit c88d870

Browse files
committed
Apply review feedback
- Modify SSL Certification to be enum instead of boolean Signed-off-by: Michael Shitrit <[email protected]>
1 parent 2d7d333 commit c88d870

File tree

3 files changed

+51
-17
lines changed

3 files changed

+51
-17
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ spec:
7171
properties:
7272
address:
7373
type: string
74-
disableCertificateVerification:
75-
type: boolean
74+
certificateVerification:
75+
default: Enabled
76+
description: |-
77+
CertificateVerification Defines whether ssl certificate verification is required or not.
78+
If omitted, the platform chooses a default, that default is enabled.
79+
enum:
80+
- Enabled
81+
- Disabled
82+
type: string
7683
hostName:
7784
type: string
7885
password:
@@ -81,7 +88,6 @@ spec:
8188
type: string
8289
required:
8390
- address
84-
- disableCertificateVerification
8591
- password
8692
- username
8793
type: object
@@ -1387,8 +1393,15 @@ spec:
13871393
properties:
13881394
address:
13891395
type: string
1390-
disableCertificateVerification:
1391-
type: boolean
1396+
certificateVerification:
1397+
default: Enabled
1398+
description: |-
1399+
CertificateVerification Defines whether ssl certificate verification is required or not.
1400+
If omitted, the platform chooses a default, that default is enabled.
1401+
enum:
1402+
- Enabled
1403+
- Disabled
1404+
type: string
13921405
hostName:
13931406
type: string
13941407
password:
@@ -1397,7 +1410,6 @@ spec:
13971410
type: string
13981411
required:
13991412
- address
1400-
- disableCertificateVerification
14011413
- password
14021414
- username
14031415
type: object
@@ -2642,8 +2654,15 @@ spec:
26422654
properties:
26432655
address:
26442656
type: string
2645-
disableCertificateVerification:
2646-
type: boolean
2657+
certificateVerification:
2658+
default: Enabled
2659+
description: |-
2660+
CertificateVerification Defines whether ssl certificate verification is required or not.
2661+
If omitted, the platform chooses a default, that default is enabled.
2662+
enum:
2663+
- Enabled
2664+
- Disabled
2665+
type: string
26472666
hostName:
26482667
type: string
26492668
password:
@@ -2652,7 +2671,6 @@ spec:
26522671
type: string
26532672
required:
26542673
- address
2655-
- disableCertificateVerification
26562674
- password
26572675
- username
26582676
type: object

pkg/types/machinepools.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,26 @@ type Fencing struct {
158158
Credentials []*Credential `json:"credentials,omitempty"`
159159
}
160160

161+
// CertificateVerificationPolicy represents the options for CertificateVerification .
162+
type CertificateVerificationPolicy string
163+
164+
const (
165+
// CertificateVerificationEnabled enables ssl certificate verification.
166+
CertificateVerificationEnabled CertificateVerificationPolicy = "Enabled"
167+
// CertificateVerificationDisabled disables ssl certificate verification.
168+
CertificateVerificationDisabled CertificateVerificationPolicy = "Disabled"
169+
)
170+
161171
// Credential stores the information about a baremetal host's management controller.
162172
type Credential struct {
163-
HostName string `json:"hostName,omitempty" validate:"required,uniqueField"`
164-
Username string `json:"username" validate:"required"`
165-
Password string `json:"password" validate:"required"`
166-
Address string `json:"address" validate:"required,uniqueField"`
167-
DisableCertificateVerification bool `json:"disableCertificateVerification"`
173+
HostName string `json:"hostName,omitempty" validate:"required,uniqueField"`
174+
Username string `json:"username" validate:"required"`
175+
Password string `json:"password" validate:"required"`
176+
Address string `json:"address" validate:"required,uniqueField"`
177+
// CertificateVerification Defines whether ssl certificate verification is required or not.
178+
// If omitted, the platform chooses a default, that default is enabled.
179+
// +kubebuilder:default:="Enabled"
180+
// +kubebuilder:validation:Enum=Enabled;Disabled
181+
// +optional
182+
CertificateVerification CertificateVerificationPolicy `json:"certificateVerification,omitempty"`
168183
}

pkg/types/validation/installconfig_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,8 +2824,9 @@ func TestValidateTNF(t *testing.T) {
28242824
},
28252825
{
28262826
config: installConfig().
2827+
PlatformBMWithHosts().
28272828
MachinePoolCP(machinePool().
2828-
Credential(c1().DisableCertificateVerification(true), c2())).
2829+
Credential(c1().CertificateVerification(types.CertificateVerificationDisabled), c2())).
28292830
CpReplicas(2).
28302831
build(),
28312832
name: "valid_with_disabled_cert_verification",
@@ -3026,8 +3027,8 @@ func (hb *credentialBuilder) BMCPassword(value string) *credentialBuilder {
30263027
return hb
30273028
}
30283029

3029-
func (hb *credentialBuilder) DisableCertificateVerification(value bool) *credentialBuilder {
3030-
hb.Credential.DisableCertificateVerification = value
3030+
func (hb *credentialBuilder) CertificateVerification(value types.CertificateVerificationPolicy) *credentialBuilder {
3031+
hb.Credential.CertificateVerification = value
30313032
return hb
30323033
}
30333034

0 commit comments

Comments
 (0)