Skip to content

Commit

Permalink
feat: initial steps on getting some deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Aug 18, 2022
1 parent b6358e6 commit 1b618e4
Show file tree
Hide file tree
Showing 27 changed files with 647 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = [

[patch.crates-io]
#drogue-bazaar = { path = "../drogue-bazaar" }
drogue-bazaar = { git = "https://github.com/drogue-iot/drogue-bazaar", rev = "f77db10ce88b81c084d5109f48a17d3987b7b620" }
drogue-bazaar = { git = "https://github.com/drogue-iot/drogue-bazaar", rev = "1a769df7ec04d0b07a7da78f0d91789541bca51b" }
#drogue-client = { path = "../drogue-client" }
#drogue-client = { git = "https://github.com/drogue-iot/drogue-client", rev = "0cb6998da75905240f06f38a44aac31d7b3fdde5" } # FIXME: awaiting release 0.11.0

Expand Down
2 changes: 1 addition & 1 deletion deploy/helm
Submodule helm updated 84 files
+1 −1 charts/drogue-cloud-common/templates/_common.tpl
+6 −6 charts/drogue-cloud-common/templates/_http.tpl
+1 −1 charts/drogue-cloud-common/templates/_image.tpl
+2 −2 charts/drogue-cloud-common/templates/_ingress.tpl
+3 −3 charts/drogue-cloud-common/templates/_kafka.tpl
+1 −1 charts/drogue-cloud-common/templates/_pods.tpl
+93 −0 charts/drogue-cloud-common/templates/_postgres.tpl
+15 −0 charts/drogue-cloud-common/templates/_service.tpl
+80 −20 charts/drogue-cloud-common/templates/_sso.tpl
+3 −3 charts/drogue-cloud-common/templates/_tls.tpl
+1 −95 charts/drogue-cloud-core/templates/_postgres.tpl
+4 −20 charts/drogue-cloud-core/templates/_service.tpl
+0 −79 charts/drogue-cloud-core/templates/_sso.tpl
+2 −2 charts/drogue-cloud-core/templates/api/ingress.yaml
+3 −3 charts/drogue-cloud-core/templates/infrastructure/kafka/kafka-user.yaml
+3 −3 charts/drogue-cloud-core/templates/infrastructure/kafka/kafka.yaml
+3 −3 charts/drogue-cloud-core/templates/infrastructure/kafka/topics.yaml
+1 −1 charts/drogue-cloud-core/templates/infrastructure/postgres/migrate.yaml
+10 −7 charts/drogue-cloud-core/templates/infrastructure/postgres/persistent-volume-claim.yaml
+1 −1 charts/drogue-cloud-core/templates/infrastructure/sso/ingress.yaml
+2 −2 charts/drogue-cloud-core/templates/infrastructure/sso/instance.yaml
+5 −5 charts/drogue-cloud-core/templates/integration/mqtt/_deployment.tpl
+9 −9 charts/drogue-cloud-core/templates/integration/websocket/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/integration/websocket/ingress.yaml
+2 −2 charts/drogue-cloud-core/templates/integration/websocket/service.yaml
+1 −1 charts/drogue-cloud-core/templates/service/console/deployment-api.yaml
+10 −10 charts/drogue-cloud-core/templates/service/console/deployment-backend.yaml
+3 −3 charts/drogue-cloud-core/templates/service/console/deployment-frontend.yaml
+2 −2 charts/drogue-cloud-core/templates/service/console/ingress.yaml
+2 −2 charts/drogue-cloud-core/templates/service/console/service-backend.yaml
+8 −8 charts/drogue-cloud-core/templates/service/registry/auth/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/service/registry/auth/service.yaml
+4 −4 charts/drogue-cloud-core/templates/service/registry/events-controller/deployment.yaml
+4 −4 charts/drogue-cloud-core/templates/service/registry/knative-operator/deployment.yaml
+6 −6 charts/drogue-cloud-core/templates/service/registry/outbox/deployment.yaml
+9 −9 charts/drogue-cloud-core/templates/service/registry/registry/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/service/registry/registry/service.yaml
+4 −4 charts/drogue-cloud-core/templates/service/registry/topic-operator/admin/deployment.yaml
+4 −4 charts/drogue-cloud-core/templates/service/registry/topic-operator/strimzi/deployment.yaml
+4 −4 charts/drogue-cloud-core/templates/service/registry/ttn-operator/deployment.yaml
+8 −8 charts/drogue-cloud-core/templates/service/registry/user-auth/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/service/registry/user-auth/service.yaml
+9 −9 charts/drogue-cloud-core/templates/service/state/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/service/state/service.yaml
+3 −3 charts/drogue-cloud-core/templates/source/coap/deployment.yaml
+9 −9 charts/drogue-cloud-core/templates/source/command/deployment.yaml
+2 −2 charts/drogue-cloud-core/templates/source/command/service.yaml
+5 −5 charts/drogue-cloud-core/templates/source/http/deployment.yaml
+1 −1 charts/drogue-cloud-core/templates/source/http/service.yaml
+4 −4 charts/drogue-cloud-core/templates/source/mqtt/_deployment.tpl
+8 −0 charts/drogue-cloud-core/values.yaml
+0 −4 charts/drogue-cloud-twin/Chart.yaml
+101 −0 charts/drogue-cloud-twin/templates/_config.tpl
+0 −16 charts/drogue-cloud-twin/templates/_ditto.tpl
+27 −0 charts/drogue-cloud-twin/templates/_endpoints.tpl
+5 −1 charts/drogue-cloud-twin/templates/_helpers.tpl
+4 −0 charts/drogue-cloud-twin/templates/_postgres.tpl
+29 −0 charts/drogue-cloud-twin/templates/api/ingress.yaml
+15 −0 charts/drogue-cloud-twin/templates/configuration.yaml
+0 −84 charts/drogue-cloud-twin/templates/ditto/ditto.yaml
+0 −11 charts/drogue-cloud-twin/templates/ditto/link.yaml
+15 −0 charts/drogue-cloud-twin/templates/infrastructure/kafka/kafka-user.yaml
+126 −0 charts/drogue-cloud-twin/templates/infrastructure/kafka/kafka.yaml
+28 −0 charts/drogue-cloud-twin/templates/infrastructure/kafka/topics.yaml
+106 −0 charts/drogue-cloud-twin/templates/infrastructure/postgres/deployment.yaml
+29 −0 charts/drogue-cloud-twin/templates/infrastructure/postgres/migrate.yaml
+16 −0 charts/drogue-cloud-twin/templates/infrastructure/postgres/persistent-volume-claim.yaml
+11 −0 charts/drogue-cloud-twin/templates/infrastructure/postgres/secret.yaml
+23 −0 charts/drogue-cloud-twin/templates/infrastructure/postgres/service.yaml
+35 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/database.yaml
+34 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/ingress.yaml
+10 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/initial-admin.yaml
+98 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/instance.yaml
+351 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/post-install-job.yaml
+18 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/service.yaml
+12 −0 charts/drogue-cloud-twin/templates/infrastructure/sso/sso-service-credentials.yaml
+0 −21 charts/drogue-cloud-twin/templates/prometheus/pod-monitor.yaml
+0 −125 charts/drogue-cloud-twin/templates/registry/ditto-registry-operator/deployment.yaml
+59 −0 charts/drogue-cloud-twin/templates/services/backend/deployment.yaml
+23 −0 charts/drogue-cloud-twin/templates/services/backend/service.yaml
+0 −38 charts/drogue-cloud-twin/templates/sso/client-ditto-infra.yaml
+0 −36 charts/drogue-cloud-twin/templates/sso/client-ditto.yaml
+0 −58 charts/drogue-cloud-twin/templates/sso/post-install.yaml
+150 −45 charts/drogue-cloud-twin/values.yaml
1 change: 1 addition & 0 deletions deploy/install/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chart.lock
27 changes: 27 additions & 0 deletions deploy/install/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: install
description: Installer wrapper
keywords:
- IoT
home: https://drogue.io
icon: https://blog.drogue.io/favicon.svg

maintainers:
- name: ctron
email: [email protected]
url: https://dentrassi.de

type: application

version: 0.5.0

kubeVersion: ">= 1.19.0-0"

dependencies:
- name: drogue-cloud-common
version: ^0.6.0-alpha1
repository: file://../helm/charts/drogue-cloud-common
- name: drogue-cloud-twin
version: ^0.6.0-alpha1
alias: drogueCloudTwin
repository: file://../helm/charts/drogue-cloud-twin
1 change: 1 addition & 0 deletions deploy/install/charts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
Empty file added deploy/install/values.yaml
Empty file.
17 changes: 17 additions & 0 deletions deploy/kind/cluster-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
23 changes: 23 additions & 0 deletions deploy/profiles/crc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# use in combination with the openshift.yaml file

global:
drogueCloud:
keycloak:
insecure: true

drogueCloudTwin:

services:
api:
ingress:
insecure: true
port: 80

backend:
service:
insecure: true

sso:
ingress:
insecure: true
port: 80
7 changes: 7 additions & 0 deletions deploy/profiles/gke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
drogueCloudTwin:
postgres:
podSecurityContext:
enabled: true
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
25 changes: 25 additions & 0 deletions deploy/profiles/kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Ports might seem a bit off, but they must be in the range of 30000-32767

global:
drogueCloud:
keycloak:
insecure: true

drogueCloudTwin:

services:

api:
ingress:
insecure: true
port: 80

backend:
service:
insecure: true

sso:
ingress:
insecure: true
port: 80
29 changes: 29 additions & 0 deletions deploy/profiles/minikube.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# Ports might seem a bit off, but they must be in the range of 30000-32767

global:
drogueCloud:
keycloak:
insecure: true

drogueCloudTwin:

defaults:
ingress:
className: nginx

services:

api:
ingress:
insecure: true
port: 80

backend:
service:
insecure: true

sso:
ingress:
insecure: true
port: 80
3 changes: 3 additions & 0 deletions deploy/profiles/openshift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global:
drogueCloud:
useServiceCa: true
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local-values.yaml
File renamed without changes.
6 changes: 6 additions & 0 deletions scripts/cmd/__endpoints.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# FIXME: find a way to detect endpoints

# API_URL="$(get_env deploy/console-backend endpoint ENDPOINTS__API_URL)"
# SSO_URL="$(get_env deploy/console-backend endpoint SSO_URL)"
20 changes: 20 additions & 0 deletions scripts/cmd/__nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e

: "${NGINX_VERSION:=1.1.0}"

echo "Installing NGINX Ingress Controller: ${NGINX_VERSION}"
progress "📦 Deploying pre-requisites (NGINX Ingress Controller v${NGINX_VERSION}) ... "

progress -n " 🏗 Deploying operator ... "
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v${NGINX_VERSION}/deploy/static/provider/kind/deploy.yaml
progress "done!"

if [[ "$MINIMIZE" == true ]]; then
kubectl -n ingress-nginx set resources deployment ingress-nginx-controller --requests=cpu=0
fi

progress -n " ⏳ Waiting for the operator to become ready ... "
kubectl wait --namespace ingress-nginx --for=condition=Available deployment ingress-nginx-controller
progress "done!"
32 changes: 32 additions & 0 deletions scripts/cmd/__sso.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

#
# Install the keycloak operator
#

set -e

: "${KEYCLOAK_OPERATOR_VERSION:=18.0.1}"
: "${KEYCLOAK_CRDS:=true}"

progress "📦 Deploying pre-requisites (Keycloak v${KEYCLOAK_OPERATOR_VERSION}) ... "

if [[ "$KEYCLOAK_CRDS" == true ]]; then

progress -n " 🗂 Deploying CRDs ... "

kubectl apply \
-f "https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/${KEYCLOAK_OPERATOR_VERSION}/kubernetes/keycloaks.k8s.keycloak.org-v1.yml" \
-f "https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/${KEYCLOAK_OPERATOR_VERSION}/kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml"
progress "done!"

fi

progress -n " 🏗 Deploying the operator ... "
kubectl -n "$DROGUE_NS" apply \
-f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/${KEYCLOAK_OPERATOR_VERSION}/kubernetes/kubernetes.yml
progress "done!"

progress -n " ⏳ Waiting for the operator to become ready ... "
kubectl -n "$DROGUE_NS" wait deployment keycloak-operator --for=condition=Available --timeout=-1s
progress "done!"
48 changes: 48 additions & 0 deletions scripts/cmd/__strimzi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

set -e

: "${KAFKA_NS:=kafka}"
: "${STRIMZI_VERSION:=0.30.0}"

echo "Installing Strimzi: ${STRIMZI_VERSION}"
progress "📦 Deploying pre-requisites (Strimzi v${STRIMZI_VERSION}) ... "

#
# Strimzi
#
if ! kubectl get ns $KAFKA_NS >/dev/null 2>&1; then
progress -n " 🆕 Creating namespace ... "
kubectl create ns $KAFKA_NS
progress "done!"
fi
if ! kubectl -n $KAFKA_NS get deploy/strimzi-cluster-operator >/dev/null 2>&1; then
progress -n " 🏗 Deploying the operator ... "
# use "kubectl create" -> https://github.com/strimzi/strimzi-kafka-operator/issues/4589
curl -sL "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${STRIMZI_VERSION}/strimzi-cluster-operator-${STRIMZI_VERSION}.yaml" |
sed "s/myproject/${KAFKA_NS}/" |
kubectl create -n $KAFKA_NS -f -

# the following is required to watch all namespaces
kubectl -n $KAFKA_NS set env deploy/strimzi-cluster-operator STRIMZI_NAMESPACE=\*
if ! kubectl get clusterrolebinding strimzi-cluster-operator-namespaced >/dev/null 2>&1; then
kubectl create clusterrolebinding strimzi-cluster-operator-namespaced \
--clusterrole=strimzi-cluster-operator-namespaced \
--serviceaccount $KAFKA_NS:strimzi-cluster-operator
kubectl create clusterrolebinding strimzi-cluster-operator-entity-operator-delegation \
--clusterrole=strimzi-entity-operator \
--serviceaccount $KAFKA_NS:strimzi-cluster-operator
kubectl create clusterrolebinding strimzi-cluster-operator-topic-operator-delegation \
--clusterrole=strimzi-topic-operator \
--serviceaccount $KAFKA_NS:strimzi-cluster-operator
fi
progress "done!"
fi

if [[ "$MINIMIZE" == true ]]; then
kubectl -n "$KAFKA_NS" set resources deployment strimzi-cluster-operator --requests=cpu=0
fi

progress -n " ⏳ Waiting for the operator to become ready ... "
kubectl wait deployment --all --timeout=-1s --for=condition=Available -n "$KAFKA_NS"
progress "done!"
Loading

0 comments on commit 1b618e4

Please sign in to comment.