Skip to content

Commit f84b95d

Browse files
authored
feat: additional ofo tutorial resources (#294)
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>
1 parent 2bf9a58 commit f84b95d

File tree

3 files changed

+263
-9
lines changed

3 files changed

+263
-9
lines changed
+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Flags for our UI
2+
apiVersion: core.openfeature.dev/v1beta1
3+
kind: FeatureFlag
4+
metadata:
5+
name: ui-flags
6+
labels:
7+
app: open-feature-demo
8+
spec:
9+
flagSpec:
10+
flags:
11+
new-welcome-message:
12+
state: ENABLED
13+
variants:
14+
'on': true
15+
'off': false
16+
defaultVariant: 'off'
17+
hex-color:
18+
variants:
19+
red: c05543
20+
green: 2f5230
21+
blue: 0d507b
22+
yellow: d4ac0d
23+
defaultVariant: blue
24+
state: ENABLED
25+
targeting:
26+
if:
27+
- in:
28+
- '@faas.com'
29+
- var:
30+
- email
31+
- yellow
32+
- null
33+
---
34+
# Feature flag source custom resource, configuring flagd to source flags from FeatureFlag CRDs
35+
apiVersion: core.openfeature.dev/v1beta1
36+
kind: FeatureFlagSource
37+
metadata:
38+
name: ui-flag-source
39+
labels:
40+
app: open-feature-demo
41+
spec:
42+
sources:
43+
- source: ui-flags
44+
provider: kubernetes
45+
---
46+
# Standalone flagd for serving UI
47+
apiVersion: core.openfeature.dev/v1beta1
48+
kind: Flagd
49+
metadata:
50+
name: flagd-ui
51+
spec:
52+
replicas: 1
53+
serviceAccountName: default
54+
featureFlagSource: ui-flag-source
55+
ingress:
56+
enabled: true
57+
annotations:
58+
nginx.ingress.kubernetes.io/force-ssl-redirect: 'false'
59+
hosts:
60+
- localhost
61+
ingressClassName: nginx
62+
pathType: Prefix
63+
---
64+
# Deployment of a demo-app using our custom resources
65+
apiVersion: apps/v1
66+
kind: Deployment
67+
metadata:
68+
name: open-feature-demo-deployment
69+
labels:
70+
app: open-feature-demo
71+
spec:
72+
replicas: 1
73+
selector:
74+
matchLabels:
75+
app: open-feature-demo
76+
template:
77+
metadata:
78+
labels:
79+
app: open-feature-demo
80+
annotations:
81+
openfeature.dev/enabled: 'true'
82+
openfeature.dev/inprocessconfiguration: 'in-process-config'
83+
spec:
84+
containers:
85+
- name: open-feature-demo
86+
image: ghcr.io/open-feature/playground-app:v0.16.0 # x-release-please-version
87+
ports:
88+
- containerPort: 30000
89+
args:
90+
- flagd
91+
env:
92+
- name: FLAGD_PORT_WEB
93+
value: '80'
94+
- name: FLAGD_OFREP_PORT_WEB
95+
value: '80'
96+
---
97+
# Service to expose our application
98+
apiVersion: v1
99+
kind: Service
100+
metadata:
101+
name: open-feature-demo-app-service
102+
labels:
103+
app: open-feature-demo
104+
spec:
105+
type: NodePort
106+
selector:
107+
app: open-feature-demo
108+
ports:
109+
- port: 30000
110+
targetPort: 30000
111+
nodePort: 30000
112+
---
113+
# Ingress for our application
114+
apiVersion: networking.k8s.io/v1
115+
kind: Ingress
116+
metadata:
117+
name: open-feature-demo-ingress
118+
spec:
119+
ingressClassName: nginx
120+
rules:
121+
http:
122+
paths:
123+
- pathType: Prefix
124+
path: /
125+
backend:
126+
service:
127+
name: open-feature-demo-app-service
128+
port:
129+
number: 30000

config/k8s/end-to-end.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ spec:
2525
targeting:
2626
if:
2727
- in:
28-
- "@faas.com"
29-
- var:
30-
- email
28+
- '@faas.com'
29+
- var:
30+
- email
3131
- yellow
3232
- null
3333
---
@@ -52,9 +52,9 @@ spec:
5252
targeting:
5353
if:
5454
- in:
55-
- "@faas.com"
56-
- var:
57-
- email
55+
- '@faas.com'
56+
- var:
57+
- email
5858
- binet
5959
- null
6060
use-remote-fib-service:
@@ -96,8 +96,8 @@ spec:
9696
labels:
9797
app: open-feature-demo
9898
annotations:
99-
openfeature.dev/enabled: "true"
100-
openfeature.dev/featureflagsource: "flag-sources"
99+
openfeature.dev/enabled: 'true'
100+
openfeature.dev/featureflagsource: 'flag-sources'
101101
spec:
102102
containers:
103103
- name: open-feature-demo
@@ -108,7 +108,7 @@ spec:
108108
- containerPort: 30000
109109
env:
110110
- name: FLAGD_PORT_WEB
111-
value: "30002"
111+
value: '30002'
112112
---
113113
# Service to expose our application
114114
apiVersion: v1

config/k8s/in-process-evaluation.yaml

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Flags for our backend application
2+
apiVersion: core.openfeature.dev/v1beta1
3+
kind: FeatureFlag
4+
metadata:
5+
name: app-flags
6+
labels:
7+
app: open-feature-demo
8+
spec:
9+
flagSpec:
10+
flags:
11+
fib-algo:
12+
variants:
13+
recursive: recursive
14+
memo: memo
15+
loop: loop
16+
binet: binet
17+
defaultVariant: recursive
18+
state: ENABLED
19+
use-remote-fib-service:
20+
state: ENABLED
21+
variants:
22+
'on': true
23+
'off': false
24+
defaultVariant: 'off'
25+
---
26+
# Feature flag source custom resource, configuring flagd to source flags from FeatureFlag CRDs
27+
apiVersion: core.openfeature.dev/v1beta1
28+
kind: FeatureFlagSource
29+
metadata:
30+
name: app-flag-source
31+
labels:
32+
app: open-feature-demo
33+
spec:
34+
sources:
35+
- source: app-flags
36+
provider: kubernetes
37+
---
38+
# Standalone flagd for serving in-process provider
39+
apiVersion: core.openfeature.dev/v1beta1
40+
kind: Flagd
41+
metadata:
42+
name: flagd-in-process
43+
spec:
44+
replicas: 1
45+
serviceType: ClusterIP
46+
serviceAccountName: default
47+
featureFlagSource: app-flag-source
48+
---
49+
# In-process provider configuration
50+
apiVersion: core.openfeature.dev/v1beta1
51+
kind: InProcessConfiguration
52+
metadata:
53+
name: in-process-config
54+
spec:
55+
host: flagd-in-process
56+
---
57+
# Deployment of a demo-app using our custom resources
58+
apiVersion: apps/v1
59+
kind: Deployment
60+
metadata:
61+
name: open-feature-demo-deployment
62+
labels:
63+
app: open-feature-demo
64+
spec:
65+
replicas: 1
66+
selector:
67+
matchLabels:
68+
app: open-feature-demo
69+
template:
70+
metadata:
71+
labels:
72+
app: open-feature-demo
73+
annotations:
74+
openfeature.dev/enabled: 'true'
75+
openfeature.dev/inprocessconfiguration: 'in-process-config'
76+
spec:
77+
containers:
78+
- name: open-feature-demo
79+
image: ghcr.io/open-feature/playground-app:v0.16.0 # x-release-please-version
80+
ports:
81+
- containerPort: 30000
82+
args:
83+
- flagd
84+
env:
85+
- name: FLAGD_PORT_WEB
86+
value: '80'
87+
- name: FLAGD_PATH_PREFIX
88+
value: 'flagd'
89+
- name: FLAGD_OFREP_PORT_WEB
90+
value: '80'
91+
---
92+
# Service to expose our application
93+
apiVersion: v1
94+
kind: Service
95+
metadata:
96+
name: open-feature-demo-app-service
97+
labels:
98+
app: open-feature-demo
99+
spec:
100+
type: NodePort
101+
selector:
102+
app: open-feature-demo
103+
ports:
104+
- port: 30000
105+
targetPort: 30000
106+
nodePort: 30000
107+
---
108+
# Ingress for our application
109+
apiVersion: networking.k8s.io/v1
110+
kind: Ingress
111+
metadata:
112+
name: open-feature-demo-ingress
113+
spec:
114+
ingressClassName: nginx
115+
rules:
116+
- host: localhost
117+
http:
118+
paths:
119+
- pathType: Prefix
120+
path: /
121+
backend:
122+
service:
123+
name: open-feature-demo-app-service
124+
port:
125+
number: 30000

0 commit comments

Comments
 (0)