Skip to content

Commit

Permalink
Merge pull request openshift#25 from alexander-demichev/command
Browse files Browse the repository at this point in the history
✨ Add command field to container spec
  • Loading branch information
k8s-ci-robot committed Feb 11, 2022
2 parents 2f79f1c + cc57dfe commit e07b1fe
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ type ContainerSpec struct {
// Compute resources required by this container.
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// Command allows override container's entrypoint array.
Command []string `json:"command,omitempty"`
}

// ImageMeta allows to customize the image used.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,12 @@ spec:
of the container arg `--sync-period` if both are defined.
The same holds for `ManagerSpec.FeatureGates` and `--feature-gates`.
type: object
command:
description: Command allows override container's entrypoint
array.
items:
type: string
type: array
env:
description: List of environment variables to set in the
container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,12 @@ spec:
of the container arg `--sync-period` if both are defined.
The same holds for `ManagerSpec.FeatureGates` and `--feature-gates`.
type: object
command:
description: Command allows override container's entrypoint
array.
items:
type: string
type: array
env:
description: List of environment variables to set in the
container.
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/operator.cluster.x-k8s.io_coreproviders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,12 @@ spec:
of the container arg `--sync-period` if both are defined.
The same holds for `ManagerSpec.FeatureGates` and `--feature-gates`.
type: object
command:
description: Command allows override container's entrypoint
array.
items:
type: string
type: array
env:
description: List of environment variables to set in the
container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,12 @@ spec:
of the container arg `--sync-period` if both are defined.
The same holds for `ManagerSpec.FeatureGates` and `--feature-gates`.
type: object
command:
description: Command allows override container's entrypoint
array.
items:
type: string
type: array
env:
description: List of environment variables to set in the
container.
Expand Down
3 changes: 3 additions & 0 deletions controllers/component_customizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ func customizeContainer(cSpec operatorv1.ContainerSpec, d *appsv1.Deployment) {
if cSpec.Image != nil && cSpec.Image.Name != nil && cSpec.Image.Repository != nil {
c.Image = imageMetaToURL(cSpec.Image)
}
if cSpec.Command != nil {
c.Command = cSpec.Command
}
}
d.Spec.Template.Spec.Containers[j] = c
}
Expand Down
5 changes: 5 additions & 0 deletions controllers/component_customizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func TestCustomizeDeployment(t *testing.T) {
Resources: &corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: memTestQuantity},
},
Command: []string{"/expected"},
},
},
},
Expand Down Expand Up @@ -370,6 +371,7 @@ func TestCustomizeDeployment(t *testing.T) {
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: memTestQuantity},
},
Command: []string{"/expected"},
},
},
},
Expand Down Expand Up @@ -403,6 +405,9 @@ func TestCustomizeDeployment(t *testing.T) {
if !reflect.DeepEqual(inputDS.Template.Spec.Containers[0].Resources, expectedDS.Template.Spec.Containers[0].Resources) {
return expectedDS, false
}
if !reflect.DeepEqual(inputDS.Template.Spec.Containers[0].Command, expectedDS.Template.Spec.Containers[0].Command) {
return expectedDS, false
}
return expectedDS, true
},
},
Expand Down

0 comments on commit e07b1fe

Please sign in to comment.