Skip to content

Commit

Permalink
Merge pull request #17 from francescotimperi/enterprise-redpanda
Browse files Browse the repository at this point in the history
feature: added a lean mode demo for the controller
  • Loading branch information
msciabarra authored Feb 10, 2024
2 parents 0b2ff4b + f91690f commit 993ab10
Show file tree
Hide file tree
Showing 12 changed files with 798 additions and 0 deletions.
71 changes: 71 additions & 0 deletions demos/demo-leanmode/Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
version: '3'

vars:
CMD: apply

tasks:

init:
- kubectl apply -f init
- kubectl config set-context --current --namespace nuvolaris

couchdb:
- kubectl {{.CMD}} -f couchdb

couchdb:delete: task couchdb CMD=delete

couchdb:test:
- kubectl -n nuvolaris apply -f common/kcat.yaml
- kubectl -n nuvolaris wait po kcat --for=condition=Ready
- >
kubectl -n nuvolaris exec -i kcat -- /bin/sh -c
'wget -qO- http://whisk_admin:some_passw0rd@$COUCHDB_SERVICE_HOST:$COUCHDB_SERVICE_PORT/_all_dbs/'
- kubectl -n nuvolaris delete -f common/kcat.yaml --grace-period=0

wsk:test:
- wsk action update hello tests/hello.js
- wsk action invoke hello


# kafkacat -L -b localhost:9092
# echo test | kafkacat -P -b localhost:9092 -t test
# kafkacat -C -b localhost:9092 -t test

watch: watch kubectl -n nuvolaris get deploy,pod,service,job

clean:
cmds:
- task couchdb
- task init
vars:
CMD: delete

export:
cmds:
- |
if test -z "{{.F}}"
then ls "{{.TPL}}/templates" ; echo select with "F=<file>" no .yaml
else helm template openwhisk {{.TPL}} \
-n nuvolaris -f openwhisk-deploy-kube/deploy/kind/mycluster.yaml \
-s templates/{{.F}}.yaml | tee ../demo-enterprise/export/{{.F}}.yaml
fi
vars:
TPL: openwhisk-deploy-kube/helm/openwhisk
dir: ../openwhisk-kube
30 changes: 30 additions & 0 deletions demos/demo-leanmode/couchdb/couchdb-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Source: openwhisk/templates/ow-db-secret.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

apiVersion: v1
kind: Secret
metadata:
name: couchdb-auth
namespace: nuvolaris
type: Opaque
data:
# whisk_admin
db_username: d2hpc2tfYWRtaW4=
# some_passw0rd
db_password: c29tZV9wYXNzdzByZA==
83 changes: 83 additions & 0 deletions demos/demo-leanmode/couchdb/couchdb-init.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: batch/v1
kind: Job
metadata:
name: couchdb-init
namespace: nuvolaris
spec:
backoffLimit: 3
template:
metadata:
name: couchdb-init
namespace: nuvolaris
spec:
serviceAccount: nuvolaris-operator
restartPolicy: Never
containers:
- name: init-couchdb
image: "ghcr.io/francescotimperi/nuvolaris-operator:0.3.0-morpheus.23021019"
imagePullPolicy: "IfNotPresent"
command: ["./dbinit.sh"]
env:
- name: "NUVOLARIS_CONFIG"
value: |
{
"components.couchdb": true,
"components.invoker": false,
"components.kafka": false,
"components.mongodb": false,
"components.openwhisk": true,
"components.redis": true,
"components.s3bucket": false,
"couchdb.admin.password": "some_passw0rd",
"couchdb.admin.user": "whisk_admin",
"couchdb.invoker.password": "s0meP@ass1",
"couchdb.invoker.user": "invoker_admin",
"couchdb.host": "couchdb",
"couchdb.controller.password": "s0meP@ass2",
"couchdb.controller.user": "controller_admin",
"couchdb.port": 5984,
"couchdb.volume-size": 10,
"kafka.host": "kafka",
"kafka.volume-size": 10,
"mongodb.admin.password": "0therPa55",
"mongodb.admin.user": "admin",
"mongodb.host": "mongodb",
"mongodb.volume-size": 10,
"openwhisk.limits.actions.invokes-concurrent": 250,
"openwhisk.limits.actions.invokes-perMinute": 999,
"openwhisk.limits.actions.sequence-maxLength": 50,
"openwhisk.limits.triggers.fires-perMinute": 999,
"openwhisk.namespaces.whisk-system": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2Bx1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP",
"openwhisk.namespaces.nuvolaris": "cbd68075-dac2-475e-8c07-d62a30c7e683:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP",
"s3.id": "AKIAIOSFODNN7EXAMPLE",
"s3.key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"s3.region": "eu-central-1",
"s3.volume-size": 10,
"nuvolaris.storageClass": "standard",
"nuvolaris.provisioner": "rancher.io/local-path",
"nuvolaris.apihost": "localhost",
"nuvolaris.apiport": "3233",
"nuvolaris.kube": "kind",
"nuvolaris.protocol": "http",
"operator.image": "ghcr.io/francescotimperi/nuvolaris-operator",
"operator.tag": "0.3.0-morpheus.23021019",
"controller.image": "ghcr.io/nuvolaris/openwhisk-controller",
"controller.tag": "0.3.0-morpheus.22122609"
}
55 changes: 55 additions & 0 deletions demos/demo-leanmode/couchdb/couchdb-set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# Source: openwhisk/templates/couchdb-pod.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: couchdb
namespace: nuvolaris
spec:
replicas: 1
selector:
matchLabels:
name: couchdb
serviceName: "couchdb"
template:
metadata:
labels:
name: couchdb
spec:
restartPolicy: Always
containers:
- name: couchdb
image: "apache/couchdb:2.3"
imagePullPolicy: "IfNotPresent"
ports:
- name: couchdb
containerPort: 5984
env:
- name: "COUCHDB_USER"
valueFrom:
secretKeyRef:
name: couchdb-auth
key: db_username
- name: "COUCHDB_PASSWORD"
valueFrom:
secretKeyRef:
name: couchdb-auth
key: db_password
- name: "NODENAME"
value: "couchdb0"
31 changes: 31 additions & 0 deletions demos/demo-leanmode/couchdb/couchdb-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# Source: openwhisk/templates/couchdb-svc.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v1
kind: Service
metadata:
name: couchdb
namespace: nuvolaris
spec:
type: NodePort
selector:
name: couchdb
ports:
- port: 5984
targetPort: 5984
nodePort: 30984
22 changes: 22 additions & 0 deletions demos/demo-leanmode/init/nuvolaris-ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
apiVersion: v1
kind: Namespace
metadata:
name: nuvolaris
37 changes: 37 additions & 0 deletions demos/demo-leanmode/init/nuvolaris-operator-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nuvolaris-operator
namespace: nuvolaris
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: nuvolaris-operator-demo-crb
namespace: nuvolaris
subjects:
- kind: ServiceAccount
namespace: nuvolaris
name: nuvolaris-operator
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
56 changes: 56 additions & 0 deletions demos/demo-leanmode/init/openwhisk-core-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# Source: openwhisk/templates/core-rolebind.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v1
kind: ServiceAccount
metadata:
name: openwhisk-core
namespace: nuvolaris
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openwhisk-core
namespace: nuvolaris
rules:
- apiGroups: ["extensions", "apps"]
resources: ["deployments"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: openwhisk-core
namespace: nuvolaris
roleRef:
kind: Role
name: openwhisk-core
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: openwhisk-core
namespace: nuvolaris
Loading

0 comments on commit 993ab10

Please sign in to comment.