Supergraph podTemplate

Customize the pod templates for your Supergraphs


The .spec.podTemplate section of your Supergraph resource allows you to customize the underlying Pods and containers.

Properties

routerContainer

Override values in the main router container. This replicates the Kubernetes Container specification but doesn't allow setting name, image, command, args, or workingDir.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalEnv:
5        - name: APOLLO_ROUTER_LOG
6          value: debug
7      additionalVolumeMounts:
8        - name: config-vol
9          mountPath: /etc/config

additionalEnv

List of additional environment variables to set in the router container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalEnv:
5        - name: APOLLO_ROUTER_LOG
6          value: debug

additionalEnvFrom

List of additional sources to populate environment variables in the router container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalEnvFrom:
5        - configMapRef:
6            name: router-env-config

additionalVolumes

List of additional volumes that can be mounted by containers belonging to the pod. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    additionalVolumes:
4      - name: config-vol
5        configMap:
6          name: my-config
7    routerContainer:
8      additionalVolumeMounts:
9        - name: config-vol
10          mountPath: /etc/config

imagePullPolicy

Image pull policy. One of Always, Never, IfNotPresent.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      imagePullPolicy: Always

lifecycle

Actions that the management system should take in response to container lifecycle events. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      lifecycle:
5        preStop:
6          exec:
7            command: ["/bin/sh", "-c", "sleep 10"]

livenessProbe

Periodic probe of container liveness. Container will be restarted if the probe fails. Overrides the default liveness probe. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      livenessProbe:
5        httpGet:
6          path: /health?live
7          port: 8088
8        initialDelaySeconds: 10
9        periodSeconds: 5

additionalPorts

List of additional ports to expose from the router container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalPorts:
5        - containerPort: 9090
6          name: metrics
7          protocol: TCP

readinessProbe

Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Overrides the default readiness probe. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      readinessProbe:
5        httpGet:
6          path: /health?ready
7          port: 8088
8        initialDelaySeconds: 5
9        periodSeconds: 10

additionalResizePolicies

Resources resize policy for the container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalResizePolicies:
5        - resourceName: cpu
6          restartPolicy: NotRequired

resources

Compute resources required by the router container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      resources:
5        requests:
6          cpu: 100m
7          memory: 128Mi
8        limits:
9          cpu: 500m
10          memory: 512Mi

securityContext

Security options the router container should be run with.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      securityContext:
5        runAsNonRoot: true
6        readOnlyRootFilesystem: true

startupProbe

Startup probe indicates that the Pod has successfully initialized. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      startupProbe:
5        httpGet:
6          path: /health?live
7          port: 8088
8        failureThreshold: 30
9        periodSeconds: 10

stdin

Whether this container should allocate a buffer for stdin in the container runtime.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      stdin: true

stdinOnce

Whether the container runtime should close the stdin channel after it has been opened by a single attach.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      stdinOnce: true

terminationMessagePath

Path to the file containing the container’s termination message.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      terminationMessagePath: /dev/termination-log

terminationMessagePolicy

Indicate how the termination message should be populated. File will use the contents of terminationMessagePath.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      terminationMessagePolicy: File

tty

Whether this container should allocate a TTY for itself. Requires stdin to be true.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      tty: true
5      stdin: true

additionalVolumeDevices

List of block devices to be used by the container.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalVolumeDevices:
5        - name: data
6          devicePath: /dev/xvda

additionalVolumeMounts

Pod volumes to mount into the router container's filesystem.

YAML
1spec:
2  podTemplate:
3    routerContainer:
4      additionalVolumeMounts:
5        - name: config-vol
6          mountPath: /etc/config

additionalContainers

Runs additional containers alongside the main router container. This replicates the Deployment specification for containers.

YAML
1spec:
2  podTemplate:
3    additionalContainers:
4      - name: my-container
5        image: my-image:latest

additionalInitContainers

Runs additional init containers. This replicates the Deployment specification for containers.

YAML
1spec:
2  podTemplate:
3    additionalInitContainers:
4      - name: my-container
5        image: my-image:latest

affinity

The pod’s scheduling constraints. This replicates the Deployment specification for affinity.

YAML
1spec:
2  podTemplate:
3    affinity:
4      requiredDuringSchedulingIgnoredDuringExecution:
5        nodeSelectorTerms:
6        - matchExpressions:
7          - key: topology.kubernetes.io/zone
8            operator: In
9            values:
10            - us-east-1a
11            - us-east-1b

annotations

Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    annotations:
4      sidecar.istio.io/inject: "false"

image

Custom Apollo Router image. Please note that you cannot use image and routerVersion at the same time.

YAML
1spec:
2  podTemplate:
3    image: my-image:latest

labels

Map of string keys and values that can be used to organize and categorize (scope and select) objects. For more information, see the Kubernetes documentation.

YAML
1spec:
2  podTemplate:
3    labels:
4      app: my-app
5      tier: backend

podSecurityContext

Holds pod-level security attributes and common container settings.

YAML
1spec:
2  podTemplate:
3    podSecurityContext:
4      runAsUser: 1000
5      fsGroup: 2000

priorityClassName

Indicates the pod’s priority.

YAML
1spec:
2  podTemplate:
3    priorityClassName: high-priority

routerVersion

Apollo Router version. The Apollo GraphOS Operator will automatically use the default Apollo Router image with that version. Please note that you cannot use image and routerVersion at the same time.

YAML
1spec:
2  podTemplate:
3    routerVersion: 2.4.0

serviceAccountName

The name of the ServiceAccount to use to run this pod.

YAML
1spec:
2  podTemplate:
3    serviceAccountName: my-service-account

terminationGracePeriodSeconds

The duration in seconds that Kubernetes waits before forcefully terminating the pod.

YAML
1spec:
2  podTemplate:
3    terminationGracePeriodSeconds: 30

tolerations

The pod’s tolerations.

YAML
1spec:
2  podTemplate:
3    tolerations:
4      - key: dedicated
5        operator: Equal
6        value: gpu
7        effect: NoSchedule

topologySpreadConstraints

Describes how a group of pods ought to spread across topology domains.

YAML
1spec:
2  podTemplate:
3    topologySpreadConstraints:
4      - maxSkew: 1
5        topologyKey: topology.kubernetes.io/zone
6        whenUnsatisfiable: ScheduleAnyway
7        labelSelector:
8          matchLabels:
9            app: my-app
Feedback

Edit on GitHub

Ask Community