Skip to content

Commit

Permalink
Add basic release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sharnoff committed Jan 11, 2023
1 parent 65d1528 commit f6838ee
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 4 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: release
on:
push:
tags:
- "{,v}*.*.*"

env:
AGENT_IMAGE: "neondatabase/autoscaler-agent"
SCHED_IMAGE: "neondatabase/autoscale-scheduler"
# pending merge of #8:
# INFORMANT_IMAGE: "neondatabase/vm-informant"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: get version and git info
id: get_vcs_info
run: |
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo -n "git_info=" >> $GITHUB_OUTPUT
bash -c "set -eu -o pipefail; source ./scripts-common.sh; git_info" >> $GITHUB_OUTPUT
- name: install golang
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true

- name: docker - install qemu
uses: docker/setup-qemu-action@v2
- name: docker - setup buildx
uses: docker/setup-buildx-action@v2
- name: login to docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}

- name: check everything builds
run: go build ./...

- name: build and push autoscale-scheduler image
uses: docker/build-push-action@v3
with:
context: .
push: true
file: build/autoscale-scheduler/Dockerfile
tags: ${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args:
- GIT_INFO=${{ setps.get_vcs_info.outputs.git_info }}
- name: build and push autoscaler-agent image
uses: docker/build-push-action@v3
with:
context: .
push: true
file: build/autoscaler-agent/Dockerfile
tags: ${{ env.SCHED_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
build-args:
- GIT_INFO=${{ setps.get_vcs_info.outputs.git_info }}
# pending merge of #8:
# - name: build and push vm-informant image
# uses: docker/build-push-action@v3
# with:
# context: .
# push: true
# file: build/vm-informant/Dockerfile
# tags: ${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
# build-args:
# - GIT_INFO=${{ setps.get_vcs_info.outputs.git_info }}
#
# # Because we want a docker image for the VM informant, the easiest way for us to also provide
# # a binary is by just extracting it from the container image itself.
# - name: extract vm-informant binary
# run: |
# mkdir bin
# # todo: do we actually need to pull here if we're pushing above?
# docker pull --quiet ${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
# ID=$(docker create ${{ env.INFORMANT_IMAGE }}:${{ steps.get_vcs_info.outputs.version }}
# docker cp $ID:/usr/bin/vm-informant bin/vm-informant
# docker rm -f $ID

- name: github release
uses: softprops/action-gh-release@v1
with:
files: |
bin/vm-informant
deploy/autoscaler-agent.yaml
deploy/autsocale-scheduler.yaml
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ discussed more in the [high-level consequences] section below.
functionality implemented here. (See: `pkg/agent`, `pkg/informant`, and `pkg/plugin`)
* `deploy/` — YAML files used during cluster init. Of these, only the following two are manually
written:
* `deploy/autoscaler-agent-deploy.yaml`
* `deploy/scheduler-deploy.yaml`
* `deploy/autoscaler-agent.yaml`
* `deploy/autoscale-scheduler.yaml`
* `kind/` — files specific to creating our [kind](https://kind.sigs.k8s.io/) cluster
* `kind/cni-bin/`[CNI plugins](https://www.cni.dev/docs/) downloaded via
[`scripts/download-cni.sh`](scripts/download-cni.sh), required for our bridge network.
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

Vertical autoscaling for a fleet of postgres instances running in a Kubernetes cluster.

## Quick access

Images are available as:

| Component name | Image name |
|----------------|------------|
| scheduler (and plugin) | `neondatabase/autoscale-scheduler` |
| autoscaler-agent | `neondatabase/autoscaler-agent` |
| VM informant | `neondatabase/vm-informant` |

The deployment files and a VM informant binary are attached to each release.

## Overview

We want to dynamically change the amount of CPUs and memory of running postgres instances, _without
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/cluster-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ kubectl apply -f deploy/neonvm.yaml | indent

kubectl wait deployment -n neonvm-system neonvm-controller --for=condition=Available=True | indent

kubectl apply -f deploy/scheduler-deploy.yaml -f deploy/autoscaler-agent-deploy.yaml | indent
kubectl apply -f deploy/autoscale-scheduler.yaml -f deploy/autoscaler-agent.yaml | indent

kubectl create secret generic vm-ssh --from-file=private-key=vm_image/ssh_id_rsa | indent

Expand Down
2 changes: 1 addition & 1 deletion scripts/replace-scheduler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ if [ -n "$pod" ]; then
kubectl delete pod -n kube-system "$pod"
fi

kubectl apply -f deploy/scheduler-deploy.yaml
kubectl apply -f deploy/autoscale-scheduler.yaml

0 comments on commit f6838ee

Please sign in to comment.