Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

Configuring the Message Service Pod Initializer Webhook for SAP Edge Integration Cell on OpenShift

Updated on

Request a new translation or translation update

A translation for your language preference does not exist. Click below to request a translation for your selected language.

Submit request

Part of: SAP Edge Integration Cell on Red Hat OpenShift

Table of Contents

Overview

This article applies to SAP Edge Integration Cell (EIC) deployments onboarded with the Restricted Access to Kubernetes Cluster option, as described in Setting Up a Restricted-Access OpenShift Cluster for SAP ELM with Service Mesh 3.x. Skip it unless the EIC deployment has both High Availability and Enable Message Service Pod Initializer switched on. The Pod Initializer is optional and not required for High Availability.

With High Availability, the Message Service runs as a StatefulSet with three pods: a primary broker, a backup broker, and a monitoring node. A StatefulSet assigns the same CPU and memory to every pod, although the monitoring node needs much less. The Pod Initializer is a mutating admission webhook that lowers the monitoring pod's resources when the pod is created.

ELM deploys the webhook server. With Restricted Access, an administrator applies its certificate Secret and its cluster-scoped registration from webhook-pod-initializer.yaml. This file is attached to SAP Note 3618713 in resources.zip; the resource bundles downloaded from the ELM UI do not include it. SAP Note 3618713 describes the procedure and is authoritative for the SAP configuration. This article adds the OpenShift steps, verification, and certificate renewal.

Object (default namespace edge-icell-services) Scope Created by
Deployment and Service pod-initializer-webhook Namespace ELM, when the option is switched on
Secret webhook-certs (keys cert.pem, key.pem) Namespace Administrator, from webhook-pod-initializer.yaml
MutatingWebhookConfiguration pod-initializer-webhook-cfg Cluster Administrator, from webhook-pod-initializer.yaml

The procedure was validated with Red Hat OpenShift 4.21, Red Hat OpenShift Service Mesh 3.3, and EIC 8.49.18.

Prerequisites

  • The cluster is set up and registered as described in the restricted-access setup guide.
  • resources.zip from SAP Note 3618713 (requires SAP S-user credentials), extracted to a local directory.
  • The administrator kubeconfig used for the resource bundles. Creating the cluster-scoped registration requires these permissions; the restricted edgelm kubeconfig is not sufficient.
  • oc and openssl. The commands work with OpenSSL and with the LibreSSL openssl.

How the Webhook Behaves

  • Scope: The API server sends the webhook only pods in edge-icell-services that carry the label instance: ssb-solace. The webhook changes only the pod named in the StatefulSet annotation initializer.sap.com/pubsub.podDefinition, which is the monitoring pod ssb-solace-2. The primary and backup brokers keep the StatefulSet's resources.
  • Failure policy: The registration uses failurePolicy: Ignore. If the webhook cannot be reached, the API server creates the pod unchanged. Pod creation is never blocked; the monitoring pod then runs with the same resources as the brokers. Keep Ignore; see Fail-Open Messages for Unchanged Pods.
  • Service mesh and network policy: The webhook pod runs without an Istio sidecar (sidecar.istio.io/inject: "false"), so the namespace's STRICT PeerAuthentication does not affect calls from the API server. The NetworkPolicy deployed with EIC Services allows all ingress in the namespace. If you add your own NetworkPolicies to this namespace, allow the Kubernetes API server to reach the webhook pod on port 8443.

When to Apply

The webhook pod mounts the Secret webhook-certs and does not start until the Secret exists. Until then, the pod stays in ContainerCreating and reports this event:

MountVolume.SetUp failed for volume "webhook-certs" : secret "webhook-certs" not found

Apply the webhook after the resource bundle that creates edge-icell-services succeeds and after the SCC annotations and mesh labels are applied, then continue the deployment in ELM. The webhook pod starts automatically once the Secret exists. If the Solace pods were created before the webhook was running, recreate the monitoring pod as described in Troubleshooting.

The Secret and the registration are not part of the ELM resource bundles. After each EIC upgrade, run the verification commands.

Custom Namespaces and Multiple EIC Instances

webhook-pod-initializer.yaml and the commands in this article use the default EIC Services namespace edge-icell-services. If the EIC Services namespace has a different name, for example with multiple EIC instances, apply a separate webhook for each EIC instance that uses the Pod Initializer:

  • Namespace: The file sets the namespace in the Secret, in the registration's clientConfig.service.namespace and namespaceSelector, and in the certificate names. Replace every occurrence.
  • Registration name: The registration pod-initializer-webhook-cfg is cluster-scoped. Give each instance's registration its own name. If you apply the file for a second instance without renaming it, it replaces the first instance's registration. Because of failurePolicy: Ignore, the first instance's monitoring pod then keeps full resources, without an error, the next time it is created.

Use a separate directory for each instance. Before step 1 of Create the Certificates and Apply the Webhook, set the instance's EIC Services namespace and create a copy of SAP's file for it:

# EIC Services namespace of this EIC instance
NS=eic-services-b

sed -e "s|edge-icell-services|${NS}|g" \
    -e "s|pod-initializer-webhook-cfg|pod-initializer-webhook-cfg-${NS}|" \
    <path-to-sap-note-resources>/webhook-pod-initializer.yaml > webhook-pod-initializer-${NS}.yaml

Then follow the procedure with these changes:

  • After step 2, set the certificate names to the instance's namespace:

    sed "s|edge-icell-services|${NS}|g" server-cert.conf > server-cert.conf.new && mv server-cert.conf.new server-cert.conf
    
  • In step 4, use webhook-pod-initializer-${NS}.yaml as the input file instead of SAP's file.

  • In the other commands of this article, replace edge-icell-services with the instance's namespace and pod-initializer-webhook-cfg with pod-initializer-webhook-cfg-${NS}.

Create the Certificates and Apply the Webhook

Run these commands in a new, empty directory outside the bundle directories, with the administrator kubeconfig used for the resource bundles.

The comments in webhook-pod-initializer.yaml create the CA with a validity of 180 days and the server certificate with 360 days. The API server trusts the server certificate only while the CA is valid, so that combination expires after 180 days. Use a CA validity at least as long as the server certificate's. The values below use 730 and 365 days; adjust them to your certificate policy.

  1. Create the CA:

    openssl genrsa -out ca.key 2048
    openssl req -new -x509 -days 730 -key ca.key -out ca.crt -subj "/CN=pod-initializer-webhook-ca"
    
  2. Create the server certificate request configuration. The names must match the webhook Service:

    cat > server-cert.conf <<'EOF'
    [req]
    distinguished_name = req_distinguished_name
    req_extensions = v3_req
    prompt = no
    
    [req_distinguished_name]
    CN = pod-initializer-webhook.edge-icell-services.svc
    
    [v3_req]
    keyUsage = keyEncipherment, dataEncipherment
    extendedKeyUsage = serverAuth
    subjectAltName = @alt_names
    
    [alt_names]
    DNS.1 = pod-initializer-webhook
    DNS.2 = pod-initializer-webhook.edge-icell-services
    DNS.3 = pod-initializer-webhook.edge-icell-services.svc
    EOF
    
  3. Create the server key and certificate, signed by the CA:

    openssl genrsa -out server.key 2048
    openssl req -new -key server.key -out cert.csr -config server-cert.conf
    openssl x509 -req -in cert.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
     -out server-cert.crt -days 365 -extensions v3_req -extfile server-cert.conf
    chmod 600 ca.key server.key
    
  4. Insert the encoded values into a copy of SAP's file and apply it. Replace <path-to-sap-note-resources> with the directory where you extracted resources.zip:

    ENCODED_CA=$(base64 < ca.crt | tr -d '\n')
    ENCODED_CERT=$(base64 < server-cert.crt | tr -d '\n')
    ENCODED_KEY=$(base64 < server.key | tr -d '\n')
    sed -e "s|\${ENCODED_CA}|${ENCODED_CA}|" \
       -e "s|\${ENCODED_CERT}|${ENCODED_CERT}|" \
       -e "s|\${ENCODED_KEY}|${ENCODED_KEY}|" \
       <path-to-sap-note-resources>/webhook-pod-initializer.yaml > webhook-pod-initializer-filled.yaml
    chmod 600 webhook-pod-initializer-filled.yaml
    
    # Expected output: OK: no placeholders left
    grep '\${ENCODED' webhook-pod-initializer-filled.yaml || echo "OK: no placeholders left"
    
    oc apply -f webhook-pod-initializer-filled.yaml
    oc rollout status deployment/pod-initializer-webhook -n edge-icell-services
    

The filled file and server.key contain the webhook's private key. Store ca.key and server-cert.conf securely for renewal, and delete the other generated files once the webhook is verified.

Verify the Webhook

# Registration and failure policy (expected: Ignore)
oc get mutatingwebhookconfiguration pod-initializer-webhook-cfg \
  -o jsonpath='{.webhooks[0].name}{"  failurePolicy="}{.webhooks[0].failurePolicy}{"\n"}'

# Webhook pod (expected: 1/1 Running)
oc get pods -n edge-icell-services -l app=pod-initializer-webhook

# Target pod and the resources SAP defines for it
oc get statefulset ssb-solace -n edge-icell-services \
  -o jsonpath='{.spec.template.metadata.annotations.initializer\.sap\.com/pubsub\.podDefinition}{"\n"}'

# Actual requests of the broker pods
oc get pods -n edge-icell-services -l app=solace,instance=ssb-solace \
  -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[?(@.name=="solace")].resources.requests}{"\n"}{end}'

The pod named in the annotation shows the reduced requests, and the other broker pods show the StatefulSet's values. Example output for EIC 8.49.18:

ssb-solace-0    {"cpu":"1","ephemeral-storage":"500Mi","memory":"3650722201600m"}
ssb-solace-1    {"cpu":"1","ephemeral-storage":"500Mi","memory":"3650722201600m"}
ssb-solace-2    {"cpu":"500m","ephemeral-storage":"500Mi","memory":"2Gi"}

Check the certificate expiry dates and plan renewal before the earlier date:

# CA trusted by the API server
oc get mutatingwebhookconfiguration pod-initializer-webhook-cfg \
  -o jsonpath='{.webhooks[0].clientConfig.caBundle}' | base64 -d | openssl x509 -noout -subject -enddate

# Server certificate presented by the webhook
oc get secret webhook-certs -n edge-icell-services \
  -o jsonpath='{.data.cert\.pem}' | base64 -d | openssl x509 -noout -subject -enddate

Renew the Certificates

The webhook reads its certificate only at startup; it keeps presenting the old certificate after the Secret changes. To renew:

  1. Repeat steps 1 to 4 of Create the Certificates and Apply the Webhook. To keep the existing CA, skip step 1 and reuse ca.crt and ca.key.
  2. Restart the webhook so that it loads the new certificate:

    oc rollout restart deployment/pod-initializer-webhook -n edge-icell-services
    oc rollout status deployment/pod-initializer-webhook -n edge-icell-services
    

The rolling restart starts the new webhook pod before it stops the old one. If you replaced the CA, Solace pods created between the apply and the end of the restart are created unchanged.

Fail-Open Messages for Unchanged Pods

For pods it does not change, such as the primary and backup brokers and the Solace metrics pod, the webhook currently returns a response that sets patchType without a patch. The API server treats this response as a failed webhook call (webhook returned response.patchType but not response.patch). Because of failurePolicy: Ignore, it then admits the pod unchanged, which is the intended result. This also applies to later updates of these pods, such as label changes during broker failover. As a result:

  • The API server metrics apiserver_admission_webhook_fail_open_count and apiserver_admission_webhook_request_total with code="503" increase for pod-initializer-webhook.sap.com during normal operation, and the API server logs Failed calling webhook, failing open pod-initializer-webhook.sap.com. These messages are expected. Do not use them to alert on this webhook; use the verification commands instead.
  • Keep failurePolicy: Ignore. With Fail, the API server would reject the primary and backup broker pods.

Troubleshooting

Symptom Cause Action
pod-initializer-webhook pod stays in ContainerCreating with secret "webhook-certs" not found The Secret has not been applied Apply the webhook; the pod starts automatically
The monitoring pod has the same requests as the brokers The webhook could not be reached when the pod was created: the webhook pod was not running, the certificate expired, or the server certificate does not match the caBundle Correct the cause using the verification commands, then recreate the monitoring pod (below)
The expiry date in the Secret is new, but the problem persists The webhook still presents the certificate it loaded at startup Restart the webhook as in Renew the Certificates

The webhook changes the monitoring pod only when the pod is created. To apply the reduced resources to a running monitoring pod, delete it; the StatefulSet recreates it:

oc delete pod ssb-solace-2 -n edge-icell-services

Until the new pod is running, the HA group has no monitoring node. Do not delete it while a broker pod is restarting.

Remove the Webhook

If you switch the Pod Initializer off later, delete the objects you applied:

oc delete mutatingwebhookconfiguration pod-initializer-webhook-cfg
oc delete secret webhook-certs -n edge-icell-services

This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Red Hat LinkedIn YouTube Facebook X, formerly Twitter

Quick Links

Help

Site Info

Related Sites

© 2026 Red Hat