Skip to content

Commit

Permalink
Fix catalog installer
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Aug 14, 2018
1 parent 7dc8cd8 commit 0381800
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 36 deletions.
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.elasticsearch }}
---
apiVersion: kubedb.com/v1alpha1
kind: ElasticsearchVersion
Expand Down Expand Up @@ -105,3 +106,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
tools:
image: "{{ .Values.dockerRegistry }}/elasticsearch-tools:6.3"
{{ end }}
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/memcached.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.memcached }}
---
apiVersion: kubedb.com/v1alpha1
kind: MemcachedVersion
Expand Down Expand Up @@ -29,3 +30,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/memcached:1.5.4"
exporter:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
{{ end }}
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/mongodb.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.mongo }}
---
apiVersion: kubedb.com/v1alpha1
kind: MongoDBVersion
Expand Down Expand Up @@ -33,3 +34,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
tools:
image: "{{ .Values.dockerRegistry }}/mongo-tools:3.6"
{{ end }}
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/mysql.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.mysql }}
---
apiVersion: kubedb.com/v1alpha1
kind: MySQLVersion
Expand Down Expand Up @@ -51,3 +52,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
tools:
image: "{{ .Values.dockerRegistry }}/mysql-tools:5"
{{ end }}
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.postgres }}
---
apiVersion: kubedb.com/v1alpha1
kind: PostgresVersion
Expand Down Expand Up @@ -51,3 +52,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
tools:
image: "{{ .Values.dockerRegistry }}/postgres-tools:10.2"
{{ end }}
2 changes: 2 additions & 0 deletions chart/kubedb-catalog/templates/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.catalog.redis }}
---
apiVersion: kubedb.com/v1alpha1
kind: RedisVersion
Expand Down Expand Up @@ -45,3 +46,4 @@ spec:
image: "{{ .Values.dockerRegistry }}/redis:4"
exporter:
image: "{{ .Values.dockerRegistry }}/operator:0.8.0"
{{ end }}
8 changes: 8 additions & 0 deletions chart/kubedb-catalog/values.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
dockerRegistry: "kubedb"
catalog:
elasticsearch: true
etcd: true
memcached: true
mongo: true
mysql: true
postgres: true
redis: true
8 changes: 4 additions & 4 deletions docs/setup/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ options:
--run-on-master run KubeDB operator on master
--enable-validating-webhook enable/disable validating webhooks for KubeDB CRDs
--enable-mutating-webhook enable/disable mutating webhooks for KubeDB CRDs
--enable-status-subresource If enabled, uses status sub resource for crds
--enable-status-subresource if enabled, uses status sub resource for crds
--enable-analytics send usage events to Google Analytics (default: true)
--enable-catalog If enabled, installs kubedb database version catalog (default: true)
--install-catalog installs KubeDB database version catalog (default: all)
--uninstall uninstall KubeDB
--purge purges KubeDB crd objects and crds
```
Expand Down Expand Up @@ -107,11 +107,11 @@ $ curl -fsSL https://raw.githubusercontent.com/kubedb/cli/0.8.0/hack/deploy/kube

KubeDB 0.9.0 or later releases can use status sub resource for CustomResourceDefintions. This is enabled by default for Kubernetes 1.11.0 or later releases. To disable this feature, pass the `--enable-status-subresource=false` flag.

KubeDB 0.9.0 or later installs a catalog of database versions. To disable this pass the `--enable-catalog=false` flag.
KubeDB 0.9.0 or later installs a catalog of database versions. To disable this pass the `--install-catalog=none` flag.

```console
$ curl -fsSL https://raw.githubusercontent.com/kubedb/cli/0.8.0/hack/deploy/kubedb.sh \
| bash -s -- --enable-catalog=false [--rbac]
| bash -s -- --install-catalog=none [--rbac]
```

</div>
Expand Down
67 changes: 35 additions & 32 deletions hack/deploy/kubedb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export KUBEDB_ENABLE_RBAC=true
export KUBEDB_RUN_ON_MASTER=0
export KUBEDB_ENABLE_VALIDATING_WEBHOOK=false
export KUBEDB_ENABLE_MUTATING_WEBHOOK=false
export KUBEDB_ENABLE_CATALOG=${KUBEDB_ENABLE_CATALOG:-all}
export KUBEDB_CATALOG=${KUBEDB_CATALOG:-all}
export KUBEDB_DOCKER_REGISTRY=kubedb
export KUBEDB_OPERATOR_TAG=0.8.0
export KUBEDB_OPERATOR_NAME=operator
Expand Down Expand Up @@ -160,10 +160,10 @@ show_help() {
echo " --run-on-master run KubeDB operator on master"
echo " --enable-validating-webhook enable/disable validating webhooks for KubeDB CRDs"
echo " --enable-mutating-webhook enable/disable mutating webhooks for KubeDB CRDs"
echo " --enable-status-subresource If enabled, uses status sub resource for KubeDB crds"
echo " --enable-status-subresource if enabled, uses status sub resource for KubeDB crds"
echo " --enable-analytics send usage events to Google Analytics (default: true)"
echo " --enable-catalog If enabled, installs kubedb database version catalog (default: true)"
echo " --operator-name specify which kubedb operator to deploy (default: operator)"
echo " --install-catalog installs KubeDB database version catalog (default: all)"
echo " --operator-name specify which KubeDB operator to deploy (default: operator)"
echo " --uninstall uninstall KubeDB"
echo " --purge purges KubeDB crd objects and crds"
}
Expand Down Expand Up @@ -225,11 +225,11 @@ while test $# -gt 0; do
fi
shift
;;
--enable-catalog*)
--install-catalog*)
shift
val=$(echo $1 | sed -e 's/^[^=]*=//g')
if [ "$val" = "false" ]; then
export KUBEDB_ENABLE_CATALOG=false
export KUBEDB_CATALOG=false
fi
;;
--rbac*)
Expand Down Expand Up @@ -408,32 +408,35 @@ if [ "$KUBEDB_OPERATOR_NAME" = "operator" ]; then
done
fi

echo "adding kubedb catalog"
case "$KUBEDB_ENABLE_CATALOG" in
all)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/* | $ONESSL envsubst | kubectl apply -f -
;;
elasticsearch)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/elasticsearch.yaml | $ONESSL envsubst | kubectl apply -f -
;;
postgres)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/postgres.yaml | $ONESSL envsubst | kubectl apply -f -
;;
mongodb)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/mongodb.yaml | $ONESSL envsubst | kubectl apply -f -
;;
mysql)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/mysql.yaml | $ONESSL envsubst | kubectl apply -f -
;;
redis)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/redis.yaml | $ONESSL envsubst | kubectl apply -f -
;;
memcached)
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/memcached.yaml | $ONESSL envsubst | kubectl apply -f -
;;
*)
;;
esac
if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "elasticsearch" ]; then
echo "installing KubeDB Elasticsearch catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/elasticsearch.yaml | $ONESSL envsubst | kubectl apply -f -
fi

if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "postgres" ]; then
echo "installing KubeDB Postgres catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/postgres.yaml | $ONESSL envsubst | kubectl apply -f -
fi

if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "mongo" ]; then
echo "installing KubeDB MongoDB catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/mongodb.yaml | $ONESSL envsubst | kubectl apply -f -
fi

if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "mysql" ]; then
echo "installing KubeDB MySQL catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/mysql.yaml | $ONESSL envsubst | kubectl apply -f -
fi

if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "redis" ]; then
echo "installing KubeDB Redis catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/redis.yaml | $ONESSL envsubst | kubectl apply -f -
fi

if [ "KUBEDB_CATALOG" = "all" ] || [ "KUBEDB_CATALOG" = "memcached" ]; then
echo "installing KubeDB Memcached catalog"
${SCRIPT_LOCATION}hack/deploy/kubedb-catalog/memcached.yaml | $ONESSL envsubst | kubectl apply -f -
fi

echo
echo "Successfully installed KubeDB operator in $KUBEDB_NAMESPACE namespace!"

0 comments on commit 0381800

Please sign in to comment.