Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 1 addition & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,6 @@ jobs:
podman build ${{ env.OCP_VERSION }}/rhtas-operator -f catalog.Dockerfile -t $CATALOG_IMG
podman push $CATALOG_IMG

build-tufcli:
name: Build-tufcli
runs-on: ubuntu-24.04
steps:
- name: Checkout tufcli source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
repository: "securesign/tufcli"
path: tufcli

- name: Install Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ env.GO_VERSION }}

- name: Build
run: cd tufcli && CGO_ENABLED=0 go build -o /tmp/tufcli .

- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tufcli
path: /tmp/tufcli
retention-days: 1
if-no-files-found: error

test-kind:
name: Test kind deployment
runs-on: ubuntu-24.04
Expand All @@ -215,7 +189,6 @@ jobs:
packages: read
needs:
- build-operator
- build-tufcli
steps:
- name: Checkout source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
Expand All @@ -225,17 +198,6 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Download tufcli
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: tufcli
path: /tmp/tufcli

- name: Make tufcli executable
run: chmod +x /tmp/tufcli/tufcli

- run: echo "/tmp/tufcli" >> $GITHUB_PATH

- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
with:
Expand Down Expand Up @@ -730,6 +692,7 @@ jobs:
kubectl create -f config/samples/rhtas_v1_securesign.yaml -n ${{ env.TEST_NAMESPACE }}
sleep 1
kubectl wait --for=condition=Ready securesign/securesign-sample --timeout=5m -n ${{ env.TEST_NAMESPACE }}
kubectl wait --for=condition=trustroot-synced tuf/securesign-sample --timeout=5m -n ${{ env.TEST_NAMESPACE }}

- name: Run tests
env:
Expand Down Expand Up @@ -794,7 +757,6 @@ jobs:
id-token: write
needs:
- build-operator-coverage
- build-tufcli
steps:
- name: Checkout source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
Expand All @@ -809,17 +771,6 @@ jobs:
go install github.com/konflux-ci/coverport/cli@latest
mv "$(go env GOPATH)/bin/cli" "$(go env GOPATH)/bin/coverport"

- name: Download tufcli
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: tufcli
path: /tmp/tufcli

- name: Make tufcli executable
run: chmod +x /tmp/tufcli/tufcli

- run: echo "/tmp/tufcli" >> $GITHUB_PATH

- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
with:
Expand Down
1 change: 1 addition & 0 deletions api/v1/tuf_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ type TufStatus struct {
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="The component status"
// +kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`,description="The component url"
// +kubebuilder:printcolumn:name="Trustroot Synchronized",type=string,JSONPath=`.status.conditions[?(@.type=="trustroot-synchronized")].reason`,description="TrustRoot synchronization status"

// Tuf is the Schema for the tufs API
// +kubebuilder:validation:XValidation:rule="!has(self.spec.replicas) || !(self.spec.replicas > 1) || (has(self.spec.pvc.accessModes) && 'ReadWriteMany' in self.spec.pvc.accessModes)",message="For deployments with more than 1 replica, pvc.accessModes must include 'ReadWriteMany'."
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/rhtas.redhat.com_tufs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ spec:
jsonPath: .status.url
name: URL
type: string
- description: TrustRoot synchronization status
jsonPath: .status.conditions[?(@.type=="trustroot-synchronized")].reason
name: Trustroot Synchronized
type: string
name: v1
schema:
openAPIV3Schema:
Expand Down
30 changes: 15 additions & 15 deletions config/default/images.env
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# Trillian - Log Signer
RELATED_IMAGE_TRILLIAN_LOG_SIGNER=registry.redhat.io/rhtas/trillian-logsigner-rhel9@sha256:481920692f63270a0d0c84b51c059612ad241a522f575ed524f1e75800e8f9d9
RELATED_IMAGE_TRILLIAN_LOG_SIGNER=quay.io/securesign/trillian-logsigner@sha256:481920692f63270a0d0c84b51c059612ad241a522f575ed524f1e75800e8f9d9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

# Console - API
RELATED_IMAGE_CONSOLE_API=registry.redhat.io/rhtas/rhtas-console-rhel9@sha256:dd73d67fe1a83bd0c3f53efc00345ab626e65ebc57afc9c817d1413b13d146de
RELATED_IMAGE_CONSOLE_API=quay.io/securesign/rhtas-console@sha256:dd73d67fe1a83bd0c3f53efc00345ab626e65ebc57afc9c817d1413b13d146de
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rules:
- ""
resources:
- namespaces
- pods
verbs:
- get
- list
Expand Down
8 changes: 8 additions & 0 deletions internal/controller/securesign/actions/ensure_tuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ func (i tufAction) CopyStatus(ctx context.Context, object *rhtasv1.Tuf, instance
})
case instance.Status.TufStatus.URL != object.Status.URL:
instance.Status.TufStatus.URL = object.Status.URL
case meta.IsStatusConditionTrue(instance.Status.Conditions, TufCondition) && meta.IsStatusConditionPresentAndEqual(object.Status.Conditions, tufConstants.TrustRootSynced, v1.ConditionFalse):
synchronized := meta.FindStatusCondition(object.Status.Conditions, tufConstants.TrustRootSynced)
meta.SetStatusCondition(&instance.Status.Conditions, v1.Condition{
Type: TufCondition,
Status: v1.ConditionFalse,
Reason: synchronized.Reason,
Message: synchronized.Message,
})
default:
return i.Continue()
}
Expand Down
43 changes: 31 additions & 12 deletions internal/controller/tuf/actions/fips_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package actions
import (
"context"
"fmt"
"maps"
"slices"

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

func tufCryptoMaterial(ctx context.Context, i *rhtasv1.Tuf, c client.Client) ([]fipsAction.CryptoRef, error) {
var refs []fipsAction.CryptoRef

specHasRef := make(map[string]bool)
for _, key := range trustroot.ActiveKeys(i) {
secretRef := trustroot.Binding(i, key).SecretRef
if secretRef == nil {
continue
asTrustRootBindings := func(bindings []rhtasv1.TrustRootBindingWithOIDC) []rhtasv1.TrustRootBinding {
b := make([]rhtasv1.TrustRootBinding, len(bindings))
for i, binding := range bindings {
b[i] = binding.TrustRootBinding
}
specHasRef[key.String()] = true
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, secretRef,
fmt.Sprintf("spec.%s[0].secretRef", key), fipsutil.ValidateCryptoMaterialPEM, &refs); err != nil {
return nil, err
return b
}

components := map[string][]rhtasv1.TrustRootBinding{
"ctlog": i.Spec.Ctlog,
"fulcio": asTrustRootBindings(i.Spec.Fulcio),
"rekor": i.Spec.Rekor,
"tsa": i.Spec.Tsa,
}
for component, array := range components {
for _, key := range array {

if key.SecretRef == nil {
continue
}
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, key.SecretRef,
fmt.Sprintf("spec.%s[0].secretRef", component), fipsutil.ValidateCryptoMaterialPEM, &refs); err != nil {
return nil, err
}
}
}

for _, ks := range i.Status.Keys {
if ks.SecretRef == nil || specHasRef[ks.Name] {
if ks.SecretRef == nil {
continue
}
if slices.ContainsFunc(slices.Concat(slices.Collect(maps.Values(components))...), func(key rhtasv1.TrustRootBinding) bool {
return key.SecretRef != nil && key.SecretRef.Name == ks.SecretRef.Name
}) {
continue
}
if err := fipsAction.AppendSecretRef(ctx, c, i.Namespace, ks.SecretRef,
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/tuf/actions/migration_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/securesign/operator/internal/constants"
"github.com/securesign/operator/internal/controller/traits"
tufConstants "github.com/securesign/operator/internal/controller/tuf/constants"
"github.com/securesign/operator/internal/controller/tuf/trustroot"
"github.com/securesign/operator/internal/controller/tuf/utils"
"github.com/securesign/operator/internal/labels"
"github.com/securesign/operator/internal/state"
Expand Down Expand Up @@ -133,7 +134,7 @@ func (i migrationJobAction) ensureMigrationJob(ctx context.Context, labels map[s
),
)
if err != nil {
if errors.Is(err, utils.ErrorResolveServiceUrl) {
if errors.Is(err, trustroot.ErrorResolveServiceUrl) {
return i.Error(ctx, err, instance,
metav1.Condition{
Type: constants.ReadyCondition,
Expand Down
4 changes: 4 additions & 0 deletions internal/controller/tuf/actions/migration_job_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package actions

import (
_ "embed"
"testing"
"time"

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

//go:embed testdata/public_key.pem
var testPEM string

func setupMigrateAction() migrationJobAction {
scheme := runtime.NewScheme()
utilruntime.Must(corev1.AddToScheme(scheme))
Expand Down
Loading
Loading