Skip to content

Commit d2ebcd0

Browse files
committed
[feat] declarative TUF
1 parent 9dc7084 commit d2ebcd0

42 files changed

Lines changed: 2221 additions & 1751 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -181,32 +181,6 @@ jobs:
181181
podman build ${{ env.OCP_VERSION }}/rhtas-operator -f catalog.Dockerfile -t $CATALOG_IMG
182182
podman push $CATALOG_IMG
183183
184-
build-tufcli:
185-
name: Build-tufcli
186-
runs-on: ubuntu-24.04
187-
steps:
188-
- name: Checkout tufcli source
189-
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
190-
with:
191-
repository: "securesign/tufcli"
192-
path: tufcli
193-
194-
- name: Install Go
195-
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
196-
with:
197-
go-version: ${{ env.GO_VERSION }}
198-
199-
- name: Build
200-
run: cd tufcli && CGO_ENABLED=0 go build -o /tmp/tufcli .
201-
202-
- name: Upload artifact
203-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
204-
with:
205-
name: tufcli
206-
path: /tmp/tufcli
207-
retention-days: 1
208-
if-no-files-found: error
209-
210184
test-kind:
211185
name: Test kind deployment
212186
runs-on: ubuntu-24.04
@@ -215,7 +189,6 @@ jobs:
215189
packages: read
216190
needs:
217191
- build-operator
218-
- build-tufcli
219192
steps:
220193
- name: Checkout source
221194
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -225,17 +198,6 @@ jobs:
225198
with:
226199
go-version: ${{ env.GO_VERSION }}
227200

228-
- name: Download tufcli
229-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
230-
with:
231-
name: tufcli
232-
path: /tmp/tufcli
233-
234-
- name: Make tufcli executable
235-
run: chmod +x /tmp/tufcli/tufcli
236-
237-
- run: echo "/tmp/tufcli" >> $GITHUB_PATH
238-
239201
- name: Log in to GitHub Container Registry
240202
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
241203
with:
@@ -730,6 +692,7 @@ jobs:
730692
kubectl create -f config/samples/rhtas_v1_securesign.yaml -n ${{ env.TEST_NAMESPACE }}
731693
sleep 1
732694
kubectl wait --for=condition=Ready securesign/securesign-sample --timeout=5m -n ${{ env.TEST_NAMESPACE }}
695+
kubectl wait --for=condition=trustroot-synced tuf/securesign-sample --timeout=5m -n ${{ env.TEST_NAMESPACE }}
733696
734697
- name: Run tests
735698
env:
@@ -794,7 +757,6 @@ jobs:
794757
id-token: write
795758
needs:
796759
- build-operator-coverage
797-
- build-tufcli
798760
steps:
799761
- name: Checkout source
800762
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -809,17 +771,6 @@ jobs:
809771
go install github.com/konflux-ci/coverport/cli@latest
810772
mv "$(go env GOPATH)/bin/cli" "$(go env GOPATH)/bin/coverport"
811773
812-
- name: Download tufcli
813-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
814-
with:
815-
name: tufcli
816-
path: /tmp/tufcli
817-
818-
- name: Make tufcli executable
819-
run: chmod +x /tmp/tufcli/tufcli
820-
821-
- run: echo "/tmp/tufcli" >> $GITHUB_PATH
822-
823774
- name: Log in to GitHub Container Registry
824775
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
825776
with:

‎config/default/images.env‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
# Trillian - Log Signer
2-
RELATED_IMAGE_TRILLIAN_LOG_SIGNER=registry.redhat.io/rhtas/trillian-logsigner-rhel9@sha256:481920692f63270a0d0c84b51c059612ad241a522f575ed524f1e75800e8f9d9
2+
RELATED_IMAGE_TRILLIAN_LOG_SIGNER=quay.io/securesign/trillian-logsigner@sha256:481920692f63270a0d0c84b51c059612ad241a522f575ed524f1e75800e8f9d9
33

44
# Trillian - Database
5-
RELATED_IMAGE_TRILLIAN_DB=registry.redhat.io/rhtas/trillian-database-rhel9@sha256:f1e5a7ba5a87a2bc513fa1d0d9f34722458384625df3e9a8a2c6716b95a6c8e3
5+
RELATED_IMAGE_TRILLIAN_DB=quay.io/securesign/trillian-database@sha256:f1e5a7ba5a87a2bc513fa1d0d9f34722458384625df3e9a8a2c6716b95a6c8e3
66

77
# Trillian - Log Server
8-
RELATED_IMAGE_TRILLIAN_LOG_SERVER=registry.redhat.io/rhtas/trillian-logserver-rhel9@sha256:510a124d56104b84e08d15f9fccf4afe8375f93a21d583c0cf38565bc33e7490
8+
RELATED_IMAGE_TRILLIAN_LOG_SERVER=quay.io/securesign/trillian-logserver@sha256:510a124d56104b84e08d15f9fccf4afe8375f93a21d583c0cf38565bc33e7490
99

1010
# Trillian - Netcat (ose-tools)
1111
RELATED_IMAGE_TRILLIAN_NETCAT=registry.redhat.io/openshift4/ose-tools-rhel9@sha256:d76b7ec587ba8d8b29cf709d9db0eb1fa3117e20650989c3b35095f395db0313
1212

1313
# Trillian - CreateTree
14-
RELATED_IMAGE_CREATETREE=registry.redhat.io/rhtas/createtree-rhel9@sha256:bfad1f2dd1a732935d5f720a6999501f9c48f0f2d349c45a769c1bb940bef3fa
14+
RELATED_IMAGE_CREATETREE=quay.io/securesign/trillian-createtree@sha256:bfad1f2dd1a732935d5f720a6999501f9c48f0f2d349c45a769c1bb940bef3fa
1515

1616
# Fulcio - Server
17-
RELATED_IMAGE_FULCIO_SERVER=registry.redhat.io/rhtas/fulcio-rhel9@sha256:e110cf3e0817062ab34dc55c945725a489dcc4dacc0e5b5ff273d18e7c709d7f
17+
RELATED_IMAGE_FULCIO_SERVER=quay.io/securesign/fulcio-server@sha256:e110cf3e0817062ab34dc55c945725a489dcc4dacc0e5b5ff273d18e7c709d7f
1818

1919
# Rekor - Server
20-
RELATED_IMAGE_REKOR_SERVER=registry.redhat.io/rhtas/rekor-server-rhel9@sha256:8b94f7b4302264bfbab0582eb29f10ed8fe936001af1cccbb87bd67ec977cf07
20+
RELATED_IMAGE_REKOR_SERVER=quay.io/securesign/rekor-server@sha256:8b94f7b4302264bfbab0582eb29f10ed8fe936001af1cccbb87bd67ec977cf07
2121

2222
# Rekor - Redis
23-
RELATED_IMAGE_REKOR_REDIS=registry.redhat.io/rhtas/trillian-redis-rhel9@sha256:61f79b817f74c9c959d10f026808d89fdca0c923020fca5fd67f414a5a49916d
23+
RELATED_IMAGE_REKOR_REDIS=quay.io/securesign/trillian-redis@sha256:61f79b817f74c9c959d10f026808d89fdca0c923020fca5fd67f414a5a49916d
2424

2525
# Rekor - Backfill Redis
26-
RELATED_IMAGE_BACKFILL_REDIS=registry.redhat.io/rhtas/rekor-backfill-redis-rhel9@sha256:65c5fea1211077ebd8aad7b67eef5dbbe8b94900149067623b7fd4b56346b1b4
26+
RELATED_IMAGE_BACKFILL_REDIS=quay.io/securesign/rekor-backfill-redis@sha256:65c5fea1211077ebd8aad7b67eef5dbbe8b94900149067623b7fd4b56346b1b4
2727

2828
# TUF - Init TUF repository
29-
RELATED_IMAGE_TUF=registry.redhat.io/rhtas/tufcli-init-rhel9@sha256:0710894138483ac6f10c1f71d7c0880920bf88bc255b9d35a97333916fa8e902
29+
RELATED_IMAGE_TUF=quay.io/securesign/tufcli-init@sha256:0710894138483ac6f10c1f71d7c0880920bf88bc255b9d35a97333916fa8e902
3030

3131
# CTlog - Server
32-
RELATED_IMAGE_CTLOG=registry.redhat.io/rhtas/certificate-transparency-rhel9@sha256:7b59935489352231f55457861353e70adc7484f0ac1ff89c7c8c454047a9fa98
32+
RELATED_IMAGE_CTLOG=quay.io/securesign/certificate-transparency-go@sha256:7b59935489352231f55457861353e70adc7484f0ac1ff89c7c8c454047a9fa98
3333

3434
# HTTP Server (httpd)
3535
RELATED_IMAGE_HTTP_SERVER=registry.redhat.io/ubi9/httpd-24@sha256:306e2514eaaf78ab6cb4b25c181d3b6ca732cc7d1938a41119ff78c63ffa5123
3636

3737
# Timestamp Authority - Server
38-
RELATED_IMAGE_TIMESTAMP_AUTHORITY=registry.redhat.io/rhtas/timestamp-authority-rhel9@sha256:ebbecc12833fd164b4a1f77a1f55aa27295692e93826df245e29de2eb19f3d73
38+
RELATED_IMAGE_TIMESTAMP_AUTHORITY=quay.io/securesign/timestamp-authority@sha256:ebbecc12833fd164b4a1f77a1f55aa27295692e93826df245e29de2eb19f3d73
3939

4040
# Rekor - Monitor
41-
RELATED_IMAGE_REKOR_MONITOR=registry.redhat.io/rhtas/rekor-monitor-rhel9@sha256:3958e8cd76396d52c2885b7ede6fa6ea904520ea1b15e345c699f1643c343494
41+
RELATED_IMAGE_REKOR_MONITOR=quay.io/securesign/rekor-monitor@sha256:3958e8cd76396d52c2885b7ede6fa6ea904520ea1b15e345c699f1643c343494
4242

4343
# CTlog - Monitor
44-
RELATED_IMAGE_CTLOG_MONITOR=registry.redhat.io/rhtas/ctlog-monitor-rhel9@sha256:b58cf4789e070bd1a5e398bcdefed601c4445b4b7cab524fdadb3af9434bc593
44+
RELATED_IMAGE_CTLOG_MONITOR=quay.io/securesign/ctlog-monitor@sha256:b58cf4789e070bd1a5e398bcdefed601c4445b4b7cab524fdadb3af9434bc593
4545

4646
# Console - UI
47-
RELATED_IMAGE_CONSOLE_UI=registry.redhat.io/rhtas/rhtas-console-ui-rhel9@sha256:2a0ead6c4378367d5feceea5d494e5565d52738aebd136d35a0e2ae80e7afb14
47+
RELATED_IMAGE_CONSOLE_UI=quay.io/securesign/rhtas-console-ui@sha256:2a0ead6c4378367d5feceea5d494e5565d52738aebd136d35a0e2ae80e7afb14
4848

4949
# Console - API
50-
RELATED_IMAGE_CONSOLE_API=registry.redhat.io/rhtas/rhtas-console-rhel9@sha256:dd73d67fe1a83bd0c3f53efc00345ab626e65ebc57afc9c817d1413b13d146de
50+
RELATED_IMAGE_CONSOLE_API=quay.io/securesign/rhtas-console@sha256:dd73d67fe1a83bd0c3f53efc00345ab626e65ebc57afc9c817d1413b13d146de

‎config/rbac/role.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ rules:
2222
- ""
2323
resources:
2424
- namespaces
25+
- pods
2526
verbs:
2627
- get
2728
- list

‎internal/controller/securesign/actions/ensure_tuf.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ func (i tufAction) CopyStatus(ctx context.Context, object *rhtasv1.Tuf, instance
107107
})
108108
case instance.Status.TufStatus.URL != object.Status.URL:
109109
instance.Status.TufStatus.URL = object.Status.URL
110+
case meta.IsStatusConditionTrue(instance.Status.Conditions, TufCondition) && meta.IsStatusConditionPresentAndEqual(object.Status.Conditions, tufConstants.TrustRootSynced, v1.ConditionFalse):
111+
synchronized := meta.FindStatusCondition(object.Status.Conditions, tufConstants.TrustRootSynced)
112+
meta.SetStatusCondition(&instance.Status.Conditions, v1.Condition{
113+
Type: TufCondition,
114+
Status: v1.ConditionFalse,
115+
Reason: synchronized.Reason,
116+
Message: synchronized.Message,
117+
})
110118
default:
111119
return i.Continue()
112120
}

‎internal/controller/tuf/actions/fips_validation.go‎

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package actions
33
import (
44
"context"
55
"fmt"
6+
"maps"
7+
"slices"
68

79
rhtasv1 "github.com/securesign/operator/api/v1"
810
"github.com/securesign/operator/internal/action"
911
fipsAction "github.com/securesign/operator/internal/action/fips"
1012
tufConstants "github.com/securesign/operator/internal/controller/tuf/constants"
11-
"github.com/securesign/operator/internal/controller/tuf/trustroot"
1213
fipsutil "github.com/securesign/operator/internal/utils/fips"
1314
"sigs.k8s.io/controller-runtime/pkg/client"
1415
)
@@ -25,22 +26,40 @@ func NewFIPSValidationAction() action.Action[*rhtasv1.Tuf] {
2526

2627
func tufCryptoMaterial(ctx context.Context, i *rhtasv1.Tuf, c client.Client) ([]fipsAction.CryptoRef, error) {
2728
var refs []fipsAction.CryptoRef
28-
29-
specHasRef := make(map[string]bool)
30-
for _, key := range trustroot.ActiveKeys(i) {
31-
secretRef := trustroot.Binding(i, key).SecretRef
32-
if secretRef == nil {
33-
continue
29+
asTrustRootBindings := func(bindings []rhtasv1.TrustRootBindingWithOIDC) []rhtasv1.TrustRootBinding {
30+
b := make([]rhtasv1.TrustRootBinding, len(bindings))
31+
for i, binding := range bindings {
32+
b[i] = binding.TrustRootBinding
3433
}
35-
specHasRef[key.String()] = true
36-
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, secretRef,
37-
fmt.Sprintf("spec.%s[0].secretRef", key), fipsutil.ValidateCryptoMaterialPEM, &refs); err != nil {
38-
return nil, err
34+
return b
35+
}
36+
37+
components := map[string][]rhtasv1.TrustRootBinding{
38+
"ctlog": i.Spec.Ctlog,
39+
"fulcio": asTrustRootBindings(i.Spec.Fulcio),
40+
"rekor": i.Spec.Rekor,
41+
"tsa": i.Spec.Tsa,
42+
}
43+
for component, array := range components {
44+
for _, key := range array {
45+
46+
if key.SecretRef == nil {
47+
continue
48+
}
49+
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, key.SecretRef,
50+
fmt.Sprintf("spec.%s[0].secretRef", component), fipsutil.ValidateCryptoMaterialPEM, &refs); err != nil {
51+
return nil, err
52+
}
3953
}
4054
}
4155

4256
for _, ks := range i.Status.Keys {
43-
if ks.SecretRef == nil || specHasRef[ks.Name] {
57+
if ks.SecretRef == nil {
58+
continue
59+
}
60+
if slices.ContainsFunc(slices.Concat(slices.Collect(maps.Values(components))...), func(key rhtasv1.TrustRootBinding) bool {
61+
return key.SecretRef != nil && key.SecretRef.Name == ks.SecretRef.Name
62+
}) {
4463
continue
4564
}
4665
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, ks.SecretRef,

‎internal/controller/tuf/actions/migration_job.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/securesign/operator/internal/constants"
1212
"github.com/securesign/operator/internal/controller/traits"
1313
tufConstants "github.com/securesign/operator/internal/controller/tuf/constants"
14+
"github.com/securesign/operator/internal/controller/tuf/trustroot"
1415
"github.com/securesign/operator/internal/controller/tuf/utils"
1516
"github.com/securesign/operator/internal/labels"
1617
"github.com/securesign/operator/internal/state"
@@ -133,7 +134,7 @@ func (i migrationJobAction) ensureMigrationJob(ctx context.Context, labels map[s
133134
),
134135
)
135136
if err != nil {
136-
if errors.Is(err, utils.ErrorResolveServiceUrl) {
137+
if errors.Is(err, trustroot.ErrorResolveServiceUrl) {
137138
return i.Error(ctx, err, instance,
138139
metav1.Condition{
139140
Type: constants.ReadyCondition,

‎internal/controller/tuf/actions/migration_job_test.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package actions
22

33
import (
4+
_ "embed"
45
"testing"
56
"time"
67

@@ -25,6 +26,9 @@ import (
2526
"sigs.k8s.io/controller-runtime/pkg/client/fake"
2627
)
2728

29+
//go:embed testdata/public_key.pem
30+
var testPEM string
31+
2832
func setupMigrateAction() migrationJobAction {
2933
scheme := runtime.NewScheme()
3034
utilruntime.Must(corev1.AddToScheme(scheme))

0 commit comments

Comments
 (0)