Update component_controller.go
@@ -704,6 +704,12 @@ func (r *ComponentReconcilerTask) GetPodTemplate() (template *coreV1.PodTemplate
Labels: labels,
// The following is for set sidecar resources.
+ Annotations: map[string]string{
+ //"sidecar.istio.io/proxyCPU": "100m",
+ //"sidecar.istio.io/proxyMemory": "50Mi",
+ //"sidecar.istio.io/proxyCPULimit": "100m",
+ //"sidecar.istio.io/proxyMemoryLimit": "50Mi",
+ },
},
Spec: coreV1.PodSpec{
Containers: []coreV1.Container{
@@ -711,8 +717,6 @@ func (r *ComponentReconcilerTask) GetPodTemplate() (template *coreV1.PodTemplate
Name: component.Name,
Image: component.Spec.Image,
Env: []coreV1.EnvVar{},
- Command: component.Spec.Command,
- Args: component.Spec.Args,
Resources: coreV1.ResourceRequirements{
Requests: make(map[coreV1.ResourceName]resource.Quantity),
Limits: make(map[coreV1.ResourceName]resource.Quantity),
@@ -724,6 +728,17 @@ func (r *ComponentReconcilerTask) GetPodTemplate() (template *coreV1.PodTemplate
},
}
+ mainContainer := &template.Spec.Containers[0]
+
+ if component.Spec.Command != "" {
+ if strings.Contains(component.Spec.Command, " ") {
+ mainContainer.Command = []string{"sh"}
+ mainContainer.Args = []string{"-c", component.Spec.Command}
+ } else {
+ mainContainer.Command = []string{component.Spec.Command}
+ }
+ }
+
var pullImageSecrets coreV1.SecretList
if err := r.Client.List(
r.ctx,
@@ -755,8 +770,6 @@ func (r *ComponentReconcilerTask) GetPodTemplate() (template *coreV1.PodTemplate
template.Spec.ServiceAccountName = r.getNameForPermission()
}
- mainContainer := &template.Spec.Containers[0]
-
var ports []coreV1.ContainerPort
for _, p := range component.Spec.Ports {
port := coreV1.ContainerPort{
