Skip to content

Commit 05ef797

Browse files
Merge pull request #9640 from mshitrit/skip-ssl-verification
OCPEDGE-1707: Add Disable Certificate Verification API
2 parents 0d5142b + c88d870 commit 05ef797

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ spec:
7171
properties:
7272
address:
7373
type: string
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
7483
hostName:
7584
type: string
7685
password:
@@ -1384,6 +1393,15 @@ spec:
13841393
properties:
13851394
address:
13861395
type: string
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
13871405
hostName:
13881406
type: string
13891407
password:
@@ -2636,6 +2654,15 @@ spec:
26362654
properties:
26372655
address:
26382656
type: string
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
26392666
hostName:
26402667
type: string
26412668
password:

pkg/types/machinepools.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +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 {
163173
HostName string `json:"hostName,omitempty" validate:"required,uniqueField"`
164174
Username string `json:"username" validate:"required"`
165175
Password string `json:"password" validate:"required"`
166176
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"`
167183
}

pkg/types/validation/installconfig_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,6 +2822,16 @@ func TestValidateTNF(t *testing.T) {
28222822
name: "valid_two_credentials",
28232823
expected: "",
28242824
},
2825+
{
2826+
config: installConfig().
2827+
PlatformBMWithHosts().
2828+
MachinePoolCP(machinePool().
2829+
Credential(c1().CertificateVerification(types.CertificateVerificationDisabled), c2())).
2830+
CpReplicas(2).
2831+
build(),
2832+
name: "valid_with_disabled_cert_verification",
2833+
expected: "",
2834+
},
28252835
{
28262836
config: installConfig().
28272837
MachinePoolCP(machinePool().
@@ -3017,6 +3027,11 @@ func (hb *credentialBuilder) BMCPassword(value string) *credentialBuilder {
30173027
return hb
30183028
}
30193029

3030+
func (hb *credentialBuilder) CertificateVerification(value types.CertificateVerificationPolicy) *credentialBuilder {
3031+
hb.Credential.CertificateVerification = value
3032+
return hb
3033+
}
3034+
30203035
type machinePoolBuilder struct {
30213036
types.MachinePool
30223037
}

0 commit comments

Comments
 (0)