-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
695 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright The Ratify Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
unversioned "github.com/deislabs/ratify/api/unversioned" | ||
conversion "k8s.io/apimachinery/pkg/conversion" | ||
) | ||
|
||
//nolint:revive // ignore linter for autogenerated code | ||
func Convert_unversioned_PolicySpec_To_v1alpha1_PolicySpec(in *unversioned.PolicySpec, out *PolicySpec, _ conversion.Scope) error { | ||
out.Parameters = in.Parameters | ||
return nil | ||
} | ||
|
||
//nolint:revive // ignore linter for autogenerated code | ||
func Convert_unversioned_PolicyStatus_To_v1alpha1_PolicyStatus(in *unversioned.PolicyStatus, out *PolicyStatus, _ conversion.Scope) error { | ||
return nil | ||
} | ||
|
||
//nolint:revive // ignore linter for autogenerated code | ||
func Convert_unversioned_Policy_To_v1alpha1_Policy(in *unversioned.Policy, out *Policy, s conversion.Scope) error { | ||
out.ObjectMeta = in.ObjectMeta | ||
out.ObjectMeta.Name = in.Spec.Type | ||
if err := Convert_unversioned_PolicySpec_To_v1alpha1_PolicySpec(&in.Spec, &out.Spec, s); err != nil { | ||
return err | ||
} | ||
return Convert_unversioned_PolicyStatus_To_v1alpha1_PolicyStatus(&in.Status, &out.Status, s) | ||
} | ||
|
||
//nolint:revive // ignore linter for autogenerated code | ||
func Convert_v1alpha1_Policy_To_unversioned_Policy(in *Policy, out *unversioned.Policy, s conversion.Scope) error { | ||
out.ObjectMeta = in.ObjectMeta | ||
out.ObjectMeta.Name = "ratify-policy" | ||
if err := Convert_v1alpha1_PolicySpec_To_unversioned_PolicySpec(&in.Spec, &out.Spec, s); err != nil { | ||
return err | ||
} | ||
out.Spec.Type = in.ObjectMeta.Name | ||
return Convert_v1alpha1_PolicyStatus_To_unversioned_PolicyStatus(&in.Status, &out.Status, s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
Copyright The Ratify Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
runtime "k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// PolicySpec defines the desired state of Policy | ||
type PolicySpec struct { | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// Type of the policy | ||
Type string `json:"type,omitempty"` | ||
|
||
// +kubebuilder:pruning:PreserveUnknownFields | ||
// Parameters for this policy | ||
Parameters runtime.RawExtension `json:"parameters,omitempty"` | ||
} | ||
|
||
// PolicyStatus defines the observed state of Policy | ||
type PolicyStatus struct { | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// Is successful while applying the policy. | ||
IsSuccess bool `json:"issuccess"` | ||
|
||
// Error message if policy is not successfully applied. | ||
// +optional | ||
Error string `json:"error,omitempty"` | ||
// Truncated error message if the message is too long | ||
// +optional | ||
BriefError string `json:"brieferror,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:scope="Cluster" | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:printcolumn:name="IsSuccess",type=boolean,JSONPath=`.status.issuccess` | ||
// +kubebuilder:printcolumn:name="Error",type=string,JSONPath=`.status.brieferror` | ||
// Policy is the Schema for the policies API | ||
type Policy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec PolicySpec `json:"spec,omitempty"` | ||
Status PolicyStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:storageversion | ||
// PolicyList contains a list of Policy | ||
type PolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Policy `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Policy{}, &PolicyList{}) | ||
} |
Oops, something went wrong.