|
| 1 | +/* |
| 2 | +Copyright 2024 Keylime Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha1 |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 24 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 25 | + |
| 26 | +// ImageInfo defines global information for initial image in initial deployment task |
| 27 | +type ImageInfo struct { |
| 28 | + // ImageRepositoryPath is a string to specify where to download images |
| 29 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image Repository Path" |
| 30 | + ImageRepositoryPath string `json:"imageRepositoryPath,omitempty"` |
| 31 | + // ImageTag is a string to specify which image tag to download |
| 32 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image Tag" |
| 33 | + ImageTag string `json:"imageTag,omitempty"` |
| 34 | +} |
| 35 | + |
| 36 | +// InitGlobal defines global information for initial deployment task |
| 37 | +type InitGlobal struct { |
| 38 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Init Image" |
| 39 | + InitialImage ImageInfo `json:"imageInfo,omitempty"` |
| 40 | +} |
| 41 | + |
| 42 | +// NodeInfo defines global information for nodes to be deployed |
| 43 | +type NodeInfo struct { |
| 44 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Tenant Image Information" |
| 45 | + TenantImageInfo ImageInfo `json:"tenantImageInfo,omitempty"` |
| 46 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Registrar Image Information" |
| 47 | + RegistrarImageInfo ImageInfo `json:"registrarImageInfo,omitempty"` |
| 48 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Verifier Image Information" |
| 49 | + VerifierImageInfo ImageInfo `json:"verifierImageInfo,omitempty"` |
| 50 | +} |
| 51 | + |
| 52 | +// DeploymentSpec defines the desired state of Deployment |
| 53 | +type DeploymentSpec struct { |
| 54 | + // Enabled is a boolean that allows to specify if controller based deployment |
| 55 | + // is enabled |
| 56 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled" |
| 57 | + Enabled bool `json:"enabled,omitempty"` |
| 58 | + // InitGlobal is a struct to define all information for the initial deployment |
| 59 | + // is enabled |
| 60 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Init Global" |
| 61 | + InitGlobal InitGlobal `json:"initGlobal,omitempty"` |
| 62 | + // NodeInfo is a struct to define all information for nodes deployed: |
| 63 | + // - tenant |
| 64 | + // - registrar |
| 65 | + // - verifier |
| 66 | + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Init Global" |
| 67 | + NodeInfo NodeInfo `json:"nodeInfo,omitempty"` |
| 68 | +} |
| 69 | + |
| 70 | +// DeploymentStatus defines the observed state of Deployment |
| 71 | +type DeploymentStatus struct { |
| 72 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 73 | + // Important: Run "make" to regenerate code after modifying this file |
| 74 | +} |
| 75 | + |
| 76 | +//+kubebuilder:object:root=true |
| 77 | +//+kubebuilder:subresource:status |
| 78 | + |
| 79 | +// Deployment is the Schema for the deployments API |
| 80 | +type Deployment struct { |
| 81 | + metav1.TypeMeta `json:",inline"` |
| 82 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 83 | + |
| 84 | + Spec DeploymentSpec `json:"spec,omitempty"` |
| 85 | + Status DeploymentStatus `json:"status,omitempty"` |
| 86 | +} |
| 87 | + |
| 88 | +//+kubebuilder:object:root=true |
| 89 | + |
| 90 | +// DeploymentList contains a list of Deployment |
| 91 | +type DeploymentList struct { |
| 92 | + metav1.TypeMeta `json:",inline"` |
| 93 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 94 | + Items []Deployment `json:"items"` |
| 95 | +} |
| 96 | + |
| 97 | +func init() { |
| 98 | + SchemeBuilder.Register(&Deployment{}, &DeploymentList{}) |
| 99 | +} |
0 commit comments