github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/types/api/v1/image_types.go (about) 1 // Copyright © 2021 Alibaba Group Holding Ltd. 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 package v1 16 17 import ( 18 "github.com/opencontainers/go-digest" 19 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 ) 21 22 // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! 23 // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. 24 25 type Layer struct { 26 ID digest.Digest `json:"id,omitempty"` // shaxxx:d6a6c9bfd4ad2901695be1dceca62e1c35a8482982ad6be172fe6958bc4f79d7 27 Type string `json:"type,omitempty"` 28 Value string `json:"value,omitempty"` 29 } 30 31 // ImageSpec defines the desired state of Image 32 type ImageSpec struct { 33 // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster 34 // Important: Run "make" to regenerate code after modifying this file 35 36 // Foo is an example field of Image. Edit Image_types.go to remove/update 37 ID string `json:"id,omitempty"` 38 Layers []Layer `json:"layers,omitempty"` 39 SealerVersion string `json:"sealer_version,omitempty"` 40 Platform Platform `json:"platform"` 41 ImageConfig ImageConfig `json:"image_config"` 42 } 43 44 // ImageStatus defines the observed state of Image 45 type ImageStatus struct { 46 // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster 47 // Important: Run "make" to regenerate code after modifying this file 48 } 49 50 // +kubebuilder:object:root=true 51 // +kubebuilder:subresource:status 52 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 53 54 // Image is the Schema for the images API 55 type Image struct { 56 metav1.TypeMeta `json:",inline" yaml:",inline"` 57 metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` 58 59 Spec ImageSpec `json:"spec,omitempty" yaml:"spec,omitempty"` 60 Status ImageStatus `json:"status,omitempty" yaml:"status,omitempty"` 61 } 62 63 // +kubebuilder:object:root=true 64 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 65 66 // ImageList contains a list of Image 67 type ImageList struct { 68 metav1.TypeMeta `json:",inline"` 69 metav1.ListMeta `json:"metadata,omitempty"` 70 Items []Image `json:"items,omitempty"` 71 } 72 73 type ImageConfig struct { 74 // define this image is application image or normal image. 75 ImageType string `json:"image_type,omitempty"` 76 Cmd ImageCmd `json:"cmd,omitempty"` 77 Args ImageArg `json:"args,omitempty"` 78 Labels map[string]string `json:"labels,omitempty"` 79 } 80 81 type ImageCmd struct { 82 //cmd list of base image 83 Parent []string `json:"parent,omitempty"` 84 //cmd list of current image 85 Current []string `json:"current,omitempty"` 86 } 87 88 type ImageArg struct { 89 //arg set of base image 90 Parent map[string]string `json:"parent,omitempty"` 91 //arg set of current image 92 Current map[string]string `json:"current,omitempty"` 93 } 94 95 type Platform struct { 96 Architecture string `json:"architecture,omitempty"` 97 OS string `json:"os,omitempty"` 98 // OSVersion is an optional field specifying the operating system version. 99 OSVersion string `json:"os_version,omitempty"` 100 // Variant is an optional field specifying a variant of the CPU, for 101 // example `v7` to specify ARMv7 when architecture is `arm`. 102 Variant string `json:"variant,omitempty"` 103 } 104 105 func init() { 106 SchemeBuilder.Register(&Image{}, &ImageList{}) 107 }