Skip to content

Commit f6e2a9a

Browse files
committed
kbsLocalCertCacheSpec mountPath is optional
Signed-off-by: Leonardo Milleri <[email protected]>
1 parent 1504f59 commit f6e2a9a

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

api/v1alpha1/kbsconfig_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ type KbsLocalCertCacheEntry struct {
5555
// SecretName is the name of the secret that maps to a local directory containing the certificates
5656
SecretName string `json:"secretName"`
5757
// MountPath is the destination path in the trustee file system
58+
// The default path is "/etc/kbs/certs" if not specified by the user
59+
// +optional
5860
MountPath string `json:"mountPath"`
5961
}
6062

bundle/manifests/confidentialcontainers.org_kbsconfigs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ spec:
114114
cache entry with secret and mount path
115115
properties:
116116
mountPath:
117-
description: MountPath is the destination path in the trustee
118-
file system
117+
description: |-
118+
MountPath is the destination path in the trustee file system
119+
The default path is "/etc/kbs/certs" if not specified by the user
119120
type: string
120121
secretName:
121122
description: SecretName is the name of the secret that maps
122123
to a local directory containing the certificates
123124
type: string
124125
required:
125-
- mountPath
126126
- secretName
127127
type: object
128128
type: array

config/crd/bases/confidentialcontainers.org_kbsconfigs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ spec:
114114
cache entry with secret and mount path
115115
properties:
116116
mountPath:
117-
description: MountPath is the destination path in the trustee
118-
file system
117+
description: |-
118+
MountPath is the destination path in the trustee file system
119+
The default path is "/etc/kbs/certs" if not specified by the user
119120
type: string
120121
secretName:
121122
description: SecretName is the name of the secret that maps
122123
to a local directory containing the certificates
123124
type: string
124125
required:
125-
- mountPath
126126
- secretName
127127
type: object
128128
type: array

docs/disconnected.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838
```
3939
4040
The `VCEK.crt` certificate will be mounted in the trustee `mountPath` directory.
41+
The `mountPath` directory defaults to `/etc/kbs/certs` if not provided by the user.
4142

4243
### Multiple Certificates
4344

@@ -54,12 +55,12 @@ spec:
5455
# ...
5556
kbsLocalCertCacheSpec:
5657
secrets:
57-
- secretName: vcek-secret
58-
mountPath: "/etc/kbs/snp/ek"
59-
- secretName: ca-certs-secret
60-
mountPath: "/etc/ssl/certs"
61-
- secretName: client-certs-secret
62-
mountPath: "/etc/ssl/client-certs"
58+
- secretName: vcek-milan
59+
mountPath: "/etc/kbs/snp/ek/milan"
60+
- secretName: vcek-genoa
61+
mountPath: "/etc/kbs/snp/ek/genoa"
62+
- secretName: vcek-turin
63+
mountPath: "/etc/kbs/snp/ek/turin"
6364
```
6465

6566
Each secret will be mounted to its specified `mountPath` in the trustee file system.

internal/controller/common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ const (
7676

7777
// default attestation policy filename for cpu
7878
defaultAttestationCpuPolicy = "default_cpu.rego"
79+
80+
// default directory for locally cached certificates
81+
kbsDefaultLocalCacheDir = "/etc/kbs/certs"
7982
)
8083

8184
func contains(list []string, s string) bool {

internal/controller/kbsconfig_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ func (r *KbsConfigReconciler) newKbsDeployment(ctx context.Context) (*appsv1.Dep
427427
return nil, err
428428
}
429429
volumes = append(volumes, *volume)
430+
if certCacheEntry.MountPath == "" {
431+
certCacheEntry.MountPath = kbsDefaultLocalCacheDir
432+
}
430433
volumeMount = createVolumeMount(volume.Name, certCacheEntry.MountPath)
431434
kbsVM = append(kbsVM, volumeMount)
432435
}

0 commit comments

Comments
 (0)