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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ name: Build

on:
push:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

env:
IMG_REGISTRY: ghcr.io/slyngdk/
Expand All @@ -18,13 +33,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/main' || (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v'))
if: github.ref_protected
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -40,11 +50,12 @@ jobs:
elif [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
export IMG_TAG=$(echo -n "${{ github.ref_name }}" | sed 's/^v//g')
fi
export IMG_TAG=${IMG_TAG//\//-}
echo "IMG_TAG=${IMG_TAG}" >> $GITHUB_OUTPUT
make docker-build

- name: Push image
if: github.ref == 'refs/heads/main' || (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v'))
if: github.ref_protected
env:
IMG_TAG: ${{ steps.build_image.outputs.IMG_TAG }}
run: |
Expand All @@ -71,7 +82,7 @@ jobs:
run: helm version

- name: Login to GitHub Container Registry
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
if: github.ref_protected
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ name: Lint

on:
push:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

jobs:
golangci-lint:
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/test-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@ name: Test Chart

on:
push:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

env:
IMG_REGISTRY: ghcr.io/slyngdk/
IMG_NAME_CONTROLLER: nodedrain-controller
IMG_NAME_EXAM_PLUGIN: nodedrain-example-plugin
IMG_TAG: test-chart
KIND_CLUSTER_NAME: nodedrain-test-chart

jobs:
test-chart:
Expand All @@ -26,13 +47,15 @@ jobs:
run: kind version

- name: Create kind cluster
run: kind create cluster
run: |
kind delete cluster
kind create cluster

- name: Prepare nodedrain
run: |
go mod tidy
make docker-build IMG_NAME_CONTROLLER=nodedrain IMG_TAG=v0.1.0
kind load docker-image IMG_NAME_CONTROLLER=nodedrain IMG_TAG=v0.1.0
make docker-build
kind load docker-image ${IMG_REGISTRY}${IMG_NAME_CONTROLLER}:${IMG_TAG}

- name: Install Helm
run: |
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ name: E2E Tests

on:
push:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

jobs:
test-e2e:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ name: Tests

on:
push:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions internal/controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (r *nodeReconciler) SetupWithManager(mgr ctrl.Manager) error {
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/reconcile
// nolint:gocyclo
func (r *nodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
l := r.l.With(zap.String("node.name", req.Name))
l.Debug("node reconcile")
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/reboot-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (r *RebootManager) IsNodeRebooted(ctx context.Context, kubeNode *corev1.Nod
if config.GetConfig().ContainerNode {
r.l.Info("Node was not rebooted, because running on containers", zap.String("node.name", kubeNode.Name))
pod := r.rebootRequiredPod(kubeNode.Name)
pod.ObjectMeta.GenerateName = "reboot-required-remove-"
pod.GenerateName = "reboot-required-remove-"
pod.Spec.Containers[0].Command = []string{"rm", "-f", "/host/var/run/reboot-required"}
pod.Spec.Containers[0].VolumeMounts[0].ReadOnly = false
pod.Spec.SecurityContext.RunAsUser = PtrTo(int64(0))
Expand Down
Loading