working with images

This commit is contained in:
2025-04-03 23:46:25 +03:00
parent f464e8966d
commit b021c161ca
7 changed files with 184 additions and 15 deletions

View File

@@ -23,11 +23,23 @@ import (
// 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.
type InitScript struct {
Image string `json:"image"`
Command []string `json:"command"`
Args []string `json:"args"`
}
// ImageSpec defines the desired state of Image
type ImageSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Location string `json:"location"`
Name string `json:"name"`
Location string `json:"location"`
WorkingDir string `json:"working_dir"`
Command []string `json:"command,omitempty"`
Ports []Port `json:"ports"`
Args []string `json:"args,omitempty"`
InitScript *InitScript `json:"init_script,omitempty"`
}
// +kubebuilder:object:root=true

View File

@@ -59,7 +59,7 @@ func (in *Image) DeepCopyInto(out *Image) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image.
@@ -115,6 +115,26 @@ func (in *ImageList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageSpec) DeepCopyInto(out *ImageSpec) {
*out = *in
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]Port, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.InitScript != nil {
in, out := &in.InitScript, &out.InitScript
*out = new(InitScript)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageSpec.
@@ -127,6 +147,31 @@ func (in *ImageSpec) DeepCopy() *ImageSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InitScript) DeepCopyInto(out *InitScript) {
*out = *in
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitScript.
func (in *InitScript) DeepCopy() *InitScript {
if in == nil {
return nil
}
out := new(InitScript)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Port) DeepCopyInto(out *Port) {
*out = *in