Skip to content

Commit 16360d7

Browse files
committed
Moved to knative charts.
1 parent dcaf3e4 commit 16360d7

File tree

10 files changed

+207
-95
lines changed

10 files changed

+207
-95
lines changed

.github/workflows/helm-tests.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -67,48 +67,6 @@ jobs:
6767
6868
echo "✅ K3s is ready"
6969
70-
- name: Install Knative Serving
71-
run: |
72-
echo "=== Installing Knative Serving ==="
73-
# Install Knative Serving CRDs
74-
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-crds.yaml
75-
# Install Knative Serving core components
76-
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-core.yaml
77-
# Install Kourier networking layer for Knative
78-
kubectl apply -f https://github.com/knative/net-kourier/releases/download/knative-v1.17.0/kourier.yaml
79-
# Configure Knative to use Kourier
80-
kubectl patch configmap/config-network \
81-
--namespace knative-serving \
82-
--type merge \
83-
--patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
84-
# Wait for Knative Serving to be ready
85-
echo "Waiting for Knative Serving to be ready..."
86-
kubectl wait --for=condition=Ready pod -l app=controller -n knative-serving --timeout=300s
87-
kubectl wait --for=condition=Ready pod -l app=webhook -n knative-serving --timeout=300s
88-
kubectl wait --for=condition=Ready pod -l app=3scale-kourier-gateway -n kourier-system --timeout=300s
89-
90-
- name: Install Knative Eventing
91-
run: |
92-
echo "=== Installing Knative Eventing ==="
93-
# Install Knative Eventing CRDs (includes SinkBinding)
94-
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-crds.yaml
95-
# Install Knative Eventing core components
96-
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-core.yaml
97-
# Wait for Knative Eventing to be ready
98-
echo "Waiting for Knative Eventing to be ready..."
99-
kubectl wait --for=condition=Ready pod -l app=eventing-controller -n knative-eventing --timeout=300s
100-
kubectl wait --for=condition=Ready pod -l app=eventing-webhook -n knative-eventing --timeout=300s
101-
102-
- name: Deploy CloudEvents sink for eoapi-notifier
103-
run: |
104-
echo "=== Deploying CloudEvents sink ==="
105-
# Create the namespace first
106-
kubectl create namespace eoapi || true
107-
# Deploy the CloudEvents sink service
108-
kubectl apply -f charts/eoapi/samples/cloudevents-sink.yaml
109-
# Wait for the Knative service to be ready
110-
echo "Waiting for CloudEvents sink to be ready..."
111-
kubectl wait --for=condition=Ready ksvc/eoapi-cloudevents-sink -n eoapi --timeout=300s
11270
11371
- name: Wait for Traefik to be ready
11472
run: |

charts/eoapi/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ dependencies:
5757
version: 0.0.7
5858
repository: "oci://ghcr.io/developmentseed/charts"
5959
condition: eoapi-notifier.enabled
60+
- name: knative-operator
61+
version: 1.19.4
62+
repository: https://knative.github.io/operator
63+
condition: knative.enabled
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{{- if and (index .Values "eoapi-notifier").enabled .Values.knative.enabled .Values.knative.cloudEventsSink.enabled }}
2+
{{- range (index .Values "eoapi-notifier").outputs }}
3+
{{- if eq .type "cloudevents" }}
4+
---
5+
apiVersion: serving.knative.dev/v1
6+
kind: Service
7+
metadata:
8+
name: eoapi-cloudevents-sink
9+
namespace: {{ $.Release.Namespace }}
10+
labels:
11+
{{- include "eoapi.labels" $ | nindent 4 }}
12+
app.kubernetes.io/component: cloudevents-sink
13+
annotations:
14+
helm.sh/hook: "post-install,post-upgrade"
15+
helm.sh/hook-weight: "5"
16+
helm.sh/hook-delete-policy: "before-hook-creation"
17+
spec:
18+
template:
19+
metadata:
20+
annotations:
21+
autoscaling.knative.dev/minScale: "1"
22+
autoscaling.knative.dev/maxScale: "1"
23+
labels:
24+
{{- include "eoapi.selectorLabels" $ | nindent 8 }}
25+
app.kubernetes.io/component: cloudevents-sink
26+
spec:
27+
containers:
28+
- name: cloudevents-sink
29+
image: {{ $.Values.knative.cloudEventsSink.image }}
30+
ports:
31+
- containerPort: 8080
32+
env:
33+
- name: TARGET
34+
value: "CloudEvents Sink"
35+
resources:
36+
{{- toYaml $.Values.knative.cloudEventsSink.resources | nindent 10 }}
37+
{{- break }}
38+
{{- end }}
39+
{{- end }}
40+
{{- end }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{{- if and .Values.knative.enabled .Values.knative.cloudEventsSink.enabled }}
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: {{ .Release.Name }}-knative-crd-wait
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "eoapi.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: knative-crd-wait
10+
annotations:
11+
helm.sh/hook: "pre-install,pre-upgrade"
12+
helm.sh/hook-weight: "0"
13+
helm.sh/hook-delete-policy: "before-hook-creation,hook-succeeded"
14+
spec:
15+
template:
16+
metadata:
17+
name: {{ .Release.Name }}-knative-crd-wait
18+
labels:
19+
{{- include "eoapi.labels" . | nindent 8 }}
20+
app.kubernetes.io/component: knative-crd-wait
21+
spec:
22+
restartPolicy: Never
23+
serviceAccountName: {{ .Release.Name }}-eoapi
24+
containers:
25+
- name: knative-crd-wait
26+
image: bitnami/kubectl:latest
27+
imagePullPolicy: IfNotPresent
28+
command:
29+
- /bin/bash
30+
- -c
31+
- |
32+
set -e
33+
echo "=== Waiting for Knative CRDs to be established ==="
34+
35+
# List of required CRDs
36+
REQUIRED_CRDS=(
37+
"services.serving.knative.dev"
38+
"configurations.serving.knative.dev"
39+
"routes.serving.knative.dev"
40+
"revisions.serving.knative.dev"
41+
"sinkbindings.sources.knative.dev"
42+
)
43+
44+
# Wait for each CRD with timeout
45+
for crd in "${REQUIRED_CRDS[@]}"; do
46+
echo "Waiting for CRD: $crd"
47+
timeout=300
48+
counter=0
49+
50+
while [ $counter -lt $timeout ]; do
51+
if kubectl get crd "$crd" &>/dev/null; then
52+
echo "✅ CRD established: $crd"
53+
break
54+
fi
55+
56+
echo "⏳ Waiting for $crd... ($counter/$timeout)"
57+
sleep 5
58+
counter=$((counter + 5))
59+
done
60+
61+
if [ $counter -ge $timeout ]; then
62+
echo "❌ Timeout waiting for CRD: $crd"
63+
echo "Available Knative CRDs:"
64+
kubectl get crd | grep knative || echo "No Knative CRDs found"
65+
echo "Knative operator status:"
66+
kubectl get pods -A -l app.kubernetes.io/name=knative-operator || echo "No Knative operator pods found"
67+
exit 1
68+
fi
69+
done
70+
71+
echo "✅ All required Knative CRDs are ready"
72+
resources:
73+
requests:
74+
cpu: 50m
75+
memory: 64Mi
76+
limits:
77+
cpu: 100m
78+
memory: 128Mi
79+
backoffLimit: 3
80+
activeDeadlineSeconds: 600
81+
{{- end }}

charts/eoapi/templates/services/rbac.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@ rules:
1010
resources: ["jobs"]
1111
verbs: ["get", "list", "watch"]
1212
---
13+
{{- if .Values.knative.enabled }}
14+
apiVersion: rbac.authorization.k8s.io/v1
15+
kind: ClusterRole
16+
metadata:
17+
name: eoapi-cluster-role-{{ $.Release.Name }}
18+
labels:
19+
app: eoapi-{{ $.Release.Name }}
20+
rules:
21+
- apiGroups: ["apiextensions.k8s.io"]
22+
resources: ["customresourcedefinitions"]
23+
verbs: ["get", "list"]
24+
- apiGroups: [""]
25+
resources: ["pods"]
26+
verbs: ["get", "list"]
27+
---
28+
apiVersion: rbac.authorization.k8s.io/v1
29+
kind: ClusterRoleBinding
30+
metadata:
31+
name: eoapi-cluster-rolebinding-{{ $.Release.Name }}
32+
labels:
33+
app: eoapi-{{ $.Release.Name }}
34+
subjects:
35+
- kind: ServiceAccount
36+
name: {{ include "eoapi.serviceAccountName" . }}
37+
namespace: {{ $.Release.Namespace }}
38+
roleRef:
39+
kind: ClusterRole
40+
name: eoapi-cluster-role-{{ $.Release.Name }}
41+
apiGroup: rbac.authorization.k8s.io
42+
---
43+
{{- end }}
44+
---
1345
apiVersion: rbac.authorization.k8s.io/v1
1446
kind: RoleBinding
1547
metadata:

charts/eoapi/test-helm-values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# this file is used with `helm-tests` job in CI
22

3+
knative:
4+
enabled: false
5+
36
ingress:
47
className: "nginx"
58
enabled: true

charts/eoapi/test-k3s-unittest-values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# used in GH Actions `.github/workflows/helm-tests.yml.jobs.integration-tests`
22
testing: true
3+
4+
knative:
5+
enabled: true
6+
37
ingress:
48
enabled: true
59
className: "traefik"

charts/eoapi/test-local-values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Based on test-k3s-unittest-values.yaml with minimal changes for local environment
33

44
testing: true
5+
6+
knative:
7+
enabled: true
8+
59
ingress:
610
enabled: true
711
className: "nginx" # Changed from "traefik" for minikube

charts/eoapi/values.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,45 @@ eoapi-notifier:
520520
kind: Broker
521521
name: my-channel-1
522522
namespace: serverless
523-
# For HTTP endpoints, use: endpoint: https://webhook.example.com
523+
# For HTTP endpoints, use: endpoint: https://webhook.example.com
524524

525+
######################
526+
# KNATIVE
527+
######################
528+
# Optional Knative components for CloudEvents and serverless workloads
529+
knative:
530+
enabled: false
531+
version: "v1.19.6"
532+
# CloudEvents sink configuration (deployed when eoapi-notifier uses CloudEvents output)
533+
cloudEventsSink:
534+
enabled: false
535+
image: gcr.io/knative-samples/helloworld-go
536+
resources:
537+
requests:
538+
cpu: 100m
539+
memory: 128Mi
540+
limits:
541+
cpu: 200m
542+
memory: 256Mi
543+
544+
# Knative operator sub-chart configuration
545+
# These values are passed directly to the knative-operator sub-chart
546+
# The operator will be installed and can then deploy Knative Serving/Eventing via CRs
547+
knative-operator:
548+
knative_operator:
549+
knative_operator:
550+
tag: "v1.19.4"
551+
resources:
552+
requests:
553+
cpu: 100m
554+
memory: 100Mi
555+
limits:
556+
cpu: 500m
557+
memory: 500Mi
558+
559+
######################
560+
# VERSION MANAGEMENT
561+
######################
525562
# Version being upgraded from, used for migration purposes
526563
# Dont set the value in the values.yaml file
527564
# prefer to set it in the command line

scripts/deploy.sh

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -81,54 +81,9 @@ install_pgo() {
8181
kubectl get pods -l postgres-operator.crunchydata.com/control-plane=postgres-operator
8282
}
8383

84-
# Setup Knative for local development
85-
setup_knative() {
86-
log_info "Setting up Knative for local development..."
8784

88-
if kubectl get namespace knative-serving &>/dev/null && kubectl get namespace knative-eventing &>/dev/null; then
89-
log_info "Knative already installed, skipping installation"
90-
return 0
91-
fi
92-
93-
log_info "Installing Knative Serving..."
94-
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-crds.yaml
95-
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-core.yaml
96-
kubectl apply -f https://github.com/knative/net-kourier/releases/download/knative-v1.17.0/kourier.yaml
97-
# Configure Knative to use Kourier
98-
kubectl patch configmap/config-network \
99-
--namespace knative-serving \
100-
--type merge \
101-
--patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
102-
103-
log_info "Installing Knative Eventing..."
104-
# Install Knative Eventing CRDs (includes SinkBinding)
105-
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-crds.yaml
106-
# Install Knative Eventing core components
107-
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-core.yaml
108-
109-
log_info "Waiting for Knative components to be ready..."
110-
kubectl wait --for=condition=Ready pod -l app=controller -n knative-serving --timeout=300s
111-
kubectl wait --for=condition=Ready pod -l app=webhook -n knative-serving --timeout=300s
112-
kubectl wait --for=condition=Ready pod -l app=3scale-kourier-gateway -n kourier-system --timeout=300s
113-
kubectl wait --for=condition=Ready pod -l app=eventing-controller -n knative-eventing --timeout=300s
114-
kubectl wait --for=condition=Ready pod -l app=eventing-webhook -n knative-eventing --timeout=300s
115-
116-
log_info "✅ Knative installation complete"
117-
}
11885

119-
deploy_cloudevents_sink() {
120-
log_info "Deploying CloudEvents sink for notifications..."
12186

122-
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
123-
124-
if kubectl apply -f charts/eoapi/samples/cloudevents-sink.yaml; then
125-
log_info "Waiting for CloudEvents sink to be ready..."
126-
kubectl wait --for=condition=Ready ksvc/eoapi-cloudevents-sink -n "$NAMESPACE" --timeout=300s
127-
log_info "✅ CloudEvents sink deployed successfully"
128-
else
129-
log_warn "Failed to deploy CloudEvents sink, continuing without it"
130-
fi
131-
}
13287

13388
# Integrated Helm dependency setup
13489
setup_helm_dependencies() {
@@ -237,9 +192,7 @@ deploy_eoapi() {
237192
fi
238193
fi
239194

240-
if [ "$CI_MODE" != true ]; then
241-
deploy_cloudevents_sink
242-
fi
195+
243196

244197
# Verify deployment
245198
log_info "Verifying deployment..."
@@ -306,10 +259,6 @@ case $COMMAND in
306259
;;
307260
deploy)
308261
install_pgo
309-
310-
if [ "$CI_MODE" != true ]; then
311-
setup_knative
312-
fi
313262
setup_helm_dependencies
314263
deploy_eoapi
315264
;;

0 commit comments

Comments
 (0)