Skip to content

Commit 1422d59

Browse files
committed
Add TLS to Rekor and Trillian services
1 parent 52c95e5 commit 1422d59

21 files changed

+1385
-1
lines changed

api/v1alpha1/common.go

+14
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,17 @@ type Pvc struct {
9090
//+optional
9191
StorageClass string `json:"storageClass,omitempty"`
9292
}
93+
94+
// TLSCert defines fields for TLS certificate
95+
// +kubebuilder:validation:XValidation:rule=(!has(self.certRef) || has(self.privateKeyRef)),message=privateKeyRef cannot be empty
96+
type TLSCert struct {
97+
// Reference to the private key
98+
//+optional
99+
PrivateKeyRef *SecretKeySelector `json:"privateKeyRef,omitempty"`
100+
// Reference to service certificate
101+
//+optional
102+
CertRef *SecretKeySelector `json:"certRef,omitempty"`
103+
// Reference to CA certificate
104+
//+optional
105+
CACertRef *LocalObjectReference `json:"caCertRef,omitempty"`
106+
}

api/v1alpha1/rekor_types.go

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type RekorSpec struct {
3232
// BackFillRedis CronJob Configuration
3333
//+kubebuilder:default:={enabled: true, schedule: "0 0 * * *"}
3434
BackFillRedis BackFillRedis `json:"backFillRedis,omitempty"`
35+
// Reference to TLS server certificate, private key and CA certificate
36+
//+optional
37+
TLSCertificate TLSCert `json:"tls"`
3538
}
3639

3740
type RekorSigner struct {

api/v1alpha1/rekor_types_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ var _ = Describe("Rekor", func() {
246246
Address: "trillian-system.default.svc",
247247
Port: &port,
248248
},
249+
TLSCertificate: TLSCert{
250+
CACertRef: &LocalObjectReference{
251+
Name: "ca-configmap",
252+
},
253+
},
249254
},
250255
}
251256

api/v1alpha1/trillian_types.go

+13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ type TrillianSpec struct {
2727
//+kubebuilder:validation:XValidation:rule=((!self.create && self.databaseSecretRef != null) || self.create),message=databaseSecretRef cannot be empty
2828
//+kubebuilder:default:={create: true, pvc: {size: "5Gi", retain: true}}
2929
Db TrillianDB `json:"database,omitempty"`
30+
//+optional
31+
TrillianServer TrillianServer `json:"server,omitempty"`
32+
//+optional
33+
TrillianSigner TrillianSigner `json:"signer,omitempty"`
3034
// Enable Monitoring for Logsigner and Logserver
3135
Monitoring MonitoringConfig `json:"monitoring,omitempty"`
3236
}
@@ -49,6 +53,15 @@ type TrillianDB struct {
4953
Pvc Pvc `json:"pvc,omitempty"`
5054
}
5155

56+
type TrillianServer struct {
57+
// Secret with TLS server certificate, private key and CA certificate
58+
TLSCertificate TLSCert `json:"tls"`
59+
}
60+
type TrillianSigner struct {
61+
// Secret with TLS server certificate, private key and CA certificate
62+
TLSCertificate TLSCert `json:"tls"`
63+
}
64+
5265
// TrillianStatus defines the observed state of Trillian
5366
type TrillianStatus struct {
5467
Db TrillianDB `json:"database,omitempty"`

api/v1alpha1/trillian_types_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,30 @@ var _ = Describe("Trillian", func() {
157157
Name: "secret",
158158
},
159159
},
160+
TrillianServer: TrillianServer{
161+
TLSCertificate: TLSCert{
162+
CertRef: &SecretKeySelector{
163+
Key: "cert",
164+
LocalObjectReference: LocalObjectReference{Name: "server-secret"},
165+
},
166+
PrivateKeyRef: &SecretKeySelector{
167+
Key: "key",
168+
LocalObjectReference: LocalObjectReference{Name: "server-secret"},
169+
},
170+
},
171+
},
172+
TrillianSigner: TrillianSigner{
173+
TLSCertificate: TLSCert{
174+
CertRef: &SecretKeySelector{
175+
Key: "cert",
176+
LocalObjectReference: LocalObjectReference{Name: "signer-secret"},
177+
},
178+
PrivateKeyRef: &SecretKeySelector{
179+
Key: "key",
180+
LocalObjectReference: LocalObjectReference{Name: "signer-secret"},
181+
},
182+
},
183+
},
160184
},
161185
}
162186

api/v1alpha1/zz_generated.deepcopy.go

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

bundle/manifests/rhtas-operator.clusterserviceversion.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ metadata:
192192
]
193193
capabilities: Seamless Upgrades
194194
containerImage: registry.redhat.io/rhtas/rhtas-rhel9-operator@sha256:a21f7128694a64989bf0d84a7a7da4c1ffc89edf62d594dc8bea7bcfe9ac08d3
195-
createdAt: "2024-07-03T12:24:03Z"
195+
createdAt: "2024-07-09T08:45:46Z"
196196
features.operators.openshift.io/cnf: "false"
197197
features.operators.openshift.io/cni: "false"
198198
features.operators.openshift.io/csi: "false"

bundle/manifests/rhtas.redhat.com_rekors.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,62 @@ spec:
198198
type: object
199199
x-kubernetes-map-type: atomic
200200
type: object
201+
tls:
202+
description: Reference to TLS server certificate, private key and
203+
CA certificate
204+
properties:
205+
caCertRef:
206+
description: Reference to CA certificate
207+
properties:
208+
name:
209+
description: |-
210+
Name of the referent.
211+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
212+
type: string
213+
required:
214+
- name
215+
type: object
216+
x-kubernetes-map-type: atomic
217+
certRef:
218+
description: Reference to service certificate
219+
properties:
220+
key:
221+
description: The key of the secret to select from. Must be
222+
a valid secret key.
223+
pattern: ^[-._a-zA-Z0-9]+$
224+
type: string
225+
name:
226+
description: |-
227+
Name of the referent.
228+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
229+
type: string
230+
required:
231+
- key
232+
- name
233+
type: object
234+
x-kubernetes-map-type: atomic
235+
privateKeyRef:
236+
description: Reference to the private key
237+
properties:
238+
key:
239+
description: The key of the secret to select from. Must be
240+
a valid secret key.
241+
pattern: ^[-._a-zA-Z0-9]+$
242+
type: string
243+
name:
244+
description: |-
245+
Name of the referent.
246+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
247+
type: string
248+
required:
249+
- key
250+
- name
251+
type: object
252+
x-kubernetes-map-type: atomic
253+
type: object
254+
x-kubernetes-validations:
255+
- message: privateKeyRef cannot be empty
256+
rule: (!has(self.certRef) || has(self.privateKeyRef))
201257
treeID:
202258
description: |-
203259
ID of Merkle tree in Trillian backend

0 commit comments

Comments
 (0)