Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Fix installer (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha authored Apr 28, 2018
1 parent 6048782 commit 3a03f4b
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 12 deletions.
2 changes: 1 addition & 1 deletion chart/swift/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: 'swift by AppsCode - Ajax friendly Helm Tiller Proxy'
name: swift
version: 0.6.0
version: 0.7.0
appVersion: 0.8.0
home: https://github.com/appscode/swift
icon: https://cdn.appscode.com/images/icon/swift.png
Expand Down
7 changes: 5 additions & 2 deletions chart/swift/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# swift
[swift by AppsCode](https://github.com/appscode/swift) - Ajax friendly Helm Tiller Proxy

## TL;DR;

```console
Expand Down Expand Up @@ -45,15 +46,17 @@ The following tables lists the configurable parameters of the swift chart and th
| Parameter | Description | Default |
| --------------------------| --------------------------------------------------------------| -----------------|
| `replicaCount` | Number of swift replicas to create (only 1 is supported) | `1` |
| `swift.image` | swift container image | `appscode/swift` |
| `swift.tag` | swift container image tag | `0.8.0` |
| `swift.registry` | Docker registry used to pull Swift image | `appscode` |
| `swift.repository` | Swift container image | `swift` |
| `swift.tag` | Swift container image tag | `0.8.0` |
| `imagePullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `logLevel` | Log level for proxy | `3` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `rbac.create` | If `true`, create and use RBAC resources | `true` |
| `serviceAccount.create` | If `true`, create a new service account | `true` |
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | `` |
| `enableAnalytics` | Send usage events to Google Analytics | `true` |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:
Expand Down
9 changes: 5 additions & 4 deletions chart/swift/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "swift.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: "{{ template "swift.name" . }}"
Expand All @@ -17,18 +18,18 @@ spec:
spec:
serviceAccountName: {{ template "swift.serviceAccountName" . }}
containers:
- args:
- name: swift
image: {{ .Values.swift.registry }}/{{ .Values.swift.repository }}:{{ .Values.swift.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- run
- --v={{ .Values.logLevel }}
- --connector=incluster
- --tiller-insecure-skip-verify=true
image: {{ .Values.swift.image }}:{{ .Values.swift.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
name: swift
ports:
- containerPort: 9855
name: pt
Expand Down
1 change: 1 addition & 0 deletions chart/swift/templates/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "swift.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: "{{ template "swift.name" . }}"
Expand Down
1 change: 1 addition & 0 deletions chart/swift/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "swift.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: "{{ template "swift.name" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Expand Down
6 changes: 5 additions & 1 deletion chart/swift/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Declare variables to be passed into your templates.
replicaCount: 1
swift:
image: appscode/swift
registry: appscode
repository: swift
tag: 0.8.0
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
Expand Down Expand Up @@ -33,3 +34,6 @@ serviceAccount:
# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name:

# Send usage events to Google Analytics
enableAnalytics: true
1 change: 1 addition & 0 deletions docs/setup/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ options:
--docker-registry docker registry used to pull swift images (default: appscode)
--image-pull-secret name of secret used to pull swift operator images
--run-on-master run swift operator on master
--enable-analytics send usage events to Google Analytics (default: true)
--uninstall uninstall swift
```

Expand Down
5 changes: 3 additions & 2 deletions hack/deploy/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ spec:
imagePullSecrets: [${SWIFT_IMAGE_PULL_SECRET}]
containers:
- name: swift
image: ${SWIFT_DOCKER_REGISTRY}/swift:0.8.0
imagePullPolicy: IfNotPresent
image: ${SWIFT_DOCKER_REGISTRY}/swift:${SWIFT_SERVER_TAG}
imagePullPolicy: ${SWIFT_IMAGE_PULL_POLICY}
args:
- run
- --v=3
- --connector=incluster
- --tiller-insecure-skip-verify=true
- --enable-analytics=${SWIFT_ENABLE_ANALYTICS}
ports:
- containerPort: 9855
- containerPort: 50055
Expand Down
49 changes: 48 additions & 1 deletion hack/deploy/swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,48 @@ function cleanup {
}
trap cleanup EXIT

# ref: https://github.com/appscodelabs/libbuild/blob/master/common/lib.sh#L55
inside_git_repo() {
git rev-parse --is-inside-work-tree > /dev/null 2>&1
inside_git=$?
if [ "$inside_git" -ne 0 ]; then
echo "Not inside a git repository"
exit 1
fi
}

detect_tag() {
inside_git_repo

# http://stackoverflow.com/a/1404862/3476121
git_tag=$(git describe --exact-match --abbrev=0 2>/dev/null || echo '')

commit_hash=$(git rev-parse --verify HEAD)
git_branch=$(git rev-parse --abbrev-ref HEAD)
commit_timestamp=$(git show -s --format=%ct)

if [ "$git_tag" != '' ]; then
TAG=$git_tag
TAG_STRATEGY='git_tag'
elif [ "$git_branch" != 'master' ] && [ "$git_branch" != 'HEAD' ] && [[ "$git_branch" != release-* ]]; then
TAG=$git_branch
TAG_STRATEGY='git_branch'
else
hash_ver=$(git describe --tags --always --dirty)
TAG="${hash_ver}"
TAG_STRATEGY='commit_hash'
fi

export TAG
export TAG_STRATEGY
export git_tag
export git_branch
export commit_hash
export commit_timestamp
}

# https://stackoverflow.com/a/677212/244009
if [ -x "$(command -v onessl >/dev/null 2>&1)" ]; then
if [ -x "$(command -v onessl)" ]; then
export ONESSL=onessl
else
# ref: https://stackoverflow.com/a/27776822/244009
Expand Down Expand Up @@ -49,13 +89,19 @@ export SWIFT_SERVICE_ACCOUNT=swift
export SWIFT_ENABLE_RBAC=true
export SWIFT_RUN_ON_MASTER=0
export SWIFT_DOCKER_REGISTRY=appscode
export SWIFT_SERVER_TAG=0.8.0
export SWIFT_IMAGE_PULL_SECRET=
export SWIFT_IMAGE_PULL_POLICY=IfNotPresent
export SWIFT_ENABLE_ANALYTICS=true
export SWIFT_UNINSTALL=0

export APPSCODE_ENV=${APPSCODE_ENV:-prod}
export SCRIPT_LOCATION="curl -fsSL https://raw.githubusercontent.com/appscode/swift/0.8.0/"
if [ "$APPSCODE_ENV" = "dev" ]; then
detect_tag
export SCRIPT_LOCATION="cat "
export SWIFT_SERVER_TAG=$TAG
export SWIFT_IMAGE_PULL_POLICY=Always
fi

show_help() {
Expand All @@ -70,6 +116,7 @@ show_help() {
echo " --docker-registry docker registry used to pull swift images (default: appscode)"
echo " --image-pull-secret name of secret used to pull swift docker images"
echo " --run-on-master run swift operator on master"
echo " --enable-analytics send usage events to Google Analytics (default: true)"
echo " --uninstall uninstall swift"
}

Expand Down
2 changes: 1 addition & 1 deletion hack/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def check_antipackage():

# Debian package
# https://gist.github.com/rcrowley/3728417
libbuild.REPO_ROOT = expandvars('$GOPATH') + '/src/github.com/appscode/swift'
libbuild.REPO_ROOT = libbuild.GOPATH + '/src/github.com/appscode/swift'
BUILD_METADATA = libbuild.metadata(libbuild.REPO_ROOT)
libbuild.BIN_MATRIX = {
'swift': {
Expand Down

0 comments on commit 3a03f4b

Please sign in to comment.