diff --git a/api/v1alpha/instance_types.go b/api/v1alpha/instance_types.go index dab90bd6..cb1698b3 100644 --- a/api/v1alpha/instance_types.go +++ b/api/v1alpha/instance_types.go @@ -107,6 +107,26 @@ type SandboxContainer struct { // +kubebuilder:validation:Required Image string `json:"image"` + // Entrypoint array to run in the container image, overriding the image's + // ENTRYPOINT. Each element is a separate token, not a shell command — to run a + // shell command use: ["sh", "-c", "my command"]. + // + // If not provided, the container image's own ENTRYPOINT is used. + // + // +kubebuilder:validation:Optional + Command []string `json:"command,omitempty"` + + // Arguments to the entrypoint, overriding the image's CMD. Combined with + // Command: when Command is also set the resulting invocation is + // append(Command, Args...). When only Args is set it overrides CMD while + // preserving the image's ENTRYPOINT. + // + // If neither Command nor Args is set, the image's own ENTRYPOINT and CMD + // are used unchanged. + // + // +kubebuilder:validation:Optional + Args []string `json:"args,omitempty"` + // List of environment variables to set in the container. // // +kubebuilder:validation:Optional diff --git a/api/v1alpha/zz_generated.deepcopy.go b/api/v1alpha/zz_generated.deepcopy.go index 6bd72a2c..cf6636c8 100644 --- a/api/v1alpha/zz_generated.deepcopy.go +++ b/api/v1alpha/zz_generated.deepcopy.go @@ -651,6 +651,16 @@ func (in *ResourceMetricSource) DeepCopy() *ResourceMetricSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SandboxContainer) DeepCopyInto(out *SandboxContainer) { *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) + } if in.Env != nil { in, out := &in.Env, &out.Env *out = make([]v1.EnvVar, len(*in)) diff --git a/config/base/crd/bases/compute.datumapis.com_instances.yaml b/config/base/crd/bases/compute.datumapis.com_instances.yaml index 8bfdd2ab..c9301561 100644 --- a/config/base/crd/bases/compute.datumapis.com_instances.yaml +++ b/config/base/crd/bases/compute.datumapis.com_instances.yaml @@ -266,6 +266,28 @@ spec: description: A list of containers to run within the sandbox. items: properties: + args: + description: |- + Arguments to the entrypoint, overriding the image's CMD. Combined with + Command: when Command is also set the resulting invocation is + append(Command, Args...). When only Args is set it overrides CMD while + preserving the image's ENTRYPOINT. + + If neither Command nor Args is set, the image's own ENTRYPOINT and CMD + are used unchanged. + items: + type: string + type: array + command: + description: |- + Entrypoint array to run in the container image, overriding the image's + ENTRYPOINT. Each element is a separate token, not a shell command — to run a + shell command use: ["sh", "-c", "my command"]. + + If not provided, the container image's own ENTRYPOINT is used. + items: + type: string + type: array env: description: |- List of environment variables to set in the container. diff --git a/config/base/crd/bases/compute.datumapis.com_workloaddeployments.yaml b/config/base/crd/bases/compute.datumapis.com_workloaddeployments.yaml index 1794e6a1..5e025c5b 100644 --- a/config/base/crd/bases/compute.datumapis.com_workloaddeployments.yaml +++ b/config/base/crd/bases/compute.datumapis.com_workloaddeployments.yaml @@ -367,6 +367,28 @@ spec: sandbox. items: properties: + args: + description: |- + Arguments to the entrypoint, overriding the image's CMD. Combined with + Command: when Command is also set the resulting invocation is + append(Command, Args...). When only Args is set it overrides CMD while + preserving the image's ENTRYPOINT. + + If neither Command nor Args is set, the image's own ENTRYPOINT and CMD + are used unchanged. + items: + type: string + type: array + command: + description: |- + Entrypoint array to run in the container image, overriding the image's + ENTRYPOINT. Each element is a separate token, not a shell command — to run a + shell command use: ["sh", "-c", "my command"]. + + If not provided, the container image's own ENTRYPOINT is used. + items: + type: string + type: array env: description: |- List of environment variables to set in the container. diff --git a/config/base/crd/bases/compute.datumapis.com_workloads.yaml b/config/base/crd/bases/compute.datumapis.com_workloads.yaml index 3efb5bb3..c452910f 100644 --- a/config/base/crd/bases/compute.datumapis.com_workloads.yaml +++ b/config/base/crd/bases/compute.datumapis.com_workloads.yaml @@ -385,6 +385,28 @@ spec: sandbox. items: properties: + args: + description: |- + Arguments to the entrypoint, overriding the image's CMD. Combined with + Command: when Command is also set the resulting invocation is + append(Command, Args...). When only Args is set it overrides CMD while + preserving the image's ENTRYPOINT. + + If neither Command nor Args is set, the image's own ENTRYPOINT and CMD + are used unchanged. + items: + type: string + type: array + command: + description: |- + Entrypoint array to run in the container image, overriding the image's + ENTRYPOINT. Each element is a separate token, not a shell command — to run a + shell command use: ["sh", "-c", "my command"]. + + If not provided, the container image's own ENTRYPOINT is used. + items: + type: string + type: array env: description: |- List of environment variables to set in the container. diff --git a/internal/controller/instance_writeback_test.go b/internal/controller/instance_writeback_test.go index 8ed7f35b..84e16b79 100644 --- a/internal/controller/instance_writeback_test.go +++ b/internal/controller/instance_writeback_test.go @@ -74,7 +74,7 @@ func wbTestCellInstance() *computev1alpha.Instance { }, Spec: computev1alpha.InstanceSpec{ Runtime: computev1alpha.InstanceRuntimeSpec{ - Resources: computev1alpha.InstanceRuntimeResources{InstanceType: "d1-standard-2"}, + Resources: computev1alpha.InstanceRuntimeResources{InstanceType: testInstanceType}, }, }, Status: computev1alpha.InstanceStatus{ @@ -182,7 +182,7 @@ func TestWriteBackToUpstream_UpdatePath_LabelMerge(t *testing.T) { }, Spec: computev1alpha.InstanceSpec{ Runtime: computev1alpha.InstanceRuntimeSpec{ - Resources: computev1alpha.InstanceRuntimeResources{InstanceType: "d1-standard-2"}, + Resources: computev1alpha.InstanceRuntimeResources{InstanceType: testInstanceType}, }, }, } @@ -240,7 +240,7 @@ func TestWriteBackToUpstream_LabelChangeTriggerUpdate(t *testing.T) { }, Spec: computev1alpha.InstanceSpec{ Runtime: computev1alpha.InstanceRuntimeSpec{ - Resources: computev1alpha.InstanceRuntimeResources{InstanceType: "d1-standard-2"}, + Resources: computev1alpha.InstanceRuntimeResources{InstanceType: testInstanceType}, }, }, } @@ -296,7 +296,7 @@ func TestWriteBackToUpstream_EmptyLinkingLabels_NonFatal(t *testing.T) { }, Spec: computev1alpha.InstanceSpec{ Runtime: computev1alpha.InstanceRuntimeSpec{ - Resources: computev1alpha.InstanceRuntimeResources{InstanceType: "d1-standard-2"}, + Resources: computev1alpha.InstanceRuntimeResources{InstanceType: testInstanceType}, }, }, }