Skip to content

Commit

Permalink
adding platform prototype for ch6
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Salatino committed May 4, 2023
1 parent 496d757 commit 1a2f95a
Show file tree
Hide file tree
Showing 13 changed files with 986 additions and 0 deletions.
1 change: 1 addition & 0 deletions dagger/k8s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_EXPERIMENTAL_DAGGER_RUNNER_HOST=kube-pod://<podname>?context=<context>&namespace=<namespace>&container=<container>
10 changes: 10 additions & 0 deletions dagger/k8s/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Pod
metadata:
name: dagger
spec:
containers:
- name: dagger
image: registry.dagger.io/engine:v0.3.13
securityContext:
privileged: true
25 changes: 25 additions & 0 deletions openfeature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Openfeature for Feature Flagging

On this tutorial we will be writing a small application that consume feature flags that are managed by OpenFeature, a CNCF initiative for feature flags backed up by multiple vendors.

## Installation

Based on the documentation that you can find in github
https://github.com/open-feature/open-feature-operator/blob/main/docs/installation.md


Prerequisites (CertManager):
```
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.yaml
kubectl wait --for=condition=Available=True deploy --all -n 'cert-manager'
```

Installing the OpenFeature K8s Operator with Helm:

```
helm repo add openfeature https://open-feature.github.io/open-feature-operator/
helm repo update
helm upgrade --install openfeature openfeature/open-feature-operator
```

91 changes: 91 additions & 0 deletions openfeature/end-to-end.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# A basic flag custom resource
apiVersion: core.openfeature.dev/v1alpha2
kind: FeatureFlagConfiguration
metadata:
name: end-to-end
labels:
app: open-feature-demo
spec:
featureFlagSpec:
flags:
new-welcome-message:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'off'
hex-color:
variants:
red: c05543
green: 2f5230
blue: 0d507b
defaultVariant: blue
state: ENABLED
fib-algo:
variants:
recursive: recursive
memo: memo
loop: loop
binet: binet
defaultVariant: recursive
state: ENABLED
targeting:
if:
- in:
- "@faas.com"
- var:
- email
- binet
- null
use-remote-fib-service:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'off'
---
# Deployment of a demo-app using our custom resource
apiVersion: apps/v1
kind: Deployment
metadata:
name: open-feature-demo-deployment
labels:
app: open-feature-demo
spec:
replicas: 1
selector:
matchLabels:
app: open-feature-demo
template:
metadata:
labels:
app: open-feature-demo
annotations:
openfeature.dev/enabled: "true"
openfeature.dev/featureflagconfiguration: "end-to-end"
spec:
containers:
- name: open-feature-demo
image: ghcr.io/open-feature/playground-app:v0.6.3 # x-release-please-version
args:
- flagd
ports:
- containerPort: 30000

---
# Service exposed using NodePort
apiVersion: v1
kind: Service
metadata:
name: open-feature-demo-service
labels:
app: open-feature-demo
spec:
type: NodePort
selector:
app: open-feature-demo
ports:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
- port: 30000
targetPort: 30000
nodePort: 30000
Loading

0 comments on commit 1a2f95a

Please sign in to comment.