Skip to content

Health Check (Liveness and Readiness probe for Operator) #1234

@luszczynski

Description

@luszczynski

What did you do?

I've created a new ansible operator using:

operator-sdk new gogs-operator --api-version=org.example.gogs/v1alpha1 --kind=Gogs --type=ansible --generate-playbook

What did you expect to see?

I expect to see a deployment object using liveness and readiness probe to check the health of my operator.

The file is gogs-operator/deploy/operator.yaml

apiVersion: apps/v1 kind: Deployment metadata: name: gogs-operator spec: replicas: 1 selector: matchLabels: name: gogs-operator template: metadata: labels: name: gogs-operator spec: serviceAccountName: gogs-operator containers: - name: ansible command: - /usr/local/bin/ao-logs - /tmp/ansible-operator/runner - stdout # Replace this with the built image name image: "{{ REPLACE_IMAGE }}" imagePullPolicy: "{{ pull_policy|default('Always') }}" volumeMounts: - mountPath: /tmp/ansible-operator/runner name: runner readOnly: true - name: operator # Replace this with the built image name image: "{{ REPLACE_IMAGE }}" imagePullPolicy: "{{ pull_policy|default('Always') }}" volumeMounts: - mountPath: /tmp/ansible-operator/runner name: runner env: - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: OPERATOR_NAME value: "gogs-operator" volumes: - name: runner emptyDir: {}

What did you see instead? Under which circumstances?

A deployment without liveness and readiness probe.

Environment

  • operator-sdk version:

operator-sdk version v0.6.0

  • Kubernetes version information:

oc v3.11.88
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

  • Kubernetes cluster kind:

Additional context

Additionally, operator-sdk should:

  1. Create liveness and readiness in the Deployment object
  2. Expose a rest endpoint to be checked by Openshift/Kubernetes

Do these requirements above make sense?

Metadata

Metadata

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.language/goIssue is related to a Go operator projectlanguage/helmIssue is related to a Helm operator projectlifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions