From f5b4285b92fc5b386629063a5dee69d78d177aba Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Wed, 31 Oct 2018 02:51:07 -0700 Subject: [PATCH] marketplace: use the Release.Name (#157) * marketplace: use the Release.Name * update install instructions --- marketplace/gcp/tidb-operator/README.md | 14 +++---- .../chart/tidb-mp/templates/_helpers.tpl | 2 +- .../chart/tidb-mp/templates/application.yml | 37 ++++++++++++++++++- .../chart/tidb-mp/templates/installer.yaml | 2 + .../tidb-mp/templates/operator-values.yaml | 1 + marketplace/gcp/tidb-operator/scripts/install | 10 ++++- 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/marketplace/gcp/tidb-operator/README.md b/marketplace/gcp/tidb-operator/README.md index e47e4f825b2..42e6f52381c 100644 --- a/marketplace/gcp/tidb-operator/README.md +++ b/marketplace/gcp/tidb-operator/README.md @@ -9,9 +9,9 @@ First you can modify configuration values. # Install the k8s application CRD into your cluster kubectl apply -f manifests/app-crd.yaml -export VERSION='v1.0.0' -export PROJECT=${PROJECT:-$(gcloud config get-value project | tr ':' '/')} -export REGISTRY="gcr.io/$PROJECT/tidb-operator" +VERSION='2.0' +PROJECT=$(gcloud config get-value project | tr ':' '/') +REGISTRY="gcr.io/$PROJECT/tidb-operator" docker build \ --build-arg "REGISTRY=$REGISTRY" \ @@ -20,11 +20,11 @@ docker build \ gcloud docker -- push "$REGISTRY/deployer:$VERSION" +NAMESPACE=tidb # We strongly recommend deploying into a new namespace -kubectl create namespace tidb -export NAMESPACE=tidb +kubectl create namespace $NAMESPACE -./scripts/install +REGISTRY=$REGISTRY NAMESPACE=$NAMESPACE ./scripts/install ``` You can watch the deployment come up with @@ -36,6 +36,6 @@ kubectl get pods -n tidb --watch When the tidb containers are running, you can connect with a MySQL client. ``` bash -kubectl -n test-ns port-forward db-tidb-0 4000:4000 & +kubectl -n $NAMESPACE port-forward db-tidb-0 4000:4000 & mysql -u root -P 4000 -h 127.0.0.1 ``` diff --git a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/_helpers.tpl b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/_helpers.tpl index b6da3f82621..39a9c324168 100644 --- a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/_helpers.tpl +++ b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/_helpers.tpl @@ -3,7 +3,7 @@ Expand the name of the chart. */}} {{- define "release.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* diff --git a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/application.yml b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/application.yml index 6c744e085f8..1c7d1f133f8 100644 --- a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/application.yml +++ b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/application.yml @@ -4,6 +4,41 @@ spec: descriptor: type: TiDB versions: '2.0' + description: |- + TiDB is a cloud-native, NewSQL distributed database with MySQL compatibility that handles hybrid transactional and analytical processing (HTAP) workloads. It has been deployed in-production in more than 300 companies, spanning industries from banking, e-commerce and gaming, to fintech and travel. TiDB Operator leverages Kubernetes and the operator pattern to simplify and automate deployment and management of a TiDB cluster. In this version, TiDB is deployed on GCP's persistent disks. + + [Learn more](https://pingcap.com/en/). + + PingCAP Enterprise Support is available via email for customers using TiDB Operator for GKE on the GCP Marketplace. To inquire about support packages and details, please email: tidb_gke_support@pingcap.com. + maintainers: + - name: PingCAP + url: https://pingcap.com + links: + - description: User Guide + url: https://github.com/pingcap/tidb-operator/tree/master/marketplace/gcp/tidb-operator/README.md + - description: Documentation + url: https://pingcap.com/docs/ + + notes: |- + # Connecting + + Note: there can be a small delay between the pod being up and running, and the service being available. + + You can connect to the clustered service within the Kubernetes cluster: + + ``` + kubectl run -n tidb mysql-client --rm -i --tty --image mysql -- mysql -P 4000 -u root -h $(kubectl get svc demo-tidb -n tidb --output json | jq -r '.spec.clusterIP') + ``` + + Congratulations, you are now up and running with a distributed TiDB database compatible with MySQL! + + In addition to connecting to TiDB within the Kubernetes cluster, you can also establish a tunnel to the TiDB service. + + ``` + kubectl -n tidb port-forward demo-tidb-0 4000:4000 &>/tmp/port-forward.log & + ``` + + selector: matchExpressions: - {key: app.kubernetes.io/name, operator: In, values: [tidb-operator, tidb-cluster, tidb-mp]} @@ -29,7 +64,7 @@ metadata: labels: app.kubernetes.io/name: "{{ .Release.Name }}" annotations: - marketplace.cloud.google.com/deploy-info: '{partner_id: "pingcap-public", product_id: "tidb-operator", partner_name: "PingCAP"}' + marketplace.cloud.google.com/deploy-info: '{partner_id: "pingcap-public", product_id: "pingcap-tidb-operator", partner_name: "PingCAP"}' kubernetes-engine.cloud.google.com/icon: |- iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAFRRJREFUeAHt nQmUE1W+xr/0vqfpkQbEBRVQR3jqjIgK+BBFHR+IAgOCoAIiIyK7cEABdZAdRhpEUZQBBgYQEZzH diff --git a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/installer.yaml b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/installer.yaml index dfa2e8cc56f..1ec0e86a64b 100644 --- a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/installer.yaml +++ b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/installer.yaml @@ -44,3 +44,5 @@ spec: path: operator.yaml - key: cluster path: cluster.yaml + - key: release-name + path: release-name.txt diff --git a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/operator-values.yaml b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/operator-values.yaml index c1f257d7a79..457ce86968d 100644 --- a/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/operator-values.yaml +++ b/marketplace/gcp/tidb-operator/chart/tidb-mp/templates/operator-values.yaml @@ -9,6 +9,7 @@ metadata: app.kubernetes.io/component: tidb-mp helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} data: + release-name: {{ template "release.name" . }} operator: | {{ toYaml (index .Values "tidb-operator") | indent 4 }} diff --git a/marketplace/gcp/tidb-operator/scripts/install b/marketplace/gcp/tidb-operator/scripts/install index 469a1a7bc1c..d6e118f0103 100755 --- a/marketplace/gcp/tidb-operator/scripts/install +++ b/marketplace/gcp/tidb-operator/scripts/install @@ -7,8 +7,14 @@ if [[ -z "${VERSION}" ]] ; then exit 1 fi -REPO=${REGISTRY:-"gcr.io/pingcap-public/pingcap/tidb-operator"} -PARAMETERS="{\"installerImage\":\"$REPO/installer:$VERSION\",\"tidb-operator.operatorImage\":\"$REPO/tidb-operator:$VERSION\",\"tidb-cluster.monitor.dashboardInstaller.image\":\"$REPO/tidb-dashboard-installer:$VERSION\",\"tidb-cluster.pd.image\":\"$REPO/pd:$VERSION\",\"tidb-cluster.tikv.image\":\"$REPO/tikv:$VERSION\",\"tidb-cluster.tidb.image\":\"$REPO/tidb:$VERSION\",\"name\":\"test-deployment\",\"namespace\":\"tidb\"}" +NAMESPACE=${NAMESPACE:-""} +if [[ -z "${NAMESPACE}" ]] ; then + echo "no namespace" + exit 1 +fi + +REPO="gcr.io/pingcap-public/pingcap/tidb-operator" +PARAMETERS="{\"installerImage\":\"$REPO/installer:$VERSION\",\"tidb-operator.operatorImage\":\"$REPO/tidb-operator:$VERSION\",\"tidb-cluster.monitor.dashboardInstaller.image\":\"$REPO/tidb-dashboard-installer:$VERSION\",\"tidb-cluster.pd.image\":\"$REPO/pd:$VERSION\",\"tidb-cluster.tikv.image\":\"$REPO/tikv:$VERSION\",\"tidb-cluster.tidb.image\":\"$REPO/tidb:$VERSION\",\"name\":\"test-deployment\",\"namespace\":\"$NAMESPACE\"}" # This uses a large docker image that takes a long time to download. "$(dirname "$0")/../scripts/mpdev" /scripts/install \