Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 2b84a6b

Browse files
authored
Using ocm-controller for signature tracking (#97)
* named it back :D * applying latest ocm controller
1 parent 72c49af commit 2b84a6b

File tree

9 files changed

+73
-122
lines changed

9 files changed

+73
-122
lines changed

api/v1alpha1/componentsubscription_types.go

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"time"
1010

11+
"github.com/open-component-model/ocm-controller/api/v1alpha1"
1112
v1 "k8s.io/api/core/v1"
1213
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1314
)
@@ -49,28 +50,7 @@ type ComponentSubscriptionSpec struct {
4950
// Verify specifies a list signatures that must be verified before a ComponentVersion
5051
// is replicated.
5152
// +optional
52-
Verify []Signature `json:"verify,omitempty"`
53-
}
54-
55-
// Signature defines the details of a signature to use for verification.
56-
type Signature struct {
57-
// Name specifies the name of the signature. An OCM component may have multiple
58-
// signatures.
59-
Name string `json:"name"`
60-
61-
// PublicKey provides a reference to a Kubernetes Secret that contains a public key
62-
// which will be used to validate the named signature.
63-
//+optional
64-
PublicKey SecretRef `json:"publicKey,omitempty"`
65-
66-
// PublicKeyBlob defines an inlined public key.
67-
//+optional
68-
PublicKeyBlob []byte `json:"publicKeyBlob,omitempty"`
69-
}
70-
71-
// SecretRef clearly denotes that the requested option is a Secret.
72-
type SecretRef struct {
73-
SecretRef v1.LocalObjectReference `json:"secretRef"`
53+
Verify []v1alpha1.Signature `json:"verify,omitempty"`
7454
}
7555

7656
// OCMRepository specifies access details for an OCI based OCM Repository.
@@ -89,24 +69,24 @@ type ComponentSubscriptionStatus struct {
8969
// LastAttemptedVersion defines the latest version encountered while checking component versions.
9070
// This might be different from last applied version which should be the latest applied/replicated version.
9171
// The difference might be caused because of semver constraint or failures during replication.
92-
//+optional
72+
// +optional
9373
LastAttemptedVersion string `json:"lastAttemptedVersion,omitempty"`
9474

9575
// ObservedGeneration is the last reconciled generation.
9676
// +optional
9777
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
9878

9979
// LastAppliedVersion defines the final version that has been applied to the destination component version.
100-
//+optional
80+
// +optional
10181
LastAppliedVersion string `json:"lastAppliedVersion,omitempty"`
10282

10383
// ReplicatedRepositoryURL defines the final location of the reconciled Component.
104-
//+optional
84+
// +optional
10585
ReplicatedRepositoryURL string `json:"replicatedRepositoryURL,omitempty"`
10686

10787
// Signature defines a set of internal keys that were used to sign the Component once transferred to the Destination.
108-
//+optional
109-
Signature []Signature `json:"signature,omitempty"`
88+
// +optional
89+
Signature []v1alpha1.Signature `json:"signature,omitempty"`
11090

11191
// Digest contains the digest of the subscription's spec.
11292
Digest uint64 `json:"specDigest,omitempty"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 3 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/delivery.ocm.software_componentsubscriptions.yaml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,29 +114,28 @@ spec:
114114
type: string
115115
publicKey:
116116
description: PublicKey provides a reference to a Kubernetes
117-
Secret that contains a public key which will be used to validate
118-
the named signature.
117+
Secret of contain a blob of a public key that which will be
118+
used to validate the named signature.
119119
properties:
120120
secretRef:
121-
description: LocalObjectReference contains enough information
122-
to let you locate the referenced object inside the same
123-
namespace.
121+
description: SecretRef is a reference to a Secret that contains
122+
a public key.
124123
properties:
125124
name:
126125
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
127126
TODO: Add other useful fields. apiVersion, kind, uid?'
128127
type: string
129128
type: object
130129
x-kubernetes-map-type: atomic
131-
required:
132-
- secretRef
130+
value:
131+
description: Value defines a PEM/base64 encoded public key
132+
value.
133+
format: byte
134+
type: string
133135
type: object
134-
publicKeyBlob:
135-
description: PublicKeyBlob defines an inlined public key.
136-
format: byte
137-
type: string
138136
required:
139137
- name
138+
- publicKey
140139
type: object
141140
type: array
142141
required:
@@ -248,29 +247,28 @@ spec:
248247
type: string
249248
publicKey:
250249
description: PublicKey provides a reference to a Kubernetes
251-
Secret that contains a public key which will be used to validate
252-
the named signature.
250+
Secret of contain a blob of a public key that which will be
251+
used to validate the named signature.
253252
properties:
254253
secretRef:
255-
description: LocalObjectReference contains enough information
256-
to let you locate the referenced object inside the same
257-
namespace.
254+
description: SecretRef is a reference to a Secret that contains
255+
a public key.
258256
properties:
259257
name:
260258
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
261259
TODO: Add other useful fields. apiVersion, kind, uid?'
262260
type: string
263261
type: object
264262
x-kubernetes-map-type: atomic
265-
required:
266-
- secretRef
263+
value:
264+
description: Value defines a PEM/base64 encoded public key
265+
value.
266+
format: byte
267+
type: string
267268
type: object
268-
publicKeyBlob:
269-
description: PublicKeyBlob defines an inlined public key.
270-
format: byte
271-
type: string
272269
required:
273270
- name
271+
- publicKey
274272
type: object
275273
type: array
276274
specDigest:

controllers/componentsubscription_controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/fluxcd/pkg/runtime/patch"
1616
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
1717
"github.com/mitchellh/hashstructure/v2"
18+
ocmv1alpha1 "github.com/open-component-model/ocm-controller/api/v1alpha1"
1819
"github.com/open-component-model/ocm-controller/pkg/status"
1920
ocm2 "github.com/open-component-model/ocm/pkg/contexts/ocm"
2021
"github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc"
@@ -318,10 +319,12 @@ func (r *ComponentSubscriptionReconciler) signMpasComponent(
318319
return fmt.Errorf("failed to sign destination component: %w", err)
319320
}
320321

321-
obj.Status.Signature = []v1alpha1.Signature{
322+
obj.Status.Signature = []ocmv1alpha1.Signature{
322323
{
323-
Name: v1alpha1.InternalSignatureName,
324-
PublicKeyBlob: pub,
324+
Name: v1alpha1.InternalSignatureName,
325+
PublicKey: ocmv1alpha1.PublicKey{
326+
Value: pub,
327+
},
325328
},
326329
}
327330

docs/release_notes/v0.12.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Release 0.12.0
2+
3+
- Using ocm-controller for signature tracking (#97)

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/go-logr/logr v1.3.0
3333
github.com/mitchellh/hashstructure/v2 v2.0.2
3434
github.com/open-component-model/ocm v0.4.0
35-
github.com/open-component-model/ocm-controller v0.16.1
35+
github.com/open-component-model/ocm-controller v0.18.0
3636
github.com/stretchr/testify v1.8.4
3737
k8s.io/api v0.28.1
3838
k8s.io/apimachinery v0.28.1
@@ -135,7 +135,7 @@ require (
135135
github.com/ghodss/yaml v1.0.0 // indirect
136136
github.com/go-chi/chi v4.1.2+incompatible // indirect
137137
github.com/go-errors/errors v1.4.2 // indirect
138-
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
138+
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
139139
github.com/go-logr/stdr v1.2.2 // indirect
140140
github.com/go-logr/zapr v1.2.4 // indirect
141141
github.com/go-openapi/analysis v0.21.4 // indirect
@@ -159,7 +159,7 @@ require (
159159
github.com/google/btree v1.1.2 // indirect
160160
github.com/google/certificate-transparency-go v1.1.6 // indirect
161161
github.com/google/gnostic v0.6.9 // indirect
162-
github.com/google/go-cmp v0.5.9 // indirect
162+
github.com/google/go-cmp v0.6.0 // indirect
163163
github.com/google/go-containerregistry v0.16.1 // indirect
164164
github.com/google/go-github/v45 v45.2.0 // indirect
165165
github.com/google/go-github/v50 v50.2.0 // indirect
@@ -212,9 +212,9 @@ require (
212212
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
213213
github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 // indirect
214214
github.com/oklog/ulid v1.3.1 // indirect
215-
github.com/onsi/gomega v1.27.10 // indirect
215+
github.com/onsi/gomega v1.30.0 // indirect
216216
github.com/opencontainers/go-digest v1.0.0 // indirect
217-
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
217+
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
218218
github.com/opentracing/opentracing-go v1.2.0 // indirect
219219
github.com/pborman/uuid v1.2.1 // indirect
220220
github.com/pelletier/go-toml v1.9.5 // indirect
@@ -274,15 +274,15 @@ require (
274274
go.uber.org/zap v1.25.0 // indirect
275275
golang.org/x/crypto v0.15.0 // indirect
276276
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
277-
golang.org/x/mod v0.11.0 // indirect
277+
golang.org/x/mod v0.12.0 // indirect
278278
golang.org/x/net v0.18.0 // indirect
279279
golang.org/x/oauth2 v0.14.0 // indirect
280280
golang.org/x/sync v0.3.0 // indirect
281281
golang.org/x/sys v0.14.0 // indirect
282282
golang.org/x/term v0.14.0 // indirect
283283
golang.org/x/text v0.14.0 // indirect
284284
golang.org/x/time v0.3.0 // indirect
285-
golang.org/x/tools v0.9.3 // indirect
285+
golang.org/x/tools v0.12.0 // indirect
286286
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
287287
google.golang.org/api v0.138.0 // indirect
288288
google.golang.org/appengine v1.6.7 // indirect
@@ -307,5 +307,5 @@ require (
307307
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
308308
sigs.k8s.io/release-utils v0.7.4 // indirect
309309
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
310-
sigs.k8s.io/yaml v1.3.0 // indirect
310+
sigs.k8s.io/yaml v1.4.0 // indirect
311311
)

0 commit comments

Comments
 (0)