1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

Added helm support to release

This commit is contained in:
Ewout Prangsma 2018-08-20 16:25:07 +02:00
parent faa419987d
commit 0b141fb014
No known key found for this signature in database
GPG key ID: 4DBAD380D93D0698
3 changed files with 61 additions and 1 deletions

View file

@ -34,7 +34,17 @@ it is intended to be.
| Minikube | 1.10 | >= 3.3.13 | Runs | Not intended |
| Docker for Mac Edge | 1.10 | >= 3.3.13 | Runs | Not intended |
## Installation of latest release
## Installation of latest release using Helm
```bash
# The following will install the operator for `ArangoDeployment` &
# `ArangoDeplomentReplication` resources.
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb.tgz
# To use `ArangoLocalStorage`, also run
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb-storage.tgz
```
## Installation of latest release using Kubectl
```bash
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.2.2/manifests/crd.yaml

View file

@ -15,3 +15,6 @@ sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-aran
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment.yaml@g" -i "" $f
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment-replication.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment-replication.yaml@g" -i "" $f
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-storage.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-storage.yaml@g" -i "" $f
sed -e "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb.tgz@g" -i "" $f
sed -e "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb-storage.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-storage.tgz@g" -i "" $f

View file

@ -23,6 +23,8 @@
package main
import (
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
@ -41,6 +43,12 @@ var (
ghRelease string // Full path of github-release tool
ghUser string // Github account name to create release in
ghRepo string // Github repository name to create release in
binFolder string // Folder containing binaries
binaries = map[string]string{
"kube-arangodb.tgz": "charts/kube-arangodb.tgz",
"kube-arangodb-storage.tgz": "charts/kube-arangodb-storage.tgz",
}
)
func init() {
@ -49,6 +57,7 @@ func init() {
flag.StringVar(&ghRelease, "github-release", ".gobuild/bin/github-release", "Full path of github-release tool")
flag.StringVar(&ghUser, "github-user", "arangodb", "Github account name to create release in")
flag.StringVar(&ghRepo, "github-repo", "kube-arangodb", "Github repository name to create release in")
flag.StringVar(&binFolder, "bin-folder", "./bin", "Folder containing binaries")
}
func main() {
@ -65,6 +74,7 @@ func main() {
})
make("patch-readme", nil)
make("build-ghrelease", nil)
createSHA256Sums()
gitCommitAll(fmt.Sprintf("Updated manifest to %s", version)) // Commit manifest
gitTag(version)
make("changelog", nil)
@ -155,6 +165,23 @@ func gitTag(version string) {
}
}
func createSHA256Sums() {
sums := []string{}
for name, p := range binaries {
blob, err := ioutil.ReadFile(filepath.Join(binFolder, p))
if err != nil {
log.Fatalf("Failed to read binary '%s': %#v\n", name, err)
}
bytes := sha256.Sum256(blob)
sha := hex.EncodeToString(bytes[:])
sums = append(sums, sha+" "+name)
}
sumsPath := filepath.Join(binFolder, "SHA256SUMS")
if err := ioutil.WriteFile(sumsPath, []byte(strings.Join(sums, "\n")+"\n"), 0644); err != nil {
log.Fatalf("Failed to write '%s': %#v\n", sumsPath, err)
}
}
func githubCreateRelease(version string) {
// Create draft release
args := []string{
@ -167,6 +194,26 @@ func githubCreateRelease(version string) {
if err := run(ghRelease, args, nil); err != nil {
log.Fatalf("Failed to create github release: %v\n", err)
}
// Upload binaries
assets := map[string]string{
"SHA256SUMS": "SHA256SUMS",
}
for k, v := range binaries {
assets[k] = v
}
for name, file := range assets {
args := []string{
"upload",
"--user", ghUser,
"--repo", ghRepo,
"--tag", version,
"--name", name,
"--file", filepath.Join(binFolder, file),
}
if err := run(ghRelease, args, nil); err != nil {
log.Fatalf("Failed to upload asset '%s': %v\n", name, err)
}
}
// Finalize release
args = []string{
"edit",