|
| 1 | +/* |
| 2 | +
|
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +you may not use this file except in compliance with the License. |
| 5 | +You may obtain a copy of the License at |
| 6 | +
|
| 7 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +
|
| 9 | +Unless required by applicable law or agreed to in writing, software |
| 10 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +See the License for the specific language governing permissions and |
| 13 | +limitations under the License. |
| 14 | +*/ |
| 15 | + |
| 16 | +package v1beta1 |
| 17 | + |
| 18 | +import ( |
| 19 | + status "github.com/open-policy-agent/gatekeeper/v3/apis/status/v1beta1" |
| 20 | + "github.com/open-policy-agent/gatekeeper/v3/pkg/mutation/match" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 25 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 26 | + |
| 27 | +// ExpansionTemplateSpec defines the desired state of ExpansionTemplate. |
| 28 | +type ExpansionTemplateSpec struct { |
| 29 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 30 | + // Important: Run "make" to regenerate code after modifying this file |
| 31 | + |
| 32 | + // ApplyTo lists the specific groups, versions and kinds of generator resources |
| 33 | + // which will be expanded. |
| 34 | + ApplyTo []match.ApplyTo `json:"applyTo,omitempty"` |
| 35 | + |
| 36 | + // TemplateSource specifies the source field on the generator resource to |
| 37 | + // use as the base for expanded resource. For Pod-creating generators, this |
| 38 | + // is usually spec.template |
| 39 | + TemplateSource string `json:"templateSource,omitempty"` |
| 40 | + |
| 41 | + // GeneratedGVK specifies the GVK of the resources which the generator |
| 42 | + // resource creates. |
| 43 | + GeneratedGVK GeneratedGVK `json:"generatedGVK,omitempty"` |
| 44 | + |
| 45 | + // EnforcementAction specifies the enforcement action to be used for resources |
| 46 | + // matching the ExpansionTemplate. Specifying an empty value will use the |
| 47 | + // enforcement action specified by the Constraint in violation. |
| 48 | + EnforcementAction string `json:"enforcementAction,omitempty"` |
| 49 | +} |
| 50 | + |
| 51 | +type GeneratedGVK struct { |
| 52 | + Group string `json:"group,omitempty"` |
| 53 | + Version string `json:"version,omitempty"` |
| 54 | + Kind string `json:"kind,omitempty"` |
| 55 | +} |
| 56 | + |
| 57 | +// +kubebuilder:object:root=true |
| 58 | +// +kubebuilder:resource:path="expansiontemplate" |
| 59 | +// +kubebuilder:resource:scope="Cluster" |
| 60 | +// +kubebuilder:subresource:status |
| 61 | + |
| 62 | +// ExpansionTemplate is the Schema for the ExpansionTemplate API. |
| 63 | +type ExpansionTemplate struct { |
| 64 | + metav1.TypeMeta `json:",inline"` |
| 65 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 66 | + |
| 67 | + Spec ExpansionTemplateSpec `json:"spec,omitempty"` |
| 68 | + Status ExpansionTemplateStatus `json:"status,omitempty"` |
| 69 | +} |
| 70 | + |
| 71 | +// ExpansionTemplateStatus defines the observed state of ExpansionTemplate. |
| 72 | +type ExpansionTemplateStatus struct { |
| 73 | + ByPod []status.ExpansionTemplatePodStatusStatus `json:"byPod,omitempty"` |
| 74 | +} |
| 75 | + |
| 76 | +// +kubebuilder:object:root=true |
| 77 | + |
| 78 | +// ExpansionTemplateList contains a list of ExpansionTemplate. |
| 79 | +type ExpansionTemplateList struct { |
| 80 | + metav1.TypeMeta `json:",inline"` |
| 81 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 82 | + Items []ExpansionTemplate `json:"items"` |
| 83 | +} |
| 84 | + |
| 85 | +func init() { |
| 86 | + SchemeBuilder.Register(&ExpansionTemplate{}, &ExpansionTemplateList{}) |
| 87 | +} |
0 commit comments