Skip to content

Commit 8ae32cb

Browse files
committed
fixup! fix: allow http registries by disabling TLS check
1 parent 8847195 commit 8ae32cb

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pkg/webhook/preflight/generic/registry.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ func (r *registryCheck) checkRegistry(
9393
result.Allowed = false
9494
result.Causes = append(result.Causes,
9595
preflight.Cause{
96-
Message: fmt.Sprintf("failed to parse registry url must be http or https %s", registryURL),
97-
Field: r.field + ".url",
96+
Message: fmt.Sprintf(
97+
"Registry URL scheme %q is not supported. Use http or https.",
98+
registryURLParsed.Scheme,
99+
),
100+
Field: r.field + ".url",
98101
},
99102
)
100103
return result
@@ -104,14 +107,14 @@ func (r *registryCheck) checkRegistry(
104107
}
105108

106109
if credentials != nil && credentials.SecretRef != nil {
107-
mirrorCredentialsSecret := &corev1.Secret{}
110+
credentialsSecret := &corev1.Secret{}
108111
err := r.kclient.Get(
109112
ctx,
110113
types.NamespacedName{
111114
Namespace: r.cluster.Namespace,
112115
Name: credentials.SecretRef.Name,
113116
},
114-
mirrorCredentialsSecret,
117+
credentialsSecret,
115118
)
116119
if apierrors.IsNotFound(err) {
117120
result.Allowed = false
@@ -135,15 +138,15 @@ func (r *registryCheck) checkRegistry(
135138
)
136139
return result
137140
}
138-
username, ok := mirrorCredentialsSecret.Data["username"]
141+
username, ok := credentialsSecret.Data["username"]
139142
if ok {
140143
registryHost.User = string(username)
141144
}
142-
password, ok := mirrorCredentialsSecret.Data["password"]
145+
password, ok := credentialsSecret.Data["password"]
143146
if ok {
144147
registryHost.Pass = string(password)
145148
}
146-
if caCert, ok := mirrorCredentialsSecret.Data["ca.crt"]; ok {
149+
if caCert, ok := credentialsSecret.Data["ca.crt"]; ok {
147150
registryHost.RegCert = string(caCert)
148151
}
149152
}

pkg/webhook/preflight/generic/registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func TestRegistryCheck(t *testing.T) {
343343
InternalError: false,
344344
Causes: []preflight.Cause{
345345
{
346-
Message: "failed to parse registry url must be http or https tcp://some-registry.lol",
346+
Message: "Registry URL scheme \"tcp\" is not supported. Use http or https.",
347347
Field: "cluster.spec.topology.variables[.name=clusterConfig].value.imageRegistries[0].url",
348348
},
349349
},

0 commit comments

Comments
 (0)