Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Helm chart package #843

Merged
merged 3 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 64 additions & 10 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,76 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
env:
REPOSITORY_URL: ghcr.io
SPARKMAGIC_IMAGE_NAME: ${{ github.repository }}/jupyter:latest
SPARKMAGIC_DOCKERFILE: Dockerfile.jupyter
JUPYTER_IMAGE_NAME: ${{ github.repository }}/sparkmagic-livy:latest
JUPYTER_DOCKERFILE: Dockerfile.spark
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- if: github.event_name == 'push'
name: Run docker compose build with local packages
run: |
docker compose build --build-arg dev_mode="true"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REPOSITORY_URL }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- if: github.event_name == 'schedule'
name: Run docker compose build with latest release
run: |
docker compose build
- name: Build and push with latest release - SparkMagic
uses: docker/build-push-action@v5
if: github.event_name == 'schedule'
with:
context: .
file: ${{ env.JUPYTER_DOCKERFILE }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REPOSITORY_URL }}/${{ env.SPARKMAGIC_IMAGE_NAME }}

- name: Build and push with latest release - Jupyter
uses: docker/build-push-action@v5
if: github.event_name == 'schedule'
with:
context: .
file: ${{ env.JUPYTER_DOCKERFILE }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REPOSITORY_URL }}/${{ env.JUPYTER_IMAGE_NAME }}

- name: Build and push with local packages - SparkMagic
uses: docker/build-push-action@v5
if: github.event_name == 'push'
with:
context: .
file: ${{ env.JUPYTER_DOCKERFILE }}
platforms: linux/amd64,linux/arm64
push: true
build-args: |
dev_mode="true"
tags: |
${{ env.REPOSITORY_URL }}/${{ env.SPARKMAGIC_IMAGE_NAME }}

- name: Build and push with local packages - Jupyter
uses: docker/build-push-action@v5
if: github.event_name == 'push'
with:
context: .
file: ${{ env.JUPYTER_DOCKERFILE }}
platforms: linux/amd64,linux/arm64
push: true
build-args: |
dev_mode="true"
tags: |
${{ env.REPOSITORY_URL }}/${{ env.JUPYTER_IMAGE_NAME }}
4 changes: 2 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

1. Make sure `CHANGELOG.md` is up-to-date with all changes since last release.
2. Update versions in all three sub-package's `__init__.py` files.
3. Create a new release on `master` branch with https://github.com/jupyter-incubator/sparkmagic/releases/new — Tag format is "0.15.0", no "v" prefix.

3. Update `appVersion` in [Chart.yaml](helm/Chart.yaml)
4. Create a new release on `master` branch with https://github.com/jupyter-incubator/sparkmagic/releases/new — Tag format is "0.15.0", no "v" prefix.
25 changes: 25 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v2
name: sparkmagic
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.21.0"
Binary file added helm/charts/sparkmagic-0.1.0.tgz
Binary file not shown.
22 changes: 22 additions & 0 deletions helm/templates/jupyter-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter-notebook
spec:
replicas: {{ .Values.sparkmagic.replicas }}
selector:
matchLabels:
app: jupyter-notebook
template:
metadata:
labels:
app: jupyter-notebook
spec:
containers:
- name: jupyter-notebook
image: "{{ .Values.jupyter.image.repository }}:{{ .Values.jupyter.image.tag }}"
ports:
- name: http
containerPort: {{ .Values.jupyter.service.port }}
protocol: TCP
13 changes: 13 additions & 0 deletions helm/templates/jupyter-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: jupyter-notebook
spec:
selector:
app: jupyter-notebook
ports:
- protocol: TCP
port: {{ .Values.jupyter.service.port }}
targetPort: {{ .Values.jupyter.service.port }}
type: LoadBalancer
22 changes: 22 additions & 0 deletions helm/templates/sparkmagic-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sparkmagic
spec:
replicas: {{ .Values.sparkmagic.replicas }}
selector:
matchLabels:
app: sparkmagic
template:
metadata:
labels:
app: sparkmagic
spec:
containers:
- name: sparkmagic
image: "{{ .Values.sparkmagic.image.repository }}:{{ .Values.sparkmagic.image.tag }}"
ports:
- name: http
containerPort: {{ .Values.sparkmagic.service.port }}
protocol: TCP
13 changes: 13 additions & 0 deletions helm/templates/sparkmagic-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: sparkmagic
spec:
selector:
app: sparkmagic
ports:
- protocol: TCP
port: {{ .Values.sparkmagic.service.port }}
targetPort: {{ .Values.sparkmagic.service.port }}
type: LoadBalancer
15 changes: 15 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
jupyter:
replicas: 1
image:
repository: ghcr.io/ljubon/sparkmagic/jupyter
tag: latest
service:
port: 8888

sparkmagic:
image:
repository: ghcr.io/ljubon/sparkmagic/sparkmagic-livy
tag: latest
service:
port: 8998