Skip to content

opensearch: operator-issued certificates expire after a year and are never reissued #4211

Description

Describe the bug

Certificates the opensearch operator issues itself last one year and are never reissued, so a release that stays on the operator issuer stops serving a valid certificate a year after it first converged, with nothing on the objects to say so.

At the pinned v2.8.0, pkg/tls/pki.go:152 gives every leaf NotAfter: time.Now().AddDate(1, 0, 0) while the CA at pki.go:62 gets ten years. All three generate paths in pkg/reconcilers/tls.go create a Secret only when reading it failed, that is only when it does not exist: handleHttp at 490 to 492, handleTransportGenerateGlobal at 272 to 274, and handleTransportGeneratePerNode at 329 to 331. None of them looks at the expiry of what is already there.

The one certificate the operator does renew by age is the admin certificate: shouldCreateAdminCert builds tls.NewCertValidater(data, tls.WithExpiryThreshold(5*24*time.Hour)) and branches on IsExpiringSoon() (tls.go:191 and :196).

So a year in, the HTTP listener on 9200 presents an expired certificate, securityadmin stops authenticating against it, and transport mTLS between nodes is on the same clock and cannot be turned off. No event is recorded and no condition changes.

Environment

  • Cozystack main, opensearch-k8s-operator pinned at v2.8.0
  • Any OpenSearch release whose certificates come from the operator

To Reproduce

The failure needs a release older than a year, which no test environment here has reached, so this is read from the source rather than reproduced on a cluster. The shape is visible without waiting: the generate paths above are guarded on the Secret's absence alone.

Expected behaviour

Either the operator reissues a leaf before it expires, the way it already does for the admin certificate, or the leaves are issued with a lifetime that matches the CA.

Actual behaviour

The leaf is minted once and kept until something deletes the Secret.

Additional context

Found while reviewing #2682. That branch narrows the blast radius rather than causing it: for externally published releases it moves the HTTP and Dashboards certificates to a per-release cert-manager CA with a lifetime aligned to that CA, so what is left on the operator path afterwards is the cluster-internal releases and transport mTLS everywhere.

Workaround until it is fixed upstream: delete the certificate Secret and let the operator mint a new one, which also rolls the pods that mount it.

Checklist

  • I have checked the documentation
  • I have searched for similar issues
  • I have included all required information
  • I have provided clear steps to reproduce
  • I have included relevant logs

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug
    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)
    on Sep 10, 2026
  2. added
    upstream-issueRequires resolving an issue in an upstream project
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete
    and removed
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)kind/bugCategorizes issue or PR as related to a bugpriority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to completetriage/acceptedIndicates an issue is ready to be actively worked onupstream-issueRequires resolving an issue in an upstream project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions