CHANGELOG.md

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

<!-- Add your changelog entry to the relevant subsection -->

<!-- ### Added | Changed | Deprecated | Removed | Fixed | Security -->

<!--------------------- Don't add new entries after this line --------------------->

## [0.6.0] - 2026-03-06

This release revamps the runner pod manifest configuration. The migration steps depend on the value you are currently passing:

* If you are currently passing a map or a callback to `:runner_pod_tpl`, you can simply rename the option to `:manifest` and it should maintain the current behaviour.

* If you are using `%FLAMEK8sBackend.RunnerPodTemplate{}` with `:env` and/or `:resources` fields, you need to convert it into a manifest map.

  ```elixir
  manifest = %{
    "spec" => %{
      "containers" => [
        %{
          "env" => [
            %{"name" => "FOO", "value" => "bar"}
          ],
          "resources" => %{
            "requests" => %{"memory" => "256Mi", "cpu" => "100m"},
            "limits" => %{"memory" => "256Mi", "cpu" => "400m"}
          }
        }
      ]
    }
  }

  {FLAME.Pool,
    name: MyApp.SamplePool,
    backend: {FLAMEK8sBackend, manifest: manifest}}
  ```

  Note that, by default, using `%FLAMEK8sBackend.RunnerPodTemplate{}` implied that envs and resources were copied from the parent pod. If you want to maintain that behaviour, you can use a manifest function, as fallows:

  ```elixir
    manifest_fun = fn parent_pod_manifest, app_container ->
      %{
        "spec" => %{
          "containers" => [
            %{
              # Copy env vars and resources from the parent container definition.
              # For fields that you don't want to copy, you can specify the desired
              # values here.
              "env" => app_container["env"] || [],
              "envFrom" => app_container["envFrom"] || [],
              "resources" => app_container["resources"] || %{}
            }
          ]
        }
      }
    end

  {FLAME.Pool,
    name: MyApp.SamplePool,
    backend: {FLAMEK8sBackend, manifest: manifest_fun}}
  ```

### Added

* Added `:manifest` backend option
* Added `:env` backend option for passing extra runner environment variables as a key-value map

### Changed

* If a container image is specified in the runner manifest, it is no longer overridden by the parent image

### Removed

* Removed `:runner_pod_tpl` option in favour of the the new `:manifest` option
* Removed the `%FLAMEK8sBackend.RunnerPodTemplate{}` struct

## [0.5.7] - 2024-12-05

### Fixed

- Allow callers to set omit_owner_reference option [#59](https://github.com/mruoss/flame_k8s_backend/pull/59)

## [0.5.6] - 2024-10-09

### Fixed

- Set `RELEASE_COOKIE` instead of `RELEASE_SECRET`

## [0.5.5] - 2024-10-08

### Fixed

- Set `RELEASE_COOKIE`, `RELEASE_DISTRIBUTION` and `RELEASE_NODE` on runner pod if not set [#50](https://github.com/mruoss/flame_k8s_backend/issues/50), [#53](https://github.com/mruoss/flame_k8s_backend/pull/53)

## [0.5.4] - 2024-09-11

### Changed

- Upgrade to FLAME 0.5.0

## [0.5.3] - 2024-08-30

### Changed

- Reverted change in `0.5.2`. Users should parse the YAML if they want to.

## [0.5.2] - 2024-08-29

### Added

- `FLAMEK8sBackend.RunnerPodTemplate`: Allow BYO pod template to be a binary.

## [0.5.1] - 2024-08-28

### Changed

- Upgrade to FLAME 0.4.0

## [0.5.0] - 2024-08-27

### Fixed

- `FLAMEK8sBackend.RunnerPodTemplate`: Only set `PHX_SERVER` if it is not passed.
- `FLAMEK8sBackend.RunnerPodTemplate`: Reject `FLAME_PARENT`, not `FLAME_BACKEND` in passed env vars.

### Added

- `FLAMEK8sBackend.RunnerPodTemplate`: Set `.metadata.namespace` and `.metadata.generateName` on runner pod if not set ([#43](https://github.com/mruoss/flame_k8s_backend/pull/43))

### Changed

- `FLAMEK8sBackend.RunnerPodTemplate`: Also copy `env_from` if `add_parent_env` is `true`
- Improve documentation

## [0.4.3] - 2024-08-22

### Fixed

- use `FLAME.Parser.JSON` instead of `Jason`

### Added

- Support for BYO runner pod templates as map.

## [0.4.2] - 2024-07-28

### Fixed

- SSL cert verification workaround for older OTP versions was added again - [#37](https://github.com/mruoss/flame_k8s_backend/issues/37) [#38](https://github.com/mruoss/flame_k8s_backend/pull/38)
- Upgraded FLAME dependency to `0.3.0`

## [0.4.1] - 2024-07-07

### Changed

- Remove `Req` dependency and use `:httpc` instead in order to be safer when run in Livebook. [#35](https://github.com/mruoss/flame_k8s_backend/pull/35)

## [0.4.0] - 2024-06-19

### Changed

- Support for FLAME >= 0.2.0 and livebook integraion (requires livebook >= 0.13.0) - [#32](https://github.com/mruoss/flame_k8s_backend/pull/32)

## [0.3.3] - 2024-04-29

### Changed

- With `mint` 1.6.0 out, we have no need for the temporary workaround for TLS
  verification anymore.

## [0.3.2] - 2024-02-25

### Changed

- Dependency Updates

## [0.3.1] - 2024-01-28

### Changed

- Use `:cacertfile` insead of `:cacerts` in `:transport_options` and let the OTP process the certificate - [#8](https://github.com/mruoss/flame_k8s_backend/pull/8)
- Dependency Updates

## [0.3.0] - 2023-12-19

### Changed

- Remove`:insecure_skip_tls_verify` option and use a custom `match_fun` instead to work around failing hostname verification for IP addresses. - [#5](https://github.com/mruoss/flame_k8s_backend/pull/5)

## [0.2.3] - 2023-12-15

### Added

- `runner_pod_tpl` option for better control over the runner pod manifest - [#2](https://github.com/mruoss/flame_k8s_backend/pull/2)
- Basic integration test

### Changed

- Delete pod when shutting down the runner.

## [0.2.2] - 2023-12-14

### Fixed

- Don't crash the runner if the `:log` option is not set (or set to `false`)

## [0.2.1] - 2023-12-11

### Changed

- ENV var `DRAGONFLY_PARENT` was renamed to `FLAME_PARENT` in commit [9c2e65cc](https://github.com/phoenixframework/flame/commit/9c2e65ccd2c55514a473ad6ed986326576687064)

## [0.2.0] - 2023-12-10

### Changed

- Replace `k8s` lib with a lightweight Kubernetes client implementation.

## [0.1.0] - 2023-12-09

- Very early stage implementation of a Kubernetes backend.