You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`FeatureFlagConfiguration``CustomResourceDefinition` (custom type that holds the configured state of feature flags).
46
-
- Standard kubernetes primitives (e.g. namespace, accounts, roles, bindings, configmaps).
47
-
- Operator controller manager service.
48
-
- Operator webhook service.
49
-
- Deployment with containers kube-rbac-proxy & manager.
50
-
-`MutatingWebhookConfiguration` (configures webhooks to call the webhook service).
51
-
52
-
### How to deploy a flag consuming application
53
-
54
-
_Prerequisite: the release and certificates have been deployed as outlined above._
55
-
56
-
Deploying a flag consuming application requires (at minimum) the creation of the following 2 resources (an example can be found [here](./config/samples/end-to-end.yaml)):
57
-
58
-
#### FeatureFlagConfiguration
59
-
60
-
This is a `CustomResourceDefinition` which contains the feature flags specification and a name of the spec.
61
-
62
-
#### Deployment (or Statefulset/Daemonset)
63
-
64
-
This is a kubernetes primitive for deploying an application. The metadata annotations must include `openfeature.dev/featureflagconfiguration`
65
-
with the value set as the name of the `FeatureFlagConfiguration` created in the step prior.
66
-
67
-
e.g.
68
-
```
69
-
metadata:
70
-
annotations:
71
-
openfeature.dev/featureflagconfiguration: "demo"
72
-
```
73
-
74
-
## Architecture
75
-
76
-
As per the issue [here](https://github.com/open-feature/ofep/issues/1)
77
-
78
-
As per v0.1.1, the default sync provider has been optimized as per this OpenFeature Enhancement Proposal [issue](https://github.com/open-feature/ofep/blob/main/004-OFEP-kubernetes-sync-service.md).
79
-
80
-
High level architecture is as follows:
81
-
82
-
<imgsrc="images/arch-0.png"width="700">
83
-
84
-
### Requirements
85
-
86
-
#### Namespace
87
-
88
-
The Kubernetes resources created by OpenFeature Operator are under the `open-feature-operator-system` namespace. This means
89
-
any resources that want to communicate with the OFO system (e.g. an application calling flag evaluations) must fall under
90
-
this namespace.
91
-
92
-
#### Cert Manager
93
-
94
-
OpenFeature Operator is a server that communicates with Kubernetes components within the cluster, as such it requires a means of
95
-
authorizing requests between peers. [Cert manager](https://cert-manager.io/) handles the authorization by
96
-
adding certificates and certificate issuers as resource types in Kubernetes clusters, and simplifies the process of
97
-
obtaining, renewing and using those certificates.
98
-
99
-
## Example
100
-
101
-
When wishing to leverage feature flagging within the local pod, the following steps are required:
102
-
103
-
1. Create a new feature flag custom resource.
104
-
105
-
_See [here](config/samples/crds/custom_provider.yaml) for additional custom resource parameters_
106
-
107
-
```
108
-
apiVersion: core.openfeature.dev/v1alpha2
109
-
kind: FeatureFlagConfiguration
110
-
metadata:
111
-
name: featureflagconfiguration-sample
112
-
spec:
113
-
featureFlagSpec:
114
-
flags:
115
-
foo:
116
-
state: "ENABLED"
117
-
variants:
118
-
"bar": "BAR"
119
-
"baz": "BAZ"
120
-
defaultVariant: "bar",
121
-
targeting: {}
122
-
```
123
-
124
-
1. Reference the CR within the pod spec annotations
125
-
The `openfeature.dev/featureflagconfiguration` annotation is a comma separated list of CR references, listed as `{namespace}/{name}`. e.g. `"default/featureflagconfiguration-sample, test/featureflagconfiguration-sample-2"`. If no namespace is defined, it is assumed that the flag configuration is in the same namespace as the deployed pod.
#### Create a local cluster with cert manager and our operator
153
-
154
-
1. Create a local cluster with MicroK8s or Kind (forward requests from your localhost:30000 to your cluster, see MicroK8s/Kind doc)
155
-
1.`IMG=ghcr.io/open-feature/open-feature-operator:main make deploy-operator`
156
-
157
-
#### Run the example
158
-
159
-
1. Apply the end-to-end example: `kubectl apply -f config/samples/end-to-end.yaml`
160
-
1. Visit `http://localhost:30000/`
161
-
1. Update the value of the `defaultVariant` field in the custom resource instance in `config/samples/end-to-end.yaml` and re-apply to update the flag value!
162
-
1. Visit `http://localhost:30000/` and see the change!
163
-
164
-
## Testing
165
-
166
-
Run `make test` to run the test suite. The controller integration tests use [envtest](https://book.kubebuilder.io/reference/envtest.html), this sets up and starts an instance of etcd and the Kubernetes API server, without kubelet, controller-manager or other components.
167
-
This provides means of asserting that the Kubernetes components reach the desired state without the overhead of using an actual cluster, keeping
168
-
test runtime and resource consumption down.
169
-
170
-
## Releases
171
-
172
-
This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes for the library components, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request). When Release Please's running PR is merged, any changed artifacts are published.
0 commit comments