Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update CRD and related code to enable type field #1779

Merged
merged 7 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions api/unversioned/keymanagementprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type KeyManagementProviderSpec struct {
// Name of the key management provider
Type string `json:"type,omitempty"`

// Refresh interval for fetching the certificate/key files from the provider. Only for providers that are refreshable. The value is in the format of "1h30m" where "h" means hour and "m" means minute. Valid time units are units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
// +kubebuilder:default=""
RefreshInterval string `json:"refreshInterval,omitempty"`

// Parameters of the key management provider
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}
Expand Down
4 changes: 4 additions & 0 deletions api/unversioned/namespacedkeymanagementprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ type NamespacedKeyManagementProviderSpec struct {
// Name of the key management provider
Type string `json:"type,omitempty"`

// Refresh interval for fetching the certificate/key files from the provider. Only for providers that are refreshable. The value is in the format of "1h30m" where "h" means hour and "m" means minute. Valid time units are units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
// +kubebuilder:default=""
RefreshInterval string `json:"refreshInterval,omitempty"`

// +kubebuilder:pruning:PreserveUnknownFields
// Parameters of the key management provider
Parameters runtime.RawExtension `json:"parameters,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions api/unversioned/namespacedverifier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type NamespacedVerifierSpec struct {
// Name of the verifier
Name string `json:"name"`

// # Optional. Type of the verifier
junczhu marked this conversation as resolved.
Show resolved Hide resolved
Type string `json:"type,omitempty"`

// Version of the verifier plugin. Optional
Version string `json:"version,omitempty"`

Expand Down
3 changes: 3 additions & 0 deletions api/unversioned/verifier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type VerifierSpec struct {
// Name of the verifier
Name string `json:"name,omitempty"`

// # Optional. Type of the verifier
Type string `json:"type,omitempty"`

// Version of the verifier plugin. Optional
Version string `json:"version,omitempty"`

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions api/v1beta1/namespacedverifier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ type NamespacedVerifierSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
junczhu marked this conversation as resolved.
Show resolved Hide resolved
// Important: Run "make" to regenerate code after modifying this file

// TODO: update all docs spec to use type and add deprecation warning in spec to name field
// Name of the verifier
Name string `json:"name"`

// # Optional. Type of the verifier
junczhu marked this conversation as resolved.
Show resolved Hide resolved
Type string `json:"type,omitempty"`

// Version of the verifier plugin. Optional
Version string `json:"version,omitempty"`

Expand All @@ -49,6 +53,14 @@ type NamespacedVerifierSpec struct {
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}

// GetType returns verifier spec type and is backward compatible with the old name field
func (spec *NamespacedVerifierSpec) GetType() string {
junczhu marked this conversation as resolved.
Show resolved Hide resolved
if spec.Type == "" {
return spec.Name
}
return spec.Type
}

// NamespacedVerifierStatus defines the observed state of NamespacedVerifier
type NamespacedVerifierStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand Down
12 changes: 12 additions & 0 deletions api/v1beta1/verifier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ import (
type VerifierSpec struct {
// Important: Run "make install-crds" to regenerate code after modifying this file

// TODO: update all docs spec to use type and add deprecation warning in spec to name field
// Name of the verifier
Name string `json:"name"`

// # Optional. Type of the verifier
Type string `json:"type,omitempty"`

// Version of the verifier plugin. Optional
Version string `json:"version,omitempty"`

Expand All @@ -45,6 +49,14 @@ type VerifierSpec struct {
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}

// GetType returns verifier spec type and is backward compatible with the old name field
func (spec *VerifierSpec) GetType() string {
if spec.Type == "" {
return spec.Name
}
return spec.Type
}

// VerifierStatus defines the observed state of Verifier
type VerifierStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ spec:
description: The type of artifact this verifier handles
type: string
name:
description: Name of the verifier
description: |-
TODO: update all docs spec to use type and add deprecation warning in spec to name field
Name of the verifier
type: string
parameters:
description: Parameters for this verifier
Expand All @@ -72,6 +74,9 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type:
description: '# Optional. Type of the verifier'
junczhu marked this conversation as resolved.
Show resolved Hide resolved
type: string
version:
description: Version of the verifier plugin. Optional
type: string
Expand Down
7 changes: 6 additions & 1 deletion config/crd/bases/config.ratify.deislabs.io_verifiers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ spec:
description: The type of artifact this verifier handles
type: string
name:
description: Name of the verifier
description: |-
TODO: update all docs spec to use type and add deprecation warning in spec to name field
junczhu marked this conversation as resolved.
Show resolved Hide resolved
Name of the verifier
type: string
parameters:
description: Parameters for this verifier
Expand All @@ -131,6 +133,9 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type:
description: '# Optional. Type of the verifier'
type: string
version:
description: Version of the verifier plugin. Optional
type: string
Expand Down
Loading
Loading