Floodgate: A channel provider for the System Upgrade Controller

Floodgate: A channel provider for the System Upgrade Controller is a Commodore component for Managing {{ cookiecutter.name }}. # SUC channel provider

Floodgate: A channel provider for the System Upgrade Controller controls System Upgrade Controller channels. It does so by providing an HTTP endpoint with the following matching rules: /window/{day:[0-6]}/{hour:2[0-3]|[01][0-9]}

Where day is the day of week and hour the hour of the day. It will:

  • return the update tag of the previous week, if the current local time is prior to day and hour

  • return the update tag of this week, if the current local time is after day and hour

It assumes that:

  • the image for this day is already built. So don’t define a window when the image hasn’t been built yet.

  • the day and hour are in its own timezone

For example, if you build the SUC update image on Monday at 18:00 and have a floodgate instance running with the default configuration, so it assumes the image will be built Mondays.

It’s Monday 17:30 and you execute curl localhost:8080/window/1/17 it will correctly return this week’s image. But if the image will be built at 18:00 the SUC jobs will get stuck with `ImagePullError`s.

Getting started

  • go run main.go

  • Define a SUC plan pointing to the floodgate instance in the channel field:

    apiVersion: upgrade.cattle.io/v1
    kind: Plan
    
    metadata:
      name: k3os-latest
      namespace: k3os-system
    
    spec:
      channel: http://localhost:8080/window/2/22
  • SUC will now trigger the plans on Tuesday after 22:00

Configuration

EnVar

Description

FG_IMAGE_DAY

Defines on what day the image is built. It will then calculate the tag accordingly in the form of date "+%Y%m%d". Defaults to 1(Monday).