Skip to content

pgo is not compatible with k8s v1.25 #3365

@youvegotmoxie

Description

@youvegotmoxie

Overview

After upgrading to Kubernetes v1.25.0 the pgo pod is crashing because the CronJob batch/v1beta1 API is no longer served.
The code for the operator needs to be updated to (also) look for the batch/v1 apiVersion which has been GA since k8s v1.21

$ k get pod -n postgres-operator
NAME                           READY   STATUS             RESTARTS      AGE
pgo-6d89f7c7cb-4dhkf           0/1     CrashLoopBackOff   7 (68s ago)   12m
pgo-upgrade-6f956b867c-4tzts   1/1     Running            0             12m

I am using the latest version of the postgres-operator Helm chart from here

Environment

Please provide the following details:

  • Platform: Kubernetes
  • Platform Version: v1.25.0

Steps to Reproduce

  1. Install the latest version of the PGO
  2. Upgrade Kubernetes to v1.25.0
  3. Observe that the pgo pod is now crash looping

EXPECTED

  1. To not crash after the k8s upgrade

ACTUAL

  1. pgo pod goes into CrashLoopBackoff due to the beta CronJob API not being served

Logs

time="2022-08-29T15:33:28Z" level=error msg="if kind is a CRD, it should be installed before calling Start" error="no matches for kind \"CronJob\" in version \"batch/v1beta1\"" file="sigs.k8s.io/controller-runtime@v0.8.3/pkg/log/deleg.go:144" func="log.(*DelegatingLogger).Error" kind=CronJob.batch version=5.1.3-0
panic: no matches for kind "CronJob" in version "batch/v1beta1"

goroutine 1 [running]:
main.assertNoError(...)
        github.com/crunchydata/postgres-operator/cmd/postgres-operator/main.go:40
main.main()
        github.com/crunchydata/postgres-operator/cmd/postgres-operator/main.go:100 +0x550

Furthermore, while CronJobs are required for backups, they aren't critical for managing the lifecycle of the database cluster from what I can tell. It may be better to emit a warning and skip trying to reconcile the CronJob(s) objects instead of crashing the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions