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
16 changes: 8 additions & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: 1.26.3
go-version: 1.26.4
- name: Build
run: make build
- name: FMT
Expand All @@ -33,11 +33,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: 1.26.3
go-version: 1.26.4
- name: ut
run: make test
env:
Expand All @@ -46,11 +46,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: 1.26.3
go-version: 1.26.4
- name: fv
run: make create-cluster fv
env:
Expand All @@ -59,11 +59,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: 1.26.3
go-version: 1.26.4
- name: fv
run: make create-cluster-infra fv-namespace
env:
Expand Down
12 changes: 6 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ linters:
- goconst
- gocritic
- gocyclo
- gomodguard
- gomodguard_v2
- goprintffuncname
- gosec
- govet
Expand Down Expand Up @@ -72,12 +72,10 @@ linters:
- style
gocyclo:
min-complexity: 20
gomodguard:
gomodguard_v2:
blocked:
modules:
- k8s.io/kubernetes:
reason: There is no good, avoidable reason to use this package and often leads to issues such as https://bit.ly/3dlKScY. However, if you disagree please include @ravchama in code review highlighting the reason.
local-replace-directives: true
- module: k8s.io/kubernetes
local-replace-directives: true
govet:
settings:
printf:
Expand Down Expand Up @@ -132,6 +130,7 @@ linters:
- third_party$
- builtin$
- examples$
- internal/test/helpers
issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand All @@ -149,3 +148,4 @@ formatters:
- third_party$
- builtin$
- examples$
- internal/test/helpers
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.26.3 AS builder
FROM golang:1.26.4 AS builder

ARG BUILDOS
ARG TARGETARCH
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# KUBEBUILDER_ENVTEST_KUBERNETES_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
KUBEBUILDER_ENVTEST_KUBERNETES_VERSION = 1.35.0
KUBEBUILDER_ENVTEST_KUBERNETES_VERSION = 1.36.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -36,7 +36,7 @@ ARCH ?= amd64
OS ?= $(shell uname -s | tr A-Z a-z)
K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= main
TAG ?= v1.11.0

## Tool Binaries
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
Expand All @@ -49,7 +49,7 @@ KIND := $(TOOLS_BIN_DIR)/kind
KUBECTL := $(TOOLS_BIN_DIR)/kubectl
CLUSTERCTL := $(TOOLS_BIN_DIR)/clusterctl

GOLANGCI_LINT_VERSION := "v2.11.4"
GOLANGCI_LINT_VERSION := "v2.12.1"
CLUSTERCTL_VERSION := v1.13.2

KUSTOMIZE_VER := v5.8.0
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: docker.io/projectsveltos/shard-controller:main
- image: docker.io/projectsveltos/shard-controller:v1.11.0
name: manager
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/projectsveltos/shard-controller

go 1.26.3
go 1.26.4

require (
github.com/TwiN/go-color v1.4.1
Expand Down
22 changes: 20 additions & 2 deletions hack/tools/get-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,23 @@

set -euo pipefail

# Define the URL for downloading the golangci-lint archive
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(pwd)/bin "$1"
VERSION="$1"
BINARY="$(pwd)/bin/golangci-lint"

# Skip download if the binary already exists at the requested version.
if [[ -x "$BINARY" ]] && "$BINARY" --version 2>/dev/null | grep -qF "${VERSION#v}"; then
echo "golangci-lint ${VERSION} already installed, skipping download"
exit 0
fi

# Retry up to 3 times — the GitHub CDN occasionally returns 504.
for attempt in 1 2 3; do
if curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b "$(pwd)/bin" "$VERSION"; then
exit 0
fi
echo "golangci-lint download attempt ${attempt} failed, retrying..." >&2
sleep $((attempt * 5))
done

echo "golangci-lint download failed after 3 attempts" >&2
exit 1
2 changes: 1 addition & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/projectsveltos/addon-controller/hack/tools

go 1.26.3
go 1.26.4

require (
github.com/a8m/envsubst v1.4.3
Expand Down
8 changes: 6 additions & 2 deletions internal/controller/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ var _ = Describe("Utils", func() {
})

Context("applyShardPatches", func() {
const (
patchValue = `[{"op":"add","path":"/metadata/labels/injected","value":"yes"}]`
)

It("returns original bytes unchanged when patches is empty", func() {
original := []byte(fmt.Sprintf(nginxDeploymentTemplate, sveltosNamespace))
result, err := controller.ApplyShardPatches(original, nil, logger)
Expand All @@ -695,7 +699,7 @@ var _ = Describe("Utils", func() {
deployYAML := []byte(fmt.Sprintf(nginxDeploymentTemplate, sveltosNamespace))
patches := []libsveltosv1beta1.Patch{
{
Patch: `[{"op":"add","path":"/metadata/labels/injected","value":"yes"}]`,
Patch: patchValue,
Target: &libsveltosv1beta1.PatchSelector{Group: "apps", Kind: "Deployment"},
},
}
Expand All @@ -710,7 +714,7 @@ var _ = Describe("Utils", func() {
deployYAML := []byte(fmt.Sprintf(nginxDeploymentTemplate, sveltosNamespace))
patches := []libsveltosv1beta1.Patch{
{
Patch: `[{"op":"add","path":"/metadata/labels/injected","value":"yes"}]`,
Patch: patchValue,
Target: &libsveltosv1beta1.PatchSelector{Group: "", Kind: "ConfigMap"},
},
}
Expand Down
2 changes: 1 addition & 1 deletion manifest/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/shard-controller:main
image: docker.io/projectsveltos/shard-controller:v1.11.0
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
6 changes: 3 additions & 3 deletions pkg/sharding/ac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -43,7 +43,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/addon-controller@sha256:01ceda7b6986c59c5ca397b9115e625d9258f79b50d03f0e9d62f8f76a899d9a
image: docker.io/projectsveltos/addon-controller@sha256:3c0f4d627509c94a46673a7e08d46dd732fcacef86693c5f88d417fa0b7221eb
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down Expand Up @@ -101,7 +101,7 @@ spec:
fieldPath: metadata.namespace
- name: IS_INITIALIZATION
value: "true"
image: docker.io/projectsveltos/addon-controller@sha256:01ceda7b6986c59c5ca397b9115e625d9258f79b50d03f0e9d62f8f76a899d9a
image: docker.io/projectsveltos/addon-controller@sha256:3c0f4d627509c94a46673a7e08d46dd732fcacef86693c5f88d417fa0b7221eb
name: initialization
securityContext:
allowPrivilegeEscalation: false
Expand Down
6 changes: 3 additions & 3 deletions pkg/sharding/addon-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -61,7 +61,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/addon-controller@sha256:01ceda7b6986c59c5ca397b9115e625d9258f79b50d03f0e9d62f8f76a899d9a
image: docker.io/projectsveltos/addon-controller@sha256:3c0f4d627509c94a46673a7e08d46dd732fcacef86693c5f88d417fa0b7221eb
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down Expand Up @@ -119,7 +119,7 @@ spec:
fieldPath: metadata.namespace
- name: IS_INITIALIZATION
value: "true"
image: docker.io/projectsveltos/addon-controller@sha256:01ceda7b6986c59c5ca397b9115e625d9258f79b50d03f0e9d62f8f76a899d9a
image: docker.io/projectsveltos/addon-controller@sha256:3c0f4d627509c94a46673a7e08d46dd732fcacef86693c5f88d417fa0b7221eb
name: initialization
securityContext:
allowPrivilegeEscalation: false
Expand Down
6 changes: 3 additions & 3 deletions pkg/sharding/classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --registry=
- --agent-in-mgmt-cluster=false
command:
Expand All @@ -60,7 +60,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/classifier@sha256:e835c4736a93940ee80b0e5e84e02429ed6c8bb01d6eced6854602c571755943
image: docker.io/projectsveltos/classifier@sha256:563ac03890e60902ef251d0fa5aefb82918cadf9b1fb186e29109efbdfe0e976
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -108,7 +108,7 @@ spec:
fieldPath: metadata.namespace
- name: IS_INITIALIZATION
value: "true"
image: docker.io/projectsveltos/classifier@sha256:e835c4736a93940ee80b0e5e84e02429ed6c8bb01d6eced6854602c571755943
image: docker.io/projectsveltos/classifier@sha256:563ac03890e60902ef251d0fa5aefb82918cadf9b1fb186e29109efbdfe0e976
imagePullPolicy: IfNotPresent
name: migrate
resources:
Expand Down
6 changes: 3 additions & 3 deletions pkg/sharding/classifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --registry=
- --agent-in-mgmt-cluster=false
command:
Expand All @@ -42,7 +42,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/classifier@sha256:e835c4736a93940ee80b0e5e84e02429ed6c8bb01d6eced6854602c571755943
image: docker.io/projectsveltos/classifier@sha256:563ac03890e60902ef251d0fa5aefb82918cadf9b1fb186e29109efbdfe0e976
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -90,7 +90,7 @@ spec:
fieldPath: metadata.namespace
- name: IS_INITIALIZATION
value: "true"
image: docker.io/projectsveltos/classifier@sha256:e835c4736a93940ee80b0e5e84e02429ed6c8bb01d6eced6854602c571755943
image: docker.io/projectsveltos/classifier@sha256:563ac03890e60902ef251d0fa5aefb82918cadf9b1fb186e29109efbdfe0e976
imagePullPolicy: IfNotPresent
name: migrate
resources:
Expand Down
4 changes: 2 additions & 2 deletions pkg/sharding/em.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -40,7 +40,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/event-manager@sha256:9d497594b59abb2831d48d3ae28e60b3ffea34f7fdb3b89c3237e14edcc8effb
image: docker.io/projectsveltos/event-manager@sha256:0d3ac4df42a1e1284ed3c9293b6bdd70170e5541fdd6d302341d1e96f77bfd3f
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
4 changes: 2 additions & 2 deletions pkg/sharding/event-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -58,7 +58,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/event-manager@sha256:9d497594b59abb2831d48d3ae28e60b3ffea34f7fdb3b89c3237e14edcc8effb
image: docker.io/projectsveltos/event-manager@sha256:0d3ac4df42a1e1284ed3c9293b6bdd70170e5541fdd6d302341d1e96f77bfd3f
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
4 changes: 2 additions & 2 deletions pkg/sharding/healthcheck-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -58,7 +58,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/healthcheck-manager@sha256:2e2ebcee06134a6a9e45a9b29c7ff76d7d3d0bcf9d9f49fe0e17c803c423af71
image: docker.io/projectsveltos/healthcheck-manager@sha256:bf432abe86ceb781a89c1894abaabf99506e4fb477599840f456d987a4c22f34
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
4 changes: 2 additions & 2 deletions pkg/sharding/hm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- --shard-key={{.SHARD}}
- --capi-onboard-annotation=
- --v=5
- --version=main
- --version=v1.11.0
- --agent-in-mgmt-cluster=false
command:
- /manager
Expand All @@ -40,7 +40,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/projectsveltos/healthcheck-manager@sha256:2e2ebcee06134a6a9e45a9b29c7ff76d7d3d0bcf9d9f49fe0e17c803c423af71
image: docker.io/projectsveltos/healthcheck-manager@sha256:bf432abe86ceb781a89c1894abaabf99506e4fb477599840f456d987a4c22f34
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Loading