IBM Cloud Pak foundational services webhook
The ibm-common-service-webhook
operator is used to inject certain runtime requirements into a pod when the pod is created.
Overview
The ibm-common-service-webhook
operator inserts the single-request-reopen
requirement into the dnsConfig
specification of the pods for solving a known DNS issue in OpenShift. For more information about the
DNS issue, see DNS intermittent delays of 5s .
template:
spec:
dnsConfig:
options:
- name: single-request-reopen
Installation
The IBM Cloud Pak foundational services
operator installs the ibm-common-service-webhook
operator.
By default, the following PodPreset is deployed:
apiVersion: operator.ibm.com/v1alpha1
kind: PodPreset
metadata:
name: ibm-common-service-webhook
namespace: ibm-common-services
spec: {}
The webhook inserts all the pods in the ibm-common-service
namespace.
Configuration (Optional)
If you want to set a label selector to the webhook or add other functions to the default PodPreset
, you can complete these steps to configure the ibm-common-service-webhook
operator.
-
Set a label selector in the
PodPreset
.
Following is an example of aPodPreset
that injects to pods with the labelapp: nginx
in thenginx-namespace
.apiVersion: operator.ibm.com/v1alpha1 kind: PodPreset metadata: name: nginx-patch namespce: nginx-namespace spec: selector: matchLabels: app: nginx
-
Complete Kubernetes
PodPreset
configurations.
In the following manifest, thePodPreset
has aDB_PORT
environment variable and acache-volume
volume mount, which is mounted under/cache
. Theselector
specifies that thePodPreset
must apply to any pod that has the labelrole: frontend
.
Then, pods that are in the database
namespace and have a label role: frontend
apply the env
, volumeMounts
, and volumes
fields to their containers.
apiVersion: operator.ibm.com/v1alpha1
kind: PodPreset
metadata:
name: allow-database
namespace: database
spec:
selector:
matchLabels:
role: frontend
env:
- name: DB_PORT
value: "6379"
volumeMounts:
- mountPath: /cache
name: cache-volume
volumes:
- name: cache-volume
emptyDir: {}