|
| 1 | +# Migrate to v1beta1 |
| 2 | + |
| 3 | +OpenFeature Operator version [v0.5.0](https://github.com/open-feature/open-feature-operator/releases/tag/v0.5.0) contain improved, stable CRDs which were upgraded to `v1beta1` api version. |
| 4 | +This document shows what was changed and how you can upgrade your existing CRDs to be compatible with this new release. |
| 5 | + |
| 6 | +## Renaming FeatureFlagConfiguration to FeatureFlag |
| 7 | + |
| 8 | +Along with the API version upgrade to `v1beta1`, we have renamed `FeatureFlagConfiguration` to `FeatureFlag`, making the naming clearer for the custom resource maintainers. |
| 9 | +In this CRD, spec section naming has changed. The older CRD used `featureFlagSpec` to define flag configurations. |
| 10 | +In the new version, flags are configured under `flagSpec` element. |
| 11 | + |
| 12 | +Consider below example with diff from old version to new version, |
| 13 | + |
| 14 | +```diff |
| 15 | +- apiVersion: core.openfeature.dev/v1alpha3 |
| 16 | ++ apiVersion: core.openfeature.dev/v1beta1 |
| 17 | +kind: FeatureFlagConfiguration |
| 18 | +metadata: |
| 19 | + name: end-to-end |
| 20 | + labels: |
| 21 | + app: open-feature-demo |
| 22 | +spec: |
| 23 | +- featureFlagSpec: |
| 24 | ++ flagSpec |
| 25 | + flags: |
| 26 | + new-welcome-message: |
| 27 | + state: ENABLED |
| 28 | + variants: |
| 29 | + 'on': true |
| 30 | + 'off': false |
| 31 | + defaultVariant: 'off' |
| 32 | +``` |
| 33 | + |
| 34 | +## openfeature.dev annotations |
| 35 | + |
| 36 | +There are several [annotations](./annotations.md) to control how OFO works on your workload. |
| 37 | + |
| 38 | +With the upgrade to `v1beta1`, we no longer support deprecated `openfeature.dev/featureflagconfiguration` annotation. |
| 39 | +Workloads which require feature flagging now need to use `openfeature.dev/featureflagsource` annotation, referring a [FeatureFlagSource](./feature_flag_source.md) CRD. |
| 40 | + |
| 41 | +```diff |
| 42 | + annotations: |
| 43 | + openfeature.dev/enabled: "true" |
| 44 | +- openfeature.dev/featureflagconfiguration: "end-to-end" |
| 45 | ++ openfeature.dev/featureflagsource: "end-to-end" |
| 46 | +``` |
| 47 | + |
| 48 | +`FeatureFlagSource` provide more flexibility by allowing users to configure the injected flag with many options. |
| 49 | +Consider below example for a `FeatureFlagSource` where flagd is instructed to use `FeatureFlag` custom resource named `end-to-end` as its flag source |
| 50 | + |
| 51 | +```yaml |
| 52 | +apiVersion: core.openfeature.dev/v1beta1 |
| 53 | +kind: FeatureFlagSource |
| 54 | +metadata: |
| 55 | + name: end-to-end |
| 56 | + labels: |
| 57 | + app: open-feature-demo |
| 58 | +spec: |
| 59 | + sources: |
| 60 | + - source: end-to-end |
| 61 | + provider: kubernetes |
| 62 | +``` |
0 commit comments