Skip to content

Commit 448f33e

Browse files
committed
rename remote policy struct name
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
1 parent e644681 commit 448f33e

12 files changed

+84
-84
lines changed

config/300-clusterimagepolicy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ spec:
9999
type: object
100100
properties:
101101
sha256sum:
102-
description: Sha256sum defines the shasum of the policy hosted in the url.
102+
description: Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
103103
type: string
104104
url:
105105
description: URL to the policy data.
@@ -317,7 +317,7 @@ spec:
317317
type: object
318318
properties:
319319
sha256sum:
320-
description: Sha256sum defines the shasum of the policy hosted in the url.
320+
description: Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
321321
type: string
322322
url:
323323
description: URL to the policy data.
@@ -388,7 +388,7 @@ spec:
388388
type: object
389389
properties:
390390
sha256sum:
391-
description: Sha256sum defines the shasum of the policy hosted in the url.
391+
description: Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
392392
type: string
393393
url:
394394
description: URL to the policy data.
@@ -606,7 +606,7 @@ spec:
606606
type: object
607607
properties:
608608
sha256sum:
609-
description: Sha256sum defines the shasum of the policy hosted in the url.
609+
description: Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
610610
type: string
611611
url:
612612
description: URL to the policy data.

docs/api-types/index-v1alpha1.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
* [MatchResource](#matchresource)
2828
* [Policy](#policy)
2929
* [RFC3161Timestamp](#rfc3161timestamp)
30+
* [RemotePolicy](#remotepolicy)
3031
* [Source](#source)
3132
* [StaticRef](#staticref)
3233
* [TLog](#tlog)
33-
* [URL](#url)
3434

3535
## CertificateAuthority
3636

@@ -283,7 +283,7 @@ Policy specifies a policy to use for Attestation or the CIP validation (iff at l
283283
| ----- | ----------- | ------ | -------- |
284284
| type | Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :) | string | true |
285285
| data | Data contains the policy definition. | string | false |
286-
| remote | Remote defines the url to a policy. | [URL](#url) | false |
286+
| remote | Remote defines the url to a policy. | [RemotePolicy](#remotepolicy) | false |
287287
| configMapRef | ConfigMapRef defines the reference to a configMap with the policy definition. | [ConfigMapReference](#configmapreference) | false |
288288
| fetchConfigFile | FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md | bool | false |
289289
| includeSpec | IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy. | bool | false |
@@ -302,6 +302,17 @@ RFC3161Timestamp specifies the URL to a RFC3161 time-stamping server that holds
302302

303303
[Back to TOC](#table-of-contents)
304304

305+
## RemotePolicy
306+
307+
RemotePolicy defines all the properties to fetch a remote policy
308+
309+
| Field | Description | Scheme | Required |
310+
| ----- | ----------- | ------ | -------- |
311+
| url | URL to the policy data. | apis.URL | false |
312+
| sha256sum | Sha256sum defines the exact sha256sum computed out of the 'body' of the http response. | string | false |
313+
314+
[Back to TOC](#table-of-contents)
315+
305316
## Source
306317

307318
Source specifies the location of the signature
@@ -333,14 +344,3 @@ TLog specifies the URL to a transparency log that holds the signature and public
333344
| trustRootRef | Use the Public Key from the referred TrustRoot.TLog | string | false |
334345

335346
[Back to TOC](#table-of-contents)
336-
337-
## URL
338-
339-
URL defines all the propierties to fetch a remote policy
340-
341-
| Field | Description | Scheme | Required |
342-
| ----- | ----------- | ------ | -------- |
343-
| url | URL to the policy data. | apis.URL | false |
344-
| sha256sum | Sha256sum defines the shasum of the policy hosted in the url. | string | false |
345-
346-
[Back to TOC](#table-of-contents)

docs/api-types/index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
* [MatchResource](#matchresource)
1919
* [Policy](#policy)
2020
* [RFC3161Timestamp](#rfc3161timestamp)
21+
* [RemotePolicy](#remotepolicy)
2122
* [Source](#source)
2223
* [StaticRef](#staticref)
2324
* [TLog](#tlog)
24-
* [URL](#url)
2525

2626
## Attestation
2727

@@ -168,7 +168,7 @@ Policy specifies a policy to use for Attestation or the CIP validation (iff at l
168168
| ----- | ----------- | ------ | -------- |
169169
| type | Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :) | string | true |
170170
| data | Data contains the policy definition. | string | false |
171-
| remote | Remote defines the url to a policy. | [URL](#url) | false |
171+
| remote | Remote defines the url to a policy. | [RemotePolicy](#remotepolicy) | false |
172172
| configMapRef | ConfigMapRef defines the reference to a configMap with the policy definition. | [ConfigMapReference](#configmapreference) | false |
173173
| fetchConfigFile | FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md | bool | false |
174174
| includeSpec | IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy. | bool | false |
@@ -187,6 +187,17 @@ RFC3161Timestamp specifies the URL to a RFC3161 time-stamping server that holds
187187

188188
[Back to TOC](#table-of-contents)
189189

190+
## RemotePolicy
191+
192+
RemotePolicy defines all the properties to fetch a remote policy
193+
194+
| Field | Description | Scheme | Required |
195+
| ----- | ----------- | ------ | -------- |
196+
| url | URL to the policy data. | apis.URL | false |
197+
| sha256sum | Sha256sum defines the exact sha256sum computed out of the 'body' of the http response. | string | false |
198+
199+
[Back to TOC](#table-of-contents)
200+
190201
## Source
191202

192203
Source specifies the location of the signature
@@ -218,14 +229,3 @@ TLog specifies the URL to a transparency log that holds the signature and public
218229
| trustRootRef | Use the Public Key from the referred TrustRoot.TLog | string | false |
219230

220231
[Back to TOC](#table-of-contents)
221-
222-
## URL
223-
224-
URL defines all the propierties to fetch a remote policy
225-
226-
| Field | Description | Scheme | Required |
227-
| ----- | ----------- | ------ | -------- |
228-
| url | URL to the policy data. | apis.URL | false |
229-
| sha256sum | Sha256sum defines the shasum of the policy hosted in the url. | string | false |
230-
231-
[Back to TOC](#table-of-contents)

pkg/apis/policy/v1alpha1/clusterimagepolicy_conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (p *Policy) ConvertTo(ctx context.Context, sink *v1beta1.Policy) {
144144
sink.Type = p.Type
145145
sink.Data = p.Data
146146
if p.Remote != nil {
147-
sink.Remote = &v1beta1.URL{
147+
sink.Remote = &v1beta1.RemotePolicy{
148148
URL: p.Remote.URL,
149149
Sha256sum: p.Remote.Sha256sum,
150150
}
@@ -174,7 +174,7 @@ func (p *Policy) ConvertFrom(ctx context.Context, source *v1beta1.Policy) {
174174
p.Type = source.Type
175175
p.Data = source.Data
176176
if source.Remote != nil {
177-
p.Remote = &URL{
177+
p.Remote = &RemotePolicy{
178178
URL: source.Remote.URL,
179179
Sha256sum: source.Remote.Sha256sum,
180180
}

pkg/apis/policy/v1alpha1/clusterimagepolicy_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ type MatchResource struct {
214214
ResourceSelector *metav1.LabelSelector `json:"selector,omitempty"`
215215
}
216216

217-
// URL defines all the propierties to fetch a remote policy
218-
type URL struct {
217+
// RemotePolicy defines all the properties to fetch a remote policy
218+
type RemotePolicy struct {
219219
// URL to the policy data.
220220
URL apis.URL `json:"url,omitempty"`
221-
// Sha256sum defines the shasum of the policy hosted in the url.
221+
// Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
222222
Sha256sum string `json:"sha256sum,omitempty"`
223223
}
224224

@@ -234,7 +234,7 @@ type Policy struct {
234234
Data string `json:"data,omitempty"`
235235
// Remote defines the url to a policy.
236236
// +optional
237-
Remote *URL `json:"remote,omitempty"`
237+
Remote *RemotePolicy `json:"remote,omitempty"`
238238
// ConfigMapRef defines the reference to a configMap with the policy definition.
239239
// +optional
240240
ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"`

pkg/apis/policy/v1alpha1/clusterimagepolicy_validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (cmr *ConfigMapReference) Validate(ctx context.Context) *apis.FieldError {
261261
return errs
262262
}
263263

264-
func (r *URL) Validate(ctx context.Context) *apis.FieldError {
264+
func (r *RemotePolicy) Validate(ctx context.Context) *apis.FieldError {
265265
var errs *apis.FieldError
266266
urlObj := r.URL
267267
u, err := url.Parse(urlObj.String())

pkg/apis/policy/v1alpha1/clusterimagepolicy_validation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ func TestAttestationsValidation(t *testing.T) {
10341034
Name: "cmname",
10351035
Key: "keyname",
10361036
},
1037-
Remote: &URL{
1037+
Remote: &RemotePolicy{
10381038
URL: *apis.HTTPS("example.com"),
10391039
Sha256sum: "123123123",
10401040
},
@@ -1046,7 +1046,7 @@ func TestAttestationsValidation(t *testing.T) {
10461046
attestation: Attestation{Name: "second", PredicateType: "custom",
10471047
Policy: &Policy{
10481048
Type: "cue",
1049-
Remote: &URL{
1049+
Remote: &RemotePolicy{
10501050
URL: *apis.HTTPS("example.com"),
10511051
Sha256sum: "123123123",
10521052
},
@@ -1057,7 +1057,7 @@ func TestAttestationsValidation(t *testing.T) {
10571057
attestation: Attestation{Name: "second", PredicateType: "custom",
10581058
Policy: &Policy{
10591059
Type: "cue",
1060-
Remote: &URL{
1060+
Remote: &RemotePolicy{
10611061
URL: *apis.HTTP("example.com"),
10621062
Sha256sum: "123123123",
10631063
},

pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go

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

pkg/apis/policy/v1beta1/clusterimagepolicy_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ type Attestation struct {
204204
Policy *Policy `json:"policy,omitempty"`
205205
}
206206

207-
// URL defines all the propierties to fetch a remote policy
208-
type URL struct {
207+
// RemotePolicy defines all the properties to fetch a remote policy
208+
type RemotePolicy struct {
209209
// URL to the policy data.
210210
URL apis.URL `json:"url,omitempty"`
211-
// Sha256sum defines the shasum of the policy hosted in the url.
211+
// Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.
212212
Sha256sum string `json:"sha256sum,omitempty"`
213213
}
214214

@@ -224,7 +224,7 @@ type Policy struct {
224224
Data string `json:"data,omitempty"`
225225
// Remote defines the url to a policy.
226226
// +optional
227-
Remote *URL `json:"remote,omitempty"`
227+
Remote *RemotePolicy `json:"remote,omitempty"`
228228
// ConfigMapRef defines the reference to a configMap with the policy definition.
229229
// +optional
230230
ConfigMapRef *ConfigMapReference `json:"configMapRef,omitempty"`

pkg/apis/policy/v1beta1/clusterimagepolicy_validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (cmr *ConfigMapReference) Validate(ctx context.Context) *apis.FieldError {
262262
return errs
263263
}
264264

265-
func (r *URL) Validate(ctx context.Context) *apis.FieldError {
265+
func (r *RemotePolicy) Validate(ctx context.Context) *apis.FieldError {
266266
var errs *apis.FieldError
267267
urlObj := r.URL
268268
u, err := url.Parse(urlObj.String())

0 commit comments

Comments
 (0)