strangelove-ventures / cosmos-operator

Cosmos Operator is a kubernetes operator for managing cosmos nodes
Apache License 2.0
77 stars 18 forks source link

scheduled upgrades #373

Closed agouin closed 10 months ago

agouin commented 11 months ago

Schedule upgrades to automatically re-create pods with the relevant image version at the upgrade heights.

E.g. for noble, this allows a node to sync from genesis to chain tip through all of the versions:

spec:
  chain:
    versions:
    - height: 1
      image: ghcr.io/strangelove-ventures/heighliner/noble:v1.0.0
    - height: 119000      
      image: ghcr.io/strangelove-ventures/heighliner/noble:v2.0.0
    - height: 1296000
      image: ghcr.io/strangelove-ventures/heighliner/noble:v3.0.0
    - height: 2672000
      image: ghcr.io/strangelove-ventures/heighliner/noble:v3.1.0

This also means that the spec can be modified for future upgrades before they occur, and the operator will automatically upgrade them at the upgrade height.

This works for both on-chain upgrade plans and halt-height upgrades. To make the operator set the halt-height in app.toml for an upcoming upgrade, add setHaltHeight: true to the version, e.g.:

spec:
  chain:
    versions:
    - height: 1
      image: ghcr.io/strangelove-ventures/heighliner/noble:v1.0.0
    - height: 119000      
      image: ghcr.io/strangelove-ventures/heighliner/noble:v2.0.0
      setHaltHeight: true

This will cause pods below height=119000 on version 1.0.0 to have halt-height: 119000 configured in app.toml, which will force the instance to panic at the halt height, rather than stay running. This can be used for standard on-chain upgrades too, but is not necessary since the operator will restart the pod once it detects the instance is synced to the upgrade height (either from tendermint RPC or from the periodic database version-check)

Resolves #15