Skip to content

Commit

Permalink
marketplace: use the Release.Name (#157)
Browse files Browse the repository at this point in the history
* marketplace: use the Release.Name

* update install instructions
  • Loading branch information
gregwebs authored and tennix committed Oct 31, 2018
1 parent 51dde5d commit f5b4285
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
14 changes: 7 additions & 7 deletions marketplace/gcp/tidb-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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
Expand All @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected].
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]}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ spec:
path: operator.yaml
- key: cluster
path: cluster.yaml
- key: release-name
path: release-name.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
10 changes: 8 additions & 2 deletions marketplace/gcp/tidb-operator/scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit f5b4285

Please sign in to comment.