Skip to content

Commit b6dc169

Browse files
committed
Rebased from internal fork; sync'd latest set of changes
1 parent 753822e commit b6dc169

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2206
-648
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"]
1414

1515
env:
16-
GO_VERSION: '1.22.12'
16+
GO_VERSION: '1.23.1'
1717

1818
jobs:
1919
detect-noop:

.github/workflows/code-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
# Common versions
17-
GO_VERSION: '1.22.12'
17+
GO_VERSION: '1.23.1'
1818

1919
jobs:
2020

.github/workflows/publish-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
echo "MEMBER_AGENT_IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4949
echo "REFRESH_TOKEN_IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
5050
- name: Login to ${{ env.REGISTRY }}
51-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
51+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
5252
with:
5353
registry: ${{ env.REGISTRY }}
5454
username: ${{ github.actor }}

.github/workflows/trivy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
MEMBER_AGENT_IMAGE_NAME: member-agent
1919
REFRESH_TOKEN_IMAGE_NAME: refresh-token
2020

21-
GO_VERSION: '1.22.12'
21+
GO_VERSION: '1.23.1'
2222

2323
jobs:
2424
export-registry:
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/checkout@v4
4848

4949
- name: Login to ${{ env.REGISTRY }}
50-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
50+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
5151
with:
5252
registry: ${{ env.REGISTRY }}
5353
username: ${{ github.actor }}

.github/workflows/upgrade.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
name: ci
1+
name: Fleet Agent Compatibility Tests
22

33
on:
44
push:
55
branches:
66
- main
77
- release-*
8-
workflow_dispatch: {}
8+
workflow_dispatch:
9+
inputs:
10+
beforeTagOrCommit:
11+
description: 'The baseline tag or commit to build Fleet agents from; if not specified, the latest tag will be used'
12+
required: false
13+
afterTagOrCommit:
14+
description: 'The new tag or commit to build Fleet agents from; if not specified, the last commit in the codebase (PR or branch) will be used'
15+
required: false
916
pull_request:
1017
branches:
1118
- main
1219
- release-*
1320
paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"]
1421

1522
env:
16-
GO_VERSION: '1.22.12'
23+
GO_VERSION: '1.23.1'
1724

1825
jobs:
1926
detect-noop:
@@ -47,7 +54,7 @@ jobs:
4754
go install github.com/onsi/ginkgo/v2/[email protected]
4855
4956
- name: Prepare the fleet
50-
run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
57+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" chmod +x setup.sh && ./setup.sh 3 && cd -
5158
env:
5259
KUBECONFIG: '/home/runner/.kube/config'
5360
HUB_SERVER_URL: 'https://172.19.0.2:6443'
@@ -58,7 +65,7 @@ jobs:
5865
KUBECONFIG: '/home/runner/.kube/config'
5966

6067
- name: Upgrade the Fleet hub agent
61-
run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true ./upgrade.sh 3 && cd -
68+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true ./upgrade.sh 3 && cd -
6269
env:
6370
KUBECONFIG: '/home/runner/.kube/config'
6471

@@ -85,7 +92,7 @@ jobs:
8592
go install github.com/onsi/ginkgo/v2/[email protected]
8693
8794
- name: Prepare the fleet
88-
run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
95+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" chmod +x setup.sh && ./setup.sh 3 && cd -
8996
env:
9097
KUBECONFIG: '/home/runner/.kube/config'
9198
HUB_SERVER_URL: 'https://172.19.0.2:6443'
@@ -96,7 +103,7 @@ jobs:
96103
KUBECONFIG: '/home/runner/.kube/config'
97104

98105
- name: Upgrade the Fleet member agent
99-
run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
106+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
100107
env:
101108
KUBECONFIG: '/home/runner/.kube/config'
102109

@@ -123,7 +130,7 @@ jobs:
123130
go install github.com/onsi/ginkgo/v2/[email protected]
124131
125132
- name: Prepare the fleet
126-
run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
133+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" chmod +x setup.sh && ./setup.sh 3 && cd -
127134
env:
128135
KUBECONFIG: '/home/runner/.kube/config'
129136
HUB_SERVER_URL: 'https://172.19.0.2:6443'
@@ -134,12 +141,11 @@ jobs:
134141
KUBECONFIG: '/home/runner/.kube/config'
135142

136143
- name: Upgrade all Fleet agents
137-
run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
144+
run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
138145
env:
139146
KUBECONFIG: '/home/runner/.kube/config'
140147

141148
- name: Run the After suite
142149
run: cd test/upgrade/after && ginkgo -v -p . && cd -
143150
env:
144151
KUBECONFIG: '/home/runner/.kube/config'
145-

.golangci.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
run:
2-
deadline: 10m
3-
go: '1.22.12'
2+
timeout: 15m
3+
go: '1.23.1'
4+
5+
linters-settings:
6+
stylecheck:
7+
checks: [ "all", "-ST1001" ] # Disables dot-import warnings
8+
revive:
9+
rules:
10+
- name: dot-imports
11+
disabled: true
12+
gosec:
13+
excludes:
14+
- G404 #Use of weak random number generator (math/rand or math/rand/v2). It is only used in tests.
415

516
linters:
617
disable-all: true

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ CONTROLLER_GEN_VER := v0.16.0
3131
CONTROLLER_GEN_BIN := controller-gen
3232
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
3333

34-
STATICCHECK_VER := 2023.1.7
34+
STATICCHECK_VER := 2024.1
3535
STATICCHECK_BIN := staticcheck
3636
STATICCHECK := $(abspath $(TOOLS_BIN_DIR)/$(STATICCHECK_BIN)-$(STATICCHECK_VER))
3737

3838
GOIMPORTS_VER := latest
3939
GOIMPORTS_BIN := goimports
4040
GOIMPORTS := $(abspath $(TOOLS_BIN_DIR)/$(GOIMPORTS_BIN)-$(GOIMPORTS_VER))
4141

42-
GOLANGCI_LINT_VER := v1.52.2
42+
GOLANGCI_LINT_VER := v1.64.7
4343
GOLANGCI_LINT_BIN := golangci-lint
4444
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER))
4545

apis/placement/v1alpha1/common.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ const (
1717

1818
// OverrideClusterNameVariable is the reserved variable in the override value that will be replaced by the actual cluster name.
1919
OverrideClusterNameVariable = "${MEMBER-CLUSTER-NAME}"
20+
21+
// OverrideClusterLabelKeyVariablePrefix is a reserved variable in the override expression.
22+
// We use this variable to find the associated the key following the prefix.
23+
// The key name ends with a "}" character (but not include it).
24+
// The key name must be a valid Kubernetes label name and case-sensitive.
25+
// The content of the string containing this variable will be replaced by the actual label value on the member cluster.
26+
// For example, if the string is "${MEMBER-CLUSTER-LABEL-KEY-kube-fleet.io/region}" then the key name is "kube-fleet.io/region".
27+
// If there is a label "kube-fleet.io/region": "us-west-1" on the member cluster, this string will be replaced by "us-west-1".
28+
OverrideClusterLabelKeyVariablePrefix = "${MEMBER-CLUSTER-LABEL-KEY-"
2029
)

cmd/hubagent/options/options.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func NewOptions() *Options {
113113
ConcurrentResourceChangeSyncs: 1,
114114
MaxFleetSizeSupported: 100,
115115
EnableV1Alpha1APIs: false,
116-
EnableClusterInventoryAPIs: false,
117-
EnableStagedUpdateRunAPIs: false,
116+
EnableClusterInventoryAPIs: true,
117+
EnableStagedUpdateRunAPIs: true,
118118
}
119119
}
120120

@@ -154,7 +154,7 @@ func (o *Options) AddFlags(flags *flag.FlagSet) {
154154
flags.IntVar(&o.MaxFleetSizeSupported, "max-fleet-size", 100, "The max number of member clusters supported in this fleet")
155155
flags.BoolVar(&o.EnableV1Alpha1APIs, "enable-v1alpha1-apis", false, "If set, the agents will watch for the v1alpha1 APIs.")
156156
flags.BoolVar(&o.EnableV1Beta1APIs, "enable-v1beta1-apis", true, "If set, the agents will watch for the v1beta1 APIs.")
157-
flags.BoolVar(&o.EnableClusterInventoryAPIs, "enable-cluster-inventory-apis", false, "If set, the agents will watch for the ClusterInventory APIs.")
157+
flags.BoolVar(&o.EnableClusterInventoryAPIs, "enable-cluster-inventory-apis", true, "If set, the agents will watch for the ClusterInventory APIs.")
158158
flags.DurationVar(&o.ForceDeleteWaitTime.Duration, "force-delete-wait-time", 15*time.Minute, "The duration the hub agent waits before force deleting a member cluster.")
159159
flags.BoolVar(&o.EnableStagedUpdateRunAPIs, "enable-staged-update-run-apis", true, "If set, the agents will watch for the ClusterStagedUpdateRun APIs.")
160160
flags.BoolVar(&o.EnableEvictionAPIs, "enable-eviction-apis", true, "If set, the agents will watch for the Eviction and PlacementDisruptionBudget APIs.")

docker/hub-agent.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the hubagent binary
2-
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.22.12 AS builder
2+
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.23.1 AS builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests

0 commit comments

Comments
 (0)