Skip to content

Commit bf1ea0b

Browse files
authored
Merge pull request #211 from gianlucam76/agentless-mode
(bug) set agent-in-mgmt-cluster also for the init containers
2 parents cea5ff1 + 31ab57b commit bf1ea0b

6 files changed

Lines changed: 25 additions & 11 deletions

File tree

.github/workflows/main.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
2020
with:
21-
go-version: 1.26.2
21+
go-version: 1.26.3
2222
- name: Build
2323
run: make build
2424
- name: FMT
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Go
3838
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
3939
with:
40-
go-version: 1.26.2
40+
go-version: 1.26.3
4141
- name: ut
4242
run: make test
4343
env:
@@ -50,7 +50,7 @@ jobs:
5050
- name: Set up Go
5151
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
5252
with:
53-
go-version: 1.26.2
53+
go-version: 1.26.3
5454
- name: fv
5555
run: make create-cluster fv
5656
env:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.26.2 AS builder
2+
FROM golang:1.26.3 AS builder
33

44
ARG BUILDOS
55
ARG TARGETARCH

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/projectsveltos/shard-controller
22

3-
go 1.26.2
3+
go 1.26.3
44

55
require (
66
github.com/TwiN/go-color v1.4.1
@@ -11,7 +11,7 @@ require (
1111
github.com/pkg/errors v0.9.1
1212
github.com/projectsveltos/libsveltos v1.9.0
1313
github.com/spf13/pflag v1.0.10
14-
golang.org/x/text v0.36.0
14+
golang.org/x/text v0.37.0
1515
k8s.io/api v0.36.0
1616
k8s.io/apiextensions-apiserver v0.36.0
1717
k8s.io/apimachinery v0.36.0

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
196196
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
197197
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
198198
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
199-
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
200-
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
199+
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
200+
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
201201
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
202202
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
203203
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
@@ -241,8 +241,6 @@ k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199 h1:sWu4Td5mgJlwunsUydnhKE
241241
k8s.io/kube-openapi v0.0.0-20260427204847-8949caaa1199/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0=
242242
k8s.io/streaming v0.36.0 h1:agnTxU+NFulUrtYzXUGKO3ndEa8jKwht1Kwn9nu9x+4=
243243
k8s.io/streaming v0.36.0/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s=
244-
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM=
245-
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
246244
k8s.io/utils v0.0.0-20260507154919-ff6756f316d2 h1:wU4tMEhLGgIbLvXQb1cfN+EcM0wf7zC6CPF+C79jroc=
247245
k8s.io/utils v0.0.0-20260507154919-ff6756f316d2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
248246
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec=

hack/tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/projectsveltos/addon-controller/hack/tools
22

3-
go 1.26.2
3+
go 1.26.3
44

55
require (
66
github.com/a8m/envsubst v1.4.3

internal/controller/utils.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,22 @@ func setOptions(deplTemplate []byte) ([]byte, error) {
499499
"--agent-in-mgmt-cluster=true")
500500
}
501501

502+
for i := range depl.Spec.Template.Spec.InitContainers {
503+
for j := range depl.Spec.Template.Spec.InitContainers[i].Args {
504+
args := &depl.Spec.Template.Spec.InitContainers[i].Args[j]
505+
if strings.Contains(*args, "agent-in-mgmt-cluster") {
506+
lastIdx := len(depl.Spec.Template.Spec.InitContainers[i].Args) - 1
507+
depl.Spec.Template.Spec.InitContainers[i].Args[j] = depl.Spec.Template.Spec.InitContainers[i].Args[lastIdx]
508+
depl.Spec.Template.Spec.InitContainers[i].Args = depl.Spec.Template.Spec.InitContainers[i].Args[:lastIdx]
509+
break
510+
}
511+
}
512+
513+
depl.Spec.Template.Spec.InitContainers[i].Args = append(
514+
depl.Spec.Template.Spec.InitContainers[i].Args,
515+
"--agent-in-mgmt-cluster=true")
516+
}
517+
502518
// Create a buffer to store the encoded JSON data.
503519
buffer := bytes.NewBuffer([]byte{})
504520

0 commit comments

Comments
 (0)