Skip to content

Commit

Permalink
feat: additional ofo tutorial resources (#294)
Browse files Browse the repository at this point in the history
Additional tutorial materials that depend on playground versioning.

The new manifests contain some duplication, but that's on purpose so
they can be used together OR independently depending on the tutorial
path users will take.

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert authored Jun 6, 2024
1 parent 2bf9a58 commit f84b95d
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 9 deletions.
129 changes: 129 additions & 0 deletions config/k8s/client-side-evaluation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Flags for our UI
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlag
metadata:
name: ui-flags
labels:
app: open-feature-demo
spec:
flagSpec:
flags:
new-welcome-message:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'off'
hex-color:
variants:
red: c05543
green: 2f5230
blue: 0d507b
yellow: d4ac0d
defaultVariant: blue
state: ENABLED
targeting:
if:
- in:
- '@faas.com'
- var:
- email
- yellow
- null
---
# Feature flag source custom resource, configuring flagd to source flags from FeatureFlag CRDs
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlagSource
metadata:
name: ui-flag-source
labels:
app: open-feature-demo
spec:
sources:
- source: ui-flags
provider: kubernetes
---
# Standalone flagd for serving UI
apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
metadata:
name: flagd-ui
spec:
replicas: 1
serviceAccountName: default
featureFlagSource: ui-flag-source
ingress:
enabled: true
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: 'false'
hosts:
- localhost
ingressClassName: nginx
pathType: Prefix
---
# Deployment of a demo-app using our custom resources
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/inprocessconfiguration: 'in-process-config'
spec:
containers:
- name: open-feature-demo
image: ghcr.io/open-feature/playground-app:v0.16.0 # x-release-please-version
ports:
- containerPort: 30000
args:
- flagd
env:
- name: FLAGD_PORT_WEB
value: '80'
- name: FLAGD_OFREP_PORT_WEB
value: '80'
---
# Service to expose our application
apiVersion: v1
kind: Service
metadata:
name: open-feature-demo-app-service
labels:
app: open-feature-demo
spec:
type: NodePort
selector:
app: open-feature-demo
ports:
- port: 30000
targetPort: 30000
nodePort: 30000
---
# Ingress for our application
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: open-feature-demo-ingress
spec:
ingressClassName: nginx
rules:
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: open-feature-demo-app-service
port:
number: 30000
18 changes: 9 additions & 9 deletions config/k8s/end-to-end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ spec:
targeting:
if:
- in:
- "@faas.com"
- var:
- email
- '@faas.com'
- var:
- email
- yellow
- null
---
Expand All @@ -52,9 +52,9 @@ spec:
targeting:
if:
- in:
- "@faas.com"
- var:
- email
- '@faas.com'
- var:
- email
- binet
- null
use-remote-fib-service:
Expand Down Expand Up @@ -96,8 +96,8 @@ spec:
labels:
app: open-feature-demo
annotations:
openfeature.dev/enabled: "true"
openfeature.dev/featureflagsource: "flag-sources"
openfeature.dev/enabled: 'true'
openfeature.dev/featureflagsource: 'flag-sources'
spec:
containers:
- name: open-feature-demo
Expand All @@ -108,7 +108,7 @@ spec:
- containerPort: 30000
env:
- name: FLAGD_PORT_WEB
value: "30002"
value: '30002'
---
# Service to expose our application
apiVersion: v1
Expand Down
125 changes: 125 additions & 0 deletions config/k8s/in-process-evaluation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Flags for our backend application
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlag
metadata:
name: app-flags
labels:
app: open-feature-demo
spec:
flagSpec:
flags:
fib-algo:
variants:
recursive: recursive
memo: memo
loop: loop
binet: binet
defaultVariant: recursive
state: ENABLED
use-remote-fib-service:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'off'
---
# Feature flag source custom resource, configuring flagd to source flags from FeatureFlag CRDs
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlagSource
metadata:
name: app-flag-source
labels:
app: open-feature-demo
spec:
sources:
- source: app-flags
provider: kubernetes
---
# Standalone flagd for serving in-process provider
apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
metadata:
name: flagd-in-process
spec:
replicas: 1
serviceType: ClusterIP
serviceAccountName: default
featureFlagSource: app-flag-source
---
# In-process provider configuration
apiVersion: core.openfeature.dev/v1beta1
kind: InProcessConfiguration
metadata:
name: in-process-config
spec:
host: flagd-in-process
---
# Deployment of a demo-app using our custom resources
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/inprocessconfiguration: 'in-process-config'
spec:
containers:
- name: open-feature-demo
image: ghcr.io/open-feature/playground-app:v0.16.0 # x-release-please-version
ports:
- containerPort: 30000
args:
- flagd
env:
- name: FLAGD_PORT_WEB
value: '80'
- name: FLAGD_PATH_PREFIX
value: 'flagd'
- name: FLAGD_OFREP_PORT_WEB
value: '80'
---
# Service to expose our application
apiVersion: v1
kind: Service
metadata:
name: open-feature-demo-app-service
labels:
app: open-feature-demo
spec:
type: NodePort
selector:
app: open-feature-demo
ports:
- port: 30000
targetPort: 30000
nodePort: 30000
---
# Ingress for our application
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: open-feature-demo-ingress
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: open-feature-demo-app-service
port:
number: 30000

0 comments on commit f84b95d

Please sign in to comment.