Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 18 additions & 8 deletions .github/workflows/cover.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
name: "Unit/Coverage Tests"

on: pull_request_target
on:
push:
pull_request:

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version-file: go.mod
cache: true

- name: Run unit tests and coverage test
id: test-coverage
run: |
go test -cover ./... -v > output.txt
set +e
go test -coverprofile=coverage.out -cover ./... -v > output.txt 2>&1
status=$?
cat output.txt
exit "$status"

- name: Transform output
id: results
if: always()
run: |
if [[ ! -f output.txt ]]; then
echo "No test output was produced." > output.txt
fi
CONTENT=$(cat output.txt)
CONTENT="${CONTENT//'%'/'%25'}"
CONTENT="${CONTENT//$'\n'/'%0A'}"
CONTENT="${CONTENT//$'\r'/'%0D'}"
echo content=$CONTENT >> $GITHUB_OUTPUT

- name: Add Comment
uses: actions/github-script@v5
if: always()
- name: Add PR Comment
uses: actions/github-script@v7
if: always() && github.event_name == 'pull_request'
with:
script: |
const output = `### Unit Tests and Coverage
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/go-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ on:
pull_request:

jobs:
Golangci-Lint:
go:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache: true

- name: Check formatting
run: test -z "$(gofmt -l .)"

- name: Install dependencies
run: |
go version
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.1
- name: Run go vet
run: go vet ./...

- name: Run golangci-lint
run: |
golangci-lint run cmd/...
golangci-lint run spec/...
- name: Run tests
run: go test ./...
40 changes: 11 additions & 29 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
name: Lint and Test Charts

on: pull_request_target
on:
push:
pull_request:

jobs:
lint-test:
helm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.2

- uses: actions/setup-python@v2
uses: azure/setup-helm@v4
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo changed=true >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint
version: v4.1.0

- name: Create kind cluster
uses: helm/kind-action@v1.2.0
if: steps.list-changed.outputs.changed == 'true'
- name: Lint chart
run: helm lint ./helm/slik -f ./helm/slik/values.yaml

- name: Run chart-testing (install)
run: ct install
- name: Render chart
run: helm template slik ./helm/slik -f ./helm/slik/values.yaml --kube-version 1.36.0
16 changes: 11 additions & 5 deletions .github/workflows/notify-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ jobs:
runs-on: ubuntu-latest
name: New Issue Notification
steps:
- run: |
echo "{\"text\":\"slik : New Issue https://github.com/vultr/slik/issues/${{ github.event.issue.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
- name: Send Mattermost notification
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
run: |
if [ -z "${MATTERMOST_WEBHOOK_URL}" ]; then
echo "MATTERMOST_WEBHOOK_URL is not configured; skipping notification."
exit 0
fi

curl --fail --silent --show-error --output /dev/null \
-H 'Content-Type: application/json' \
-d '{"text":"slik : New Issue https://github.com/vultr/slik/issues/${{ github.event.issue.number }} "}' \
"${MATTERMOST_WEBHOOK_URL}"
18 changes: 12 additions & 6 deletions .github/workflows/notify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ jobs:
runs-on: ubuntu-latest
name: Pull Request Notification
steps:
- run: |
echo "{\"text\":\"slik : PR https://github.com/vultr/slik/pull/${{ github.event.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
with:
- name: Send Mattermost notification
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
run: |
if [ -z "${MATTERMOST_WEBHOOK_URL}" ]; then
echo "MATTERMOST_WEBHOOK_URL is not configured; skipping notification."
exit 0
fi

curl --fail --silent --show-error --output /dev/null \
-H 'Content-Type: application/json' \
-d '{"text":"slik : PR https://github.com/vultr/slik/pull/${{ github.event.number }} "}' \
"${MATTERMOST_WEBHOOK_URL}"
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand All @@ -48,14 +48,15 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
cache: true

- name: Docker Login
env:
Expand Down Expand Up @@ -84,7 +85,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down Expand Up @@ -112,7 +113,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down Expand Up @@ -140,7 +141,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down Expand Up @@ -168,7 +169,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down Expand Up @@ -196,7 +197,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down Expand Up @@ -224,7 +225,7 @@ jobs:
runs-on: ubuntu-latest
needs: create-tag
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
main
/dist
/dist
/vendor
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
## Overview
An operator to deploy slurm in kubernetes.

Note: This project has been archived in favor of the [Slinky](https://github.com/SlinkyProject) project.
Note: This project has been archived in favor of the [Slinky](https://github.com/SlinkyProject) project.

## Requirements
- Kubernetes v1.28+ with `Sidecarcontainers` feature gate enabled( Enabled by default in v1.29 )
- Kubernetes v1.36+.
- Go 1.26+ if building from source.

## Usage
Everything is public, including the slurm images. You do not need any auth or secret sauce to use this. If you intend to use in a different cloud platform you may need to make tweaks to the mariadb statefulset. If you intend to deploy slurm on arm you'll need to build arm images.
Everything is public, including the Slurm images. You do not need any auth or secret sauce to use this. If you intend to use a different cloud platform you may need to tweak the MariaDB storage class. If you intend to deploy Slurm on ARM, you'll need to build ARM images.

You can deploy slik into your kubernetes cluster simply with: `helm install -f helm/slik/values.yaml slik ./helm/slik/`

You can then deploy a slurm cluster with one of the samples: `kubectl apply -f payloads/simple.yaml`

For a complete walkthrough, see [Deploying SLiK](docs/deployment.md).

If you deploy "full" slurm cluster (with database) it can take awhile to initialize MariaDB.

You then interact with the slurm cluster through the toolbox pod: `kubectl exec --it toolbox -- bash`
You then interact with the Slurm cluster through the toolbox pod: `kubectl exec -n default -it deploy/test-slurm-toolbox -- bash`

Sample yaml:

Expand Down
3 changes: 2 additions & 1 deletion cmd/slik/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package config

import (
"errors"
"flag"
"fmt"
"net"
Expand Down Expand Up @@ -217,7 +218,7 @@ func mainIP() (string, error) {

localAddr, ok := conn.LocalAddr().(*net.UDPAddr)
if !ok {
return "", err
return "", errors.New("local address is not UDP")
}

return localAddr.IP.String(), nil
Expand Down
8 changes: 2 additions & 6 deletions cmd/slik/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ func main() { //nolint

// Used for clean shutdown, catches signals
ctx, cancel := context.WithCancel(context.Background())
go func() {
counter := 0
for {
helpers.Signals(cancel, &counter)
}
}()
counter := 0
go helpers.Signals(cancel, &counter)

g, gCtx := errgroup.WithContext(ctx)

Expand Down
3 changes: 2 additions & 1 deletion cmd/slurmabler/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package config

import (
"errors"
"flag"
"fmt"
"net"
Expand Down Expand Up @@ -127,7 +128,7 @@ func mainIP() (string, error) {

localAddr, ok := conn.LocalAddr().(*net.UDPAddr)
if !ok {
return "", err
return "", errors.New("local address is not UDP")
}

return localAddr.IP.String(), nil
Expand Down
4 changes: 4 additions & 0 deletions cmd/slurmabler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func main() { //nolint
}

labels := node.GetLabels()
if labels == nil {
labels = map[string]string{}
}

labels["slik.vultr.com/nodename"] = labeler.NodeName
labels["slik.vultr.com/cpus"] = fmt.Sprintf("%d", labeler.CPUs)
labels["slik.vultr.com/boards"] = fmt.Sprintf("%d", labeler.Boards)
Expand Down
4 changes: 2 additions & 2 deletions crds/v1/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
properties:
storage_size:
type: string
default: 40G
default: 50G
pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
storage_class:
type: string
Expand All @@ -58,4 +58,4 @@ spec:
singular: slik
kind: Slik
shortNames:
- slik
- slik
Loading
Loading