Skip to content

Commit 88d34d1

Browse files
committed
Various improvements
- ugprade CSI components - separate Helm job into its own workflow that only runs if necessary - pull the Go modules directly from the Dockerfile - add missing tools in container image
1 parent fd62d40 commit 88d34d1

10 files changed

Lines changed: 177 additions & 212 deletions

File tree

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git/
2+
.github/
3+
charts/
4+
docs/
5+
test/
6+
vendor/

.github/kiln-values.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 0 additions & 119 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Container images
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- 'charts/**'
10+
push:
11+
branches:
12+
- main
13+
paths-ignore:
14+
- 'charts/**'
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v6
25+
with:
26+
# needed for git describe --tags
27+
fetch-depth: 0
28+
- uses: docker/setup-buildx-action@v4
29+
- uses: docker/login-action@v4
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Compute tag
35+
id: tag
36+
run: echo "value=$(git describe --tags)" >> "$GITHUB_OUTPUT"
37+
- name: Build and push controller image
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
load: true
42+
push: ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
43+
tags: ghcr.io/kilnfi/carina:controller-${{ steps.tag.outputs.value }}
44+
cache-from: type=gha,scope=controller
45+
cache-to: type=gha,mode=max,scope=controller
46+
- name: Build and push scheduler image
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: ./scheduler
50+
load: true
51+
push: ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
52+
tags: ghcr.io/kilnfi/carina:scheduler-${{ steps.tag.outputs.value }}
53+
cache-from: type=gha,scope=scheduler
54+
cache-to: type=gha,mode=max,scope=scheduler
55+
# Interactive debug
56+
- name: Setup tmate session
57+
uses: mxschmitt/action-tmate@v3
58+
with:
59+
detached: true
60+
- name: Create KinD cluster
61+
if: github.ref_name != 'main'
62+
uses: helm/kind-action@v1
63+
with:
64+
cluster_name: kind
65+
- name: Test Kubernetes
66+
if: github.ref_name != 'main'
67+
run: |
68+
set -eu -o pipefail -x
69+
tag="${{ steps.tag.outputs.value }}"
70+
kind load docker-image "ghcr.io/kilnfi/carina:controller-${tag}" "ghcr.io/kilnfi/carina:scheduler-${tag}"
71+
72+
helm install --create-namespace -n carina --set carina-scheduler.tag="${tag}" --set image.carina.tag="${tag}" --hide-notes --wait carina-csi-driver charts/
73+
74+
# Create a 50G loopback device inside carina-node to simulate a disk
75+
kubectl wait pod -n carina -l app=csi-carina-node --for=condition=ready --timeout=120s
76+
kubectl exec -t -n carina -c csi-carina-node ds/csi-carina-node -- sh -c "truncate -s 50G /tmp/disk.device && losetup /dev/loop2 /tmp/disk.device && pvcreate /dev/loop2"
77+
sleep 30s
78+
79+
# Run the helm test — creates a PVC and a pod that uses carina storage.
80+
helm test -n carina --hide-notes carina-csi-driver

.github/workflows/helm.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Helm chart
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'charts/**'
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
jobs:
16+
helm:
17+
name: Push Helm chart
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
- uses: docker/login-action@v4
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Push chart
29+
run: |
30+
set -eu -o pipefail -x
31+
tag="$(git describe --tags)"
32+
sed -i -r "s/^(appV|v)ersion *:.*$/\1ersion: $tag/" charts/Chart.yaml
33+
helm package charts
34+
helm push "carina-csi-driver-${tag}.tgz" "oci://ghcr.io/kilnfi/helm-charts"

Dockerfile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
# Build the manager binary
22
FROM golang:1.26 AS builder
33

4-
ENV WORKSPACE=/workspace/github.com/carina-io/carina
5-
ENV GOMODCACHE=$WORKSPACE/vendor
4+
WORKDIR /workspace
5+
COPY go.mod go.sum ./
6+
RUN go mod download
7+
COPY . .
68

7-
WORKDIR $WORKSPACE
8-
ADD . .
9-
10-
# Build
11-
RUN echo Commit: `git log --pretty='%s%b%B' -n 1`
12-
RUN cd $WORKSPACE/cmd/carina-node && CGO_ENABLED=0 go build -ldflags="-X main.gitCommitID=`git rev-parse HEAD`" -gcflags '-N -l' -o /tmp/carina-node .
13-
RUN cd $WORKSPACE/cmd/carina-controller && CGO_ENABLED=0 go build -ldflags="-X main.gitCommitID=`git rev-parse HEAD`" -gcflags '-N -l' -o /tmp/carina-controller .
9+
RUN cd cmd/carina-node && CGO_ENABLED=0 go build -o /tmp/carina-node .
10+
RUN cd cmd/carina-controller && CGO_ENABLED=0 go build -o /tmp/carina-controller .
1411

1512
FROM alpine:3.20
1613

17-
RUN apk add --no-cache lvm2 device-mapper e2fsprogs xfsprogs util-linux parted
14+
RUN apk add --no-cache bash bcache-tools device-mapper e2fsprogs eudev lvm2 parted thin-provisioning-tools util-linux xfsprogs
1815

1916
COPY --from=builder /tmp/carina-node /usr/bin/
2017
COPY --from=builder /tmp/carina-controller /usr/bin/
21-
COPY --from=builder /workspace/github.com/carina-io/carina/debug/hack/config.json /etc/carina/
18+
COPY --from=builder /workspace/debug/hack/config.json /etc/carina/
2219

23-
CMD ["echo", "carina-node", "carina-controller"]
20+
CMD ["carina-controller"]

charts/values.yaml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
carina-scheduler:
22
enabled: true
33
image:
4-
repository: registry.cn-hangzhou.aliyuncs.com/carina/carina-scheduler
5-
pullPolicy: IfNotPresent
4+
repository: ghcr.io/kilnfi/carina
65
# Overrides the image tag whose default is the chart appVersion.
7-
tag: "v0.11.0"
6+
tag: ""
7+
pullPolicy: IfNotPresent
88
# Default values for carina-csi-driver.
99
# This is a YAML-formatted file.
1010
# Declare variables to be passed into your templates.
1111
image:
12-
baseRepo: registry.cn-hangzhou.aliyuncs.com/carina
1312
carina:
14-
repository: /carina
15-
tag: v0.11.0
13+
repository: ghcr.io/kilnfi/carina
14+
tag: ""
1615
pullPolicy: IfNotPresent
1716
livenessProbe:
18-
repository: /livenessprobe
19-
tag: v2.7.0
17+
repository: registry.k8s.io/sig-storage/livenessprobe
18+
tag: v2.18.0
2019
pullPolicy: IfNotPresent
2120
csiProvisioner:
22-
repository: /csi-provisioner
23-
tag: v2.2.2
21+
repository: registry.k8s.io/sig-storage/csi-provisioner
22+
tag: v6.2.0
2423
pullPolicy: IfNotPresent
2524
csiResizer:
26-
repository: /csi-resizer
27-
tag: v1.5.0
25+
repository: registry.k8s.io/sig-storage/csi-resizer
26+
tag: v2.1.0
2827
pullPolicy: IfNotPresent
2928
nodeDriverRegistrar:
30-
repository: /csi-node-driver-registrar
31-
tag: v2.5.1
29+
repository: registry.k8s.io/sig-storage/csi-node-driver-registrar
30+
tag: v2.16.0
3231
pullPolicy: IfNotPresent
3332
nodeInitImage:
34-
repository: /busybox
35-
tag: "1.28"
33+
repository: busybox
34+
tag: stable
3635
pullPolicy: IfNotPresent
3736

3837
serviceAccount:

0 commit comments

Comments
 (0)