Documentation ¶
Overview ¶
Package fork implements a pattern for forking sub-processes as new Pods.
This can be used when some code that's part of the operator (usually an entire controller) needs to run under a different Pod context (e.g. different service account, volume mounts, etc.). The forked Pod runs the same container image as the parent Pod, so the code versions should stay synchronized as long as immutable image tags are used. This avoids the operational and maintenance burden of creating and publishing separate binaries and container images for each sub-process.
The forked Pod is given an additional environment variable telling it which forked code path it should run instead of the normal code path. The main() function should be written to take this into account by calling fork.Path() to determine which fork it should follow, if any.
The parent Pod must also give some environment variables to the operator's Container to let this package find the Pod in which it's currently running:
env: - name: PS_OPERATOR_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: PS_OPERATOR_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace
The parent Pod uses its own Pod spec as a basis to build the child Pod spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPodSpec ¶
NewPodSpec returns the specification for a child Pod to be forked off from the Pod in which you're currently running.
Types ¶
This section is empty.