diff --git a/Dockerfile b/Dockerfile index 2fcca76acb..df369c497b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,6 @@ RUN apt-get update \ && apt-get install -y openssl curl tini \ && rm -rf /var/lib/apt/lists/* COPY hack/gencerts.sh /usr/bin/ - +ENV HTTP2_DISABLE=true COPY entrypoint.sh /usr/bin/ ENTRYPOINT ["/usr/bin/entrypoint.sh"] diff --git a/manifest/crds/sparkoperator.k8s.io_scheduledsparkapplications.yaml b/manifest/crds/sparkoperator.k8s.io_scheduledsparkapplications.yaml index 315f4c9e98..2f6ded6225 100644 --- a/manifest/crds/sparkoperator.k8s.io_scheduledsparkapplications.yaml +++ b/manifest/crds/sparkoperator.k8s.io_scheduledsparkapplications.yaml @@ -796,6 +796,7 @@ spec: type: string required: - containerPort + - protocol type: object type: array x-kubernetes-list-map-keys: @@ -1439,6 +1440,7 @@ spec: type: string required: - containerPort + - protocol type: object type: array x-kubernetes-list-map-keys: @@ -2380,6 +2382,7 @@ spec: type: string required: - containerPort + - protocol type: object type: array x-kubernetes-list-map-keys: @@ -2919,6 +2922,7 @@ spec: type: string required: - containerPort + - protocol type: object type: array x-kubernetes-list-map-keys: diff --git a/pkg/webhook/patch.go b/pkg/webhook/patch.go index fb3eb9b650..0c4b045605 100644 --- a/pkg/webhook/patch.go +++ b/pkg/webhook/patch.go @@ -713,42 +713,28 @@ func addCustomResources(pod *corev1.Pod, app *v1beta2.SparkApplication) []patchO resource = app.Spec.Executor.CustomResources } - var coreContainerRequests corev1.ResourceList - var coreContainerLimits corev1.ResourceList - i := 0 // Find the driver or executor container in the pod. for ; i < len(pod.Spec.Containers); i++ { if pod.Spec.Containers[i].Name == config.SparkDriverContainerName || pod.Spec.Containers[i].Name == config.SparkExecutorContainerName { - coreContainerRequests = pod.Spec.Containers[i].Resources.Requests - coreContainerLimits = pod.Spec.Containers[i].Resources.Requests break } } requestsPath := fmt.Sprintf("/spec/containers/%d/resources/requests", i) limitsPath := fmt.Sprintf("/spec/containers/%d/resources/limits", i) - for k, v := range coreContainerRequests { - if resource.Requests == nil { - resource.Requests = make(corev1.ResourceList) - } - resource.Requests[k] = v - } - for k, v := range coreContainerLimits { - if resource.Limits == nil { - resource.Limits = make(corev1.ResourceList) - } - resource.Limits[k] = v - - } - + encoder := strings.NewReplacer("~", "~0", "/", "~1") if len(resource.Requests) != 0 { - ops = append(ops, patchOperation{Op: "add", Path: requestsPath, Value: resource.Requests}) + for k, v := range resource.Requests { + ops = append(ops, patchOperation{Op: "add", Path: fmt.Sprintf("%s/%s", requestsPath, encoder.Replace(string(k))), Value: v}) + } } if len(resource.Limits) != 0 { - ops = append(ops, patchOperation{Op: "add", Path: limitsPath, Value: resource.Limits}) + for k, v := range resource.Limits { + ops = append(ops, patchOperation{Op: "add", Path: fmt.Sprintf("%s/%s", limitsPath, encoder.Replace(string(k))), Value: v}) + } } return ops