Skip to content

Commit 36e54c3

Browse files
authored
Merge pull request #40 from Jakob-Naucke/trustee-self-deploy
Self-deploy Trustee
2 parents ff0c019 + 1d92670 commit 36e54c3

File tree

15 files changed

+396
-651
lines changed

15 files changed

+396
-651
lines changed

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
.PHONY: all build tools manifests-dir manifests cluster-up cluster-down image push install-trustee install clean fmt-check clippy lint test test-release
77

8+
NAMESPACE ?= confidential-clusters
9+
810
KUBECTL=kubectl
911

1012
REGISTRY ?= quay.io
1113
OPERATOR_IMAGE=$(REGISTRY)/confidential-clusters/cocl-operator:latest
1214
COMPUTE_PCRS_IMAGE=$(REGISTRY)/confidential-clusters/compute-pcrs:latest
1315
REG_SERVER_IMAGE=$(REGISTRY)/confidential-clusters/registration-server:latest
16+
# TODO add support for TPM AK verification, then move to a KBS with implemented verifier
17+
TRUSTEE_IMAGE ?= quay.io/confidential-clusters/key-broker-service:tpm-verifier-built-in-as-20250711
1418

1519
BUILD_TYPE ?= release
1620

@@ -34,11 +38,13 @@ ifndef TRUSTEE_ADDR
3438
$(error TRUSTEE_ADDR is undefined)
3539
endif
3640
target/debug/manifest-gen --output-dir manifests \
41+
--namespace $(NAMESPACE) \
3742
--image $(OPERATOR_IMAGE) \
38-
--trustee-namespace operators \
43+
--trustee-image $(TRUSTEE_IMAGE) \
3944
--pcrs-compute-image $(COMPUTE_PCRS_IMAGE) \
4045
--register-server-image $(REG_SERVER_IMAGE) \
41-
--trustee-addr $(TRUSTEE_ADDR):8080
46+
--trustee-addr $(TRUSTEE_ADDR):8080 \
47+
--register-server-port 8000
4248

4349
cluster-up:
4450
scripts/create-cluster-kind.sh
@@ -57,15 +63,13 @@ push: image
5763
podman push $(COMPUTE_PCRS_IMAGE) --tls-verify=false
5864
podman push $(REG_SERVER_IMAGE) --tls-verify=false
5965

60-
install-trustee:
61-
scripts/install-trustee.sh
62-
6366
install:
6467
scripts/clean-cluster-kind.sh $(OPERATOR_IMAGE) $(COMPUTE_PCRS_IMAGE) $(REG_SERVER_IMAGE)
6568
$(KUBECTL) apply -f manifests/operator.yaml
6669
$(KUBECTL) apply -f manifests/confidential_cluster_crd.yaml
6770
$(KUBECTL) apply -f manifests/confidential_cluster_cr.yaml
6871
$(KUBECTL) apply -f kind/register-forward.yaml
72+
$(KUBECTL) apply -f kind/kbs-forward.yaml
6973

7074
clean:
7175
cargo clean

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ within the cluster.
1313
- `/operator`: Contains the source code for the Kubernetes operator itself.
1414
- `/crds`: Defines the `ConfidentialCluster` Custom Resource Definition (CRD) in Rust.
1515
- `/register-server`: A server that provides Clevis PINs for key retrieval with random UUIDs.
16+
- `/compute-pcrs`: A program to compute PCR reference values using the [compute-pcrs library](https://github.com/confidential-clusters/compute-pcrs) and insert them into a ConfigMap, run as a Job.
17+
- `/rv-store`: Shared reference value definitions.
1618
- `/manifest-gen`: A tool for generating all the necessary Kubernetes manifests (Operator Deployment, CRD, RBAC rules, etc.).
1719
- `/scripts`: Helper scripts for managing a local `kind` development cluster.
1820
- `/manifests`: The default output directory for generated manifests. This directory is not checked into source control.
@@ -28,28 +30,27 @@ within the cluster.
2830

2931
### Quick Start
3032

31-
Create the cluster, install [trustee operator](https://github.com/confidential-containers/trustee-operator) and deploy
32-
the operator.
33+
Create the cluster and deploy the operator.
3334

3435
Provide an address where the VM you will attest from can access the cluster.
35-
In many cases, this will be your gateway address (`arp -a`).
36-
For an existing VM on system libvirt, you can also find this address via `virsh net-dhcp-leases`.
36+
When using a local kind & libvirt VM, this may be your gateway address (`default via …` in `ip route`) for user libvirt or bridge (`virbr0` in `ip route`) for system libvirt.
3737

3838
```bash
39-
$ arp -a
40-
_gateway (192.168.178.1) at 34:2c:c4:de:fc:52 [ether] on wlp0s20f3
41-
$ ip=192.168.178.1
39+
$ ip route
40+
...
41+
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
42+
...
43+
$ ip=192.168.122.1
4244
``
4345

4446
```bash
4547
make cluster-up
4648
make REGISTRY=localhost:5000 image push # optional: use BUILD_TYPE=debug
4749
make REGISTRY=localhost:5000 TRUSTEE_ADDR=$ip manifests
48-
make install-trustee
4950
make install
5051
```
5152

52-
The KBS port will be forwarded to `8080` on your machine; the node register server to `3030`, where new Ignition configs are served at `/register`.
53+
The KBS port will be forwarded to `8080` on your machine; the node register server to `8000`, where new Ignition configs are served at `/register`.
5354

5455
### Test
5556

crds/src/lib.rs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,11 @@ use serde::{Deserialize, Serialize};
1717
)]
1818
#[serde(rename_all = "camelCase")]
1919
pub struct ConfidentialClusterSpec {
20-
pub trustee: Trustee,
20+
pub trustee_image: String,
2121
pub pcrs_compute_image: String,
2222
pub register_server_image: String,
2323
pub trustee_addr: String,
24-
}
25-
26-
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
27-
pub struct Trustee {
28-
pub namespace: String,
29-
pub kbs_configuration: String,
30-
pub attestation_policy: String,
31-
pub resource_policy: String,
32-
pub reference_values: String,
33-
pub kbs_auth_key: String,
34-
pub kbs_config_name: String,
35-
}
36-
37-
#[derive(CustomResource, Debug, Clone, Deserialize, Serialize, JsonSchema)]
38-
#[kube(
39-
group = "confidentialcontainers.org",
40-
version = "v1alpha1",
41-
kind = "KbsConfig",
42-
namespaced,
43-
plural = "kbsconfigs"
44-
)]
45-
#[serde(rename_all = "camelCase")]
46-
pub struct KbsConfigSpec {
47-
pub kbs_config_map_name: String,
48-
pub kbs_auth_secret_name: String,
49-
pub kbs_deployment_type: String,
50-
pub kbs_rvps_ref_values_config_map_name: String,
51-
pub kbs_secret_resources: Vec<String>,
52-
pub kbs_https_key_secret_name: String,
53-
pub kbs_https_cert_secret_name: String,
54-
pub kbs_resource_policy_config_map_name: String,
55-
pub kbs_attestation_policy_config_map_name: String,
24+
pub register_server_port: i32,
5625
}
5726

5827
#[derive(CustomResource, Debug, Clone, Deserialize, Serialize, JsonSchema)]

kind/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ nodes:
1515
- containerPort: 31000
1616
hostPort: 8080
1717
- containerPort: 31001
18-
hostPort: 3030
18+
hostPort: 8000
1919
featureGates:
2020
"ImageVolume": true

kind/kbs-forward.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SPDX-FileCopyrightText: Jakob Naucke <jnaucke@redhat.com>
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
apiVersion: v1
6+
kind: Service
7+
metadata:
8+
name: kbs-forward
9+
namespace: confidential-clusters
10+
spec:
11+
type: NodePort
12+
ports:
13+
- name: http
14+
nodePort: 31000
15+
port: 8080
16+
selector:
17+
app: kbs

kind/register-forward.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ spec:
1212
ports:
1313
- name: http
1414
nodePort: 31001
15-
port: 3030
15+
port: 8000
1616
selector:
1717
app: register-server

0 commit comments

Comments
 (0)