Skip to content

Commit 48e52c4

Browse files
committed
Require CA cert configmap ref for each SignatureStore URL
1 parent 6164bff commit 48e52c4

7 files changed

+156
-31
lines changed

config/v1/0000_00_cluster-version-operator_01_clusterversion-TechPreviewNoUpgrade.crd.yaml

+24-6
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,33 @@ spec:
155155
- name
156156
x-kubernetes-list-type: map
157157
signatureStores:
158-
description: "signatureStores contains the upstream URIs to verify release signatures. By default, CVO will use existing signature stores if this property is empty. The CVO will check the release signatures in the local ConfigMaps first. It will search for a valid signature in these stores in parallel only when local ConfigMaps did not include a valid signature. Validation will fail if none of the signature stores reply with valid signature before timeout. Setting signatureStores will replace the default signature stores with custom signature stores. Default stores can be used with custom signature stores by adding them manually. \n Items in this list should be a valid absolute http/https URI of an upstream signature store as per rfc1738. A maximum of 32 signature stores may be configured."
158+
description: "signatureStores contains the upstream URIs to verify release signatures and optional reference to a config map by name containing the PEM-encoded CA bundle. \n By default, CVO will use existing signature stores if this property is empty. The CVO will check the release signatures in the local ConfigMaps first. It will search for a valid signature in these stores in parallel only when local ConfigMaps did not include a valid signature. Validation will fail if none of the signature stores reply with valid signature before timeout. Setting signatureStores will replace the default signature stores with custom signature stores. Default stores can be used with custom signature stores by adding them manually. \n A maximum of 32 signature stores may be configured."
159159
type: array
160160
maxItems: 32
161161
items:
162-
type: string
163-
x-kubernetes-list-type: set
164-
x-kubernetes-validations:
165-
- rule: self.all(x, isURL(x))
166-
message: signatureStores must contain only valid absolute URLs per the Go net/url standard
162+
description: SignatureStore represents the URL of custom Signature Store
163+
type: object
164+
required:
165+
- url
166+
properties:
167+
ca:
168+
description: ca is an optional reference to a config map by name containing the PEM-encoded CA bundle. It is used as a trust anchor to validate the TLS certificate presented by the remote server. The key "ca.crt" is used to locate the data. If specified and the config map or expected key is not found, the signature store is not honored. If the specified ca data is not valid, the signature store is not honored. If empty, we fall back to the CA configured via Proxy, which is appended to the default system roots. The namespace for this config map is openshift-config.
169+
type: object
170+
required:
171+
- name
172+
properties:
173+
name:
174+
description: name is the metadata.name of the referenced config map
175+
type: string
176+
url:
177+
description: url contains the upstream custom signature store URL. url should be a valid absolute http/https URI of an upstream signature store as per rfc1738. This must be provided and cannot be empty.
178+
type: string
179+
x-kubernetes-validations:
180+
- rule: isURL(self)
181+
message: url must be a valid absolute URL
182+
x-kubernetes-list-map-keys:
183+
- url
184+
x-kubernetes-list-type: map
167185
upstream:
168186
description: upstream may be used to specify the preferred update server. By default it will use the appropriate update server for the cluster and region.
169187
type: string

config/v1/techpreview.clusterversion.testsuite.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -169,40 +169,40 @@ tests:
169169
spec:
170170
clusterID: foo
171171
signatureStores:
172-
- "https://osus.ocp.com"
172+
- url: "https://osus.ocp.com"
173173
expected: |
174174
apiVersion: config.openshift.io/v1
175175
kind: ClusterVersion
176176
spec:
177177
clusterID: foo
178178
signatureStores:
179-
- "https://osus.ocp.com"
179+
- url: "https://osus.ocp.com"
180180
- name: Should be able to set multiple custom signature store
181181
initial: |
182182
apiVersion: config.openshift.io/v1
183183
kind: ClusterVersion
184184
spec:
185185
clusterID: foo
186186
signatureStores:
187-
- "https://osus1.ocp.com"
188-
- "https://osus2.ocp.com"
187+
- url: "https://osus1.ocp.com"
188+
- url: "https://osus2.ocp.com"
189189
expected: |
190190
apiVersion: config.openshift.io/v1
191191
kind: ClusterVersion
192192
spec:
193193
clusterID: foo
194194
signatureStores:
195-
- "https://osus1.ocp.com"
196-
- "https://osus2.ocp.com"
195+
- url: "https://osus1.ocp.com"
196+
- url: "https://osus2.ocp.com"
197197
- name: Invalid custom signature store should throw error
198198
initial: |
199199
apiVersion: config.openshift.io/v1
200200
kind: ClusterVersion
201201
spec:
202202
clusterID: foo
203203
signatureStores:
204-
- "osus1.ocp.com"
205-
expectedError: "signatureStores must contain only valid absolute URLs per the Go net/url standard"
204+
- url: "osus1.ocp.com"
205+
expectedError: "url must be a valid absolute URL"
206206
- name: Should be able to unset the signature stores
207207
initial: |
208208
apiVersion: config.openshift.io/v1

config/v1/types_cluster_version.go

+29-5
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,23 @@ type ClusterVersionSpec struct {
8888
// +optional
8989
Capabilities *ClusterVersionCapabilitiesSpec `json:"capabilities,omitempty"`
9090

91-
// signatureStores contains the upstream URIs to verify release signatures.
91+
// signatureStores contains the upstream URIs to verify release signatures and optional
92+
// reference to a config map by name containing the PEM-encoded CA bundle.
93+
//
9294
// By default, CVO will use existing signature stores if this property is empty.
9395
// The CVO will check the release signatures in the local ConfigMaps first. It will search for a valid signature
9496
// in these stores in parallel only when local ConfigMaps did not include a valid signature.
9597
// Validation will fail if none of the signature stores reply with valid signature before timeout.
9698
// Setting signatureStores will replace the default signature stores with custom signature stores.
9799
// Default stores can be used with custom signature stores by adding them manually.
98100
//
99-
// Items in this list should be a valid absolute http/https URI of an upstream signature store as per rfc1738.
100101
// A maximum of 32 signature stores may be configured.
101-
// +kubebuilder:validation:XValidation:rule="self.all(x, isURL(x))",message="signatureStores must contain only valid absolute URLs per the Go net/url standard"
102102
// +kubebuilder:validation:MaxItems=32
103103
// +openshift:enable:FeatureSets=TechPreviewNoUpgrade
104-
// +listType=set
104+
// +listType=map
105+
// +listMapKey=url
105106
// +optional
106-
SignatureStores []string `json:"signatureStores"`
107+
SignatureStores []SignatureStore `json:"signatureStores"`
107108

108109
// overrides is list of overides for components that are managed by
109110
// cluster version operator. Marking a component unmanaged will prevent
@@ -785,3 +786,26 @@ type ClusterVersionList struct {
785786

786787
Items []ClusterVersion `json:"items"`
787788
}
789+
790+
// SignatureStore represents the URL of custom Signature Store
791+
type SignatureStore struct {
792+
793+
// url contains the upstream custom signature store URL.
794+
// url should be a valid absolute http/https URI of an upstream signature store as per rfc1738.
795+
// This must be provided and cannot be empty.
796+
//
797+
// +kubebuilder:validation:Type=string
798+
// +kubebuilder:validation:XValidation:rule="isURL(self)",message="url must be a valid absolute URL"
799+
// +kubebuilder:validation:Required
800+
URL string `json:"url"`
801+
802+
// ca is an optional reference to a config map by name containing the PEM-encoded CA bundle.
803+
// It is used as a trust anchor to validate the TLS certificate presented by the remote server.
804+
// The key "ca.crt" is used to locate the data.
805+
// If specified and the config map or expected key is not found, the signature store is not honored.
806+
// If the specified ca data is not valid, the signature store is not honored.
807+
// If empty, we fall back to the CA configured via Proxy, which is appended to the default system roots.
808+
// The namespace for this config map is openshift-config.
809+
// +optional
810+
CA ConfigMapNameReference `json:"ca"`
811+
}

config/v1/zz_generated.deepcopy.go

+18-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/v1/zz_generated.swagger_doc_generated.go

+11-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/generated_openapi/zz_generated.openapi.go

+40-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)