Skip to content

Commit 45f44a7

Browse files
committed
add SignatureStores to ClusterVersionSpec
SignatureStore will help us define custom signature stores which can then be used in air-gapped environments. it'll also give admin flexibility to remove one or more signature stores that they're not comfortable using.
1 parent b867610 commit 45f44a7

7 files changed

+122
-7
lines changed

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

+10
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ spec:
146146
unmanaged:
147147
description: 'unmanaged controls if cluster version operator should stop managing the resources in this cluster. Default: false'
148148
type: boolean
149+
signatureStores:
150+
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."
151+
type: array
152+
maxItems: 32
153+
items:
154+
type: string
155+
x-kubernetes-list-type: set
156+
x-kubernetes-validations:
157+
- rule: self.all(x, isURL(x))
158+
message: signatureStores must contain only valid absolute URLs per the Go net/url standard
149159
upstream:
150160
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.
151161
type: string

config/v1/stable.clusterversion.testsuite.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,60 @@ tests:
162162
additionalEnabledCapabilities:
163163
- marketplace
164164
expectedError: the `marketplace` capability requires the `OperatorLifecycleManager` capability, which is neither explicitly or implicitly enabled in this cluster, please enable the `OperatorLifecycleManager` capability
165+
- name: Should be able to set a custom signature store
166+
initial: |
167+
apiVersion: config.openshift.io/v1
168+
kind: ClusterVersion
169+
spec:
170+
clusterID: foo
171+
signatureStores:
172+
- "https://osus.ocp.com"
173+
expected: |
174+
apiVersion: config.openshift.io/v1
175+
kind: ClusterVersion
176+
spec:
177+
clusterID: foo
178+
signatureStores:
179+
- "https://osus.ocp.com"
180+
- name: Should be able to set multiple custom signature store
181+
initial: |
182+
apiVersion: config.openshift.io/v1
183+
kind: ClusterVersion
184+
spec:
185+
clusterID: foo
186+
signatureStores:
187+
- "https://osus1.ocp.com"
188+
- "https://osus2.ocp.com"
189+
expected: |
190+
apiVersion: config.openshift.io/v1
191+
kind: ClusterVersion
192+
spec:
193+
clusterID: foo
194+
signatureStores:
195+
- "https://osus1.ocp.com"
196+
- "https://osus2.ocp.com"
197+
- name: Invalid custom signature store should throw error
198+
initial: |
199+
apiVersion: config.openshift.io/v1
200+
kind: ClusterVersion
201+
spec:
202+
clusterID: foo
203+
signatureStores:
204+
- "osus1.ocp.com"
205+
expectedError: "signatureStores must contain only valid absolute URLs per the Go net/url standard"
206+
- name: Should be able to unset the signature stores
207+
initial: |
208+
apiVersion: config.openshift.io/v1
209+
kind: ClusterVersion
210+
spec:
211+
clusterID: foo
212+
signatureStores: []
213+
expected: |
214+
apiVersion: config.openshift.io/v1
215+
kind: ClusterVersion
216+
spec:
217+
clusterID: foo
218+
signatureStores: []
165219
onUpdate:
166220
- name: Should not allow image to be set if architecture set
167221
initial: |

config/v1/types_cluster_version.go

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

91+
// signatureStores contains the upstream URIs to verify release signatures.
92+
// By default, CVO will use existing signature stores if this property is empty.
93+
// The CVO will check the release signatures in the local ConfigMaps first. It will search for a valid signature
94+
// in these stores in parallel only when local ConfigMaps did not include a valid signature.
95+
// Validation will fail if none of the signature stores reply with valid signature before timeout.
96+
// Setting signatureStores will replace the default signature stores with custom signature stores.
97+
// Default stores can be used with custom signature stores by adding them manually.
98+
//
99+
// Items in this list should be a valid absolute http/https URI of an upstream signature store as per rfc1738.
100+
// 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"
102+
// +kubebuilder:validation:MaxItems=32
103+
// +listType=set
104+
// +optional
105+
SignatureStores []string `json:"signatureStores"`
106+
91107
// overrides is list of overides for components that are managed by
92108
// cluster version operator. Marking a component unmanaged will prevent
93109
// the operator from creating or updating the object.

config/v1/zz_generated.deepcopy.go

+5
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

+8-7
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

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

openapi/openapi.json

+9
Original file line numberDiff line numberDiff line change
@@ -5276,6 +5276,15 @@
52765276
"$ref": "#/definitions/com.github.openshift.api.config.v1.ComponentOverride"
52775277
}
52785278
},
5279+
"signatureStores": {
5280+
"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\nItems 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.",
5281+
"type": "array",
5282+
"items": {
5283+
"type": "string",
5284+
"default": ""
5285+
},
5286+
"x-kubernetes-list-type": "set"
5287+
},
52795288
"upstream": {
52805289
"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.",
52815290
"type": "string"

0 commit comments

Comments
 (0)