Skip to content

Commit

Permalink
Merge branch 'master' into jasonjung/set-image-version
Browse files Browse the repository at this point in the history
  • Loading branch information
jason1028kr authored Jan 23, 2025
2 parents ee9c0b7 + 88a9ba8 commit 1fd8c83
Show file tree
Hide file tree
Showing 178 changed files with 82,260 additions and 19,037 deletions.
26 changes: 21 additions & 5 deletions .github/README-RENOVATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,21 @@ In summary, this package rule is saying it will apply auto-update without `autom

Combining these 2 package rules together is actually asking Renovate not to update `major` and `minor`, but just `patch`, `pin` and `digest`.

We configured auto-merge patch version for components `moby-runc` and `moby-containerd`. Please search `"matchPackageNames": ["moby-runc", "moby-containerd"]` in `renovate.json` for an example.

As of 01/23/2025, the PR merging policy is as follows.
| Components | Major | Minor | Patch |
| -------- | ------ | ------ | ------ |
| Runc, Containerd | Manual | Manual | Auto |
| Others | Manual | Manual | Manual |

The update of `Runc` and `Containerd` is owned by Node SIG and we have sufficient confidence to auto-merge it with our tests and PR gates. Thus it's set to `auto-merge`.
For other components, we are still relying on the owner teams to approve and merge. If there is a need to auto-merge a component, it's always configurable.

---

For more context to anyone who is interested, let's walk through a real example. Feel free to skip reading this if it has nothing to do with your task.

### (Optional context) Why not updating minor?
Using azure-cni as an example, if we enable auto updating `minor`, we will see the following PRs created by Renovate automatically at of Sep 12, 2024.
- PR1: containernetworking/azure-cni minor v1.5.32 -> v1.6.6
Expand Down Expand Up @@ -101,9 +115,10 @@ For example,
{
"matchPackageNames": ["moby-runc", "moby-containerd"],
"assignees": ["devinwong", "anujmaheshwari1", "cameronmeissner", "AlisonB319", "lilypan26", "djsly", "jason1028kr", "UtheMan", "zachary-bailey", "ganeshkumarashok"]
"reviewers": ["devinwong", "anujmaheshwari1", "cameronmeissner", "AlisonB319", "lilypan26", "djsly", "jason1028kr", "UtheMan", "zachary-bailey", "ganeshkumarashok"]
},
```
In this block, it is saying that if the package name, that a PR is updating, is one of the defined values, then assign this PR to these Github IDs.
In this block, it is saying that if the package name, that a PR is updating, is one of the defined values, then assign this PR to these Github IDs. The values in `reviewers` are the same group of people to allow them to self-approve the PR. Unfortunately JSON doesn't support variable in value so we have to provide the value strings twice for both `assignees` and `reviewers`

### Additional string operation to specific component
```
Expand Down Expand Up @@ -293,7 +308,7 @@ Depending on what kind of component you are going to onboard.
]
}
```
Please make sure you set the `renovateTag` correctly, where `registry` is always `https://mcr.microsoft.com` now, and the `name` doesn't have a leading slash `/`. As of Sept 2024, The container Images in `components.json` are all hosted in MCR and MCR is the only registry enabled in the current Renovate configuration file `renovate.json`. If there is demand for other container images registry, it will be necessary to double check if it will just work.
Please make sure you set the `renovateTag` correctly, where `registry` is always `https://mcr.microsoft.com` now, and the `name` doesn't have a leading slash `/`. As of Jan 2025, The container Images in `components.json` are all hosted in MCR and MCR is the only registry enabled in the current Renovate configuration file `renovate.json`. If there is demand for other container images registry, it will be necessary to double check if it will just work.

Fore more details, you can refer to Readme-components linked at the beginning of this document.

Expand Down Expand Up @@ -324,9 +339,10 @@ There is an example for packages `moby-runc` and `moby-containred`
{
"matchPackageNames": ["moby-runc", "moby-containerd"],
"assignees": ["devinwong"]
"reviewers": ["devinwong"]
},
```
You can follow this example to create a block and fill in the matchPackageNames with your **GitHub ID** to assign to yourself, assuming you are the owner. Note that the packageName here must be the exact name that you can find in your datasource. For example, in the datasource PMC which hosts `moby-runc` and `moby-containerd`, we are running `apt-get install moby-runc moby-containerd`. So this is the correct package name.
You can follow this example to create a block and fill in the matchPackageNames with your **GitHub ID** to assign and set reviewer to yourself, assuming you are the owner. Note that the packageName here must be the exact name that you can find in your datasource. For example, in the datasource PMC which hosts `moby-runc` and `moby-containerd`, we are running `apt-get install moby-runc moby-containerd`. So this is the correct package name.

Another example is for a container image `mcr.microsoft.com/oss/kubernetes/kube-proxy`. In this case you should fill in the matchPackageNames with packageName `oss/kubernetes/kube-proxy`. Note there is no leading slash `/`.

Expand All @@ -343,9 +359,9 @@ If your GitHub ID is placed in the `assignees` array, you are responsible for th
## What components are onboarded to Renovate for auto-update and what are not yet?
In general, if a component has the `"renovateTag": "<DO_NOT_UPDATE>"`, it means it's not monitored by Renovate and won't be updated automatically.

As of 11/12/2024,
As of 01/23/2025,
- All the container images are onboarded to Renovate for auto-update.
- PMC hosted packages, namely `runc` and `containerd`, are onboarded for auto-update.
- PMC hosted packages, namely `runc` and `containerd`, are configured as auto-merge patch version.
- OCI artifacts hosted on MAR(aka MCR) such as `kubernetes-binaries`, `azure-acr-credential-provider` and `containerd-wasm-shims` are onboarded for auto-update.
- Acs-mirror hosted packages/binaries, namely `cni-plugins`, `azure-cni`, `cri-tools`, etc., are NOT onboarded for auto-update yet. There are plans to move the acs-mirror hosted packages to MCR OCI which will be downloaded by Oras. We will wait for this transition to be completed to understand the details how to manage them.

Expand Down
13 changes: 9 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
},
{
"matchPackageNames": ["moby-runc", "moby-containerd"],
"matchUpdateTypes": [
"patch"
],
"automerge": true,
"enabled": true,
"assignees": ["devinwong", "anujmaheshwari1", "cameronmeissner", "AlisonB319", "lilypan26", "djsly", "jason1028kr", "UtheMan", "zachary-bailey", "ganeshkumarashok"],
"reviewers": ["devinwong", "anujmaheshwari1", "cameronmeissner", "AlisonB319", "lilypan26", "djsly", "jason1028kr", "UtheMan", "zachary-bailey", "ganeshkumarashok"]
},
Expand All @@ -93,15 +98,15 @@
"assignees": ["mainred"],
"reviewers": ["mainred"]
},
{
"matchPackageNames": ["moby-runc", "moby-containerd"],
"extractVersion": "^v?(?<version>.+)$"
},
{
"matchDatasources": ["docker"],
"matchPackageNames": ["oss/binaries/kubernetes/kubernetes-node", "oss/binaries/kubernetes/azure-acr-credential-provider", "oss/binaries/deislabs/containerd-wasm-shims"],
"extractVersion": "^(?P<version>.*?)-[^-]*-[^-]*$"
},
{
"matchPackageNames": ["moby-runc", "moby-containerd"],
"extractVersion": "^v?(?<version>.+)$"
},
{
"matchPackageNames": ["aks/aks-gpu-cuda", "aks/aks-gpu-grid"],
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-(?<prerelease>\\d{14})$",
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ jobs:
golangci:
name: lint
runs-on: ubuntu-24.04
strategy:
matrix:
dirs: [".", "aks-node-controller"]
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.59.1
version: v1.63.4
working-directory: ${{ matrix.dirs }}

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
20 changes: 0 additions & 20 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,6 @@ linters-settings:
# Default: true
skipRecvDeref: false

gomnd:
# List of function patterns to exclude from analysis.
# Values always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- os.Chmod
- os.Mkdir
- os.MkdirAll
- os.OpenFile
- os.WriteFile
- prometheus.ExponentialBuckets
- prometheus.ExponentialBucketsRange
- prometheus.LinearBuckets

gomodguard:
blocked:
# List of blocked modules.
Expand Down Expand Up @@ -210,9 +194,7 @@ linters:
- durationcheck # checks for two durations multiplied together
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- execinquery # checks query string in Query function which reads your Go src files and warning it finds
- exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # forbids identifiers
- funlen # tool for detection of long functions
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
Expand All @@ -224,8 +206,6 @@ linters:
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gomnd # detects magic numbers
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems
Expand Down
19 changes: 11 additions & 8 deletions .pipelines/.vsts-vhd-builder-release-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@ pr:
- vhdbuilder/packer/windows-vhd-builder-sig.json
exclude:
- vhdbuilder/release-notes
- /**/*.md

pool:
name: $(AZURE_POOL_NAME)

# Some templates use POOL_NAME instead of AZURE_POOL_NAME, so set POOL_NAME here just in case.
variables:
VHD_BUILD_ID: $(Build.BuildId)
LOCATION: $(PACKER_BUILD_LOCATION)
POOL_NAME: $(AZURE_POOL_NAME)
isPR: $[eq(variables['Build.Reason'], 'PullRequest')]
isNotPR: $[ne(variables['Build.Reason'], 'PullRequest')]

parameters:
- name: build2019containerd
displayName: Build 2019 containerd
Expand Down Expand Up @@ -59,12 +68,6 @@ parameters:
type: boolean
default: False

# Some templates use POOL_NAME instead of AZURE_POOL_NAME, so set POOL_NAME here just in case.
variables:
VHD_BUILD_ID: $(Build.BuildId)
LOCATION: $(PACKER_BUILD_LOCATION)
POOL_NAME: $(AZURE_POOL_NAME)

# Use variable group "ab-windows-ame-tenant" and link it to the pipeline "AKS Windows VHD Build"
# Use variable group "ab-windows-ame-tenant" and link it to the pipeline "AKS Windows VHD Build - PR check-in gate"
# Use variable group "ab-windows-ms-tenant" and link it to the pipeline "[TEST All VHDs] AKS Windows VHD Build - Msft Tenant"
Expand All @@ -88,7 +91,7 @@ stages:
imageName: windows-2022-containerd
windowsSku: 2022-containerd
hyperVGeneration: V1
build: ${{ parameters.build2022containerd }}
build: ${{ and(eq(parameters.build2022containerd, true), eq(variables.isNotPR, true)) }}
vhddebug: ${{ parameters.vhddebug }}
dryrun: ${{ parameters.dryrun }}

Expand All @@ -110,7 +113,7 @@ stages:
imageName: windows-23H2
windowsSku: 23H2
hyperVGeneration: V1
build: ${{ parameters.build23H2 }}
build: ${{ and(eq(parameters.build23H2, true), eq(variables.isNotPR, true)) }}
vhddebug: ${{ parameters.vhddebug }}
dryrun: ${{ parameters.dryrun }}

Expand Down
2 changes: 2 additions & 0 deletions .pipelines/.vsts-vhd-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ pr:
- .pipelines/templates/e2e-template.yaml
- parts/linux/*
- packer.mk
- aks-node-controller/*
exclude:
- vhdbuilder/release-notes
- vhdbuilder/packer/*.ps1
- vhdbuilder/packer/**/*.ps1
- vhdbuilder/packer/*windows*
- vhdbuilder/packer/**/*windows*
- /**/*.md

pool:
name: $(POOL_NAME)
Expand Down
1 change: 1 addition & 0 deletions .pipelines/e2e-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ pr:
- pkg/agent/testdata/AKSWindows* # Windows test data
- parts/linux/cloud-init/artifacts/components.json # centralized components management file
- staging/cse/windows/README
- /**/*.md
jobs:
- template: ./templates/e2e-template.yaml
1 change: 1 addition & 0 deletions .pipelines/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ pr:
- pkg/agent/testdata/AKSWindows* # Windows test data
- parts/linux/cloud-init/artifacts/components.json # centralized components management file
- staging/cse/windows/README
- /**/*.md
jobs:
- template: ./templates/e2e-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ parameters:

stages:
- stage: build_${{ parameters.stageName }}
condition: and(succeeded(), eq('${{ parameters.build }}', True))
dependsOn: [ ]
jobs:
- job: build_${{ parameters.stageName }}
dependsOn: []
condition: eq('${{ parameters.build }}', True)
timeoutInMinutes: 180
steps:
- bash: |
Expand All @@ -57,6 +57,7 @@ stages:

- stage: e2e_${{ parameters.stageName }}
dependsOn: build_${{ parameters.stageName }}
condition: and(succeeded(), eq('${{ parameters.build }}', True))
variables:
TAGS_TO_RUN: imageName=${{ parameters.imageName }}
jobs:
Expand Down
6 changes: 5 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

# Code owners for for cse_cmd.sh and nodecustomdata.yml. This is to ensure that the scriptless v-team is aware of the changes in order to sync with AKSNodeConfig.
cse_cmd.sh @Devinwong @lilypan26 @r2k1 @timmy-wright
nodecustomdata.yml @Devinwong @lilypan26 @r2k1 @timmy-wright
nodecustomdata.yml @Devinwong @lilypan26 @r2k1 @timmy-wright

# Code owners for the security patch release notes
/release-notes/security-patch/ @yagmurbaydogan @yewmsft @juan-lee @cameronmeissner @UtheMan @ganeshkumarashok @anujmaheshwari1 @AlisonB319 @Devinwong @lilypan26 @AbelHu @junjiezhang1997 @jason1028kr @djsly @phealy @r2k1 @timmy-wright @zachary-bailey

3 changes: 2 additions & 1 deletion aks-node-controller/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/Azure/agentbaker/aks-node-controller/parser"
"github.com/Azure/agentbaker/aks-node-controller/pkg/nodeconfigutils"
"gopkg.in/fsnotify.v1"
"github.com/fsnotify/fsnotify"
)

type App struct {
Expand Down Expand Up @@ -75,6 +75,7 @@ func (a *App) run(ctx context.Context, args []string) error {
case "provision-wait":
provisionStatusFiles := ProvisionStatusFiles{ProvisionJSONFile: provisionJSONFilePath, ProvisionCompleteFile: provisionCompleteFilePath}
provisionOutput, err := a.ProvisionWait(ctx, provisionStatusFiles)
//nolint:forbidigo // stdout is part of the interface
fmt.Println(provisionOutput)
slog.Info("provision-wait finished", "provisionOutput", provisionOutput)
return err
Expand Down
8 changes: 4 additions & 4 deletions aks-node-controller/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,17 @@ func TestApp_ProvisionWait(t *testing.T) {
// Run the test in a goroutine to simulate file creation after some delay
go func() {
time.Sleep(200 * time.Millisecond) // Simulate file creation delay
os.WriteFile(provisionStatusFiles.ProvisionJSONFile, []byte(testData), 0644)
os.Create(provisionStatusFiles.ProvisionCompleteFile)
_ = os.WriteFile(provisionStatusFiles.ProvisionJSONFile, []byte(testData), 0644)
_, _ = os.Create(provisionStatusFiles.ProvisionCompleteFile)
}()
},
},
{
name: "wait for provision completion",
wantsErr: false,
setup: func(provisionStatusFiles ProvisionStatusFiles) {
os.WriteFile(provisionStatusFiles.ProvisionJSONFile, []byte(testData), 0644)
os.Create(provisionStatusFiles.ProvisionCompleteFile)
_ = os.WriteFile(provisionStatusFiles.ProvisionJSONFile, []byte(testData), 0644)
_, _ = os.Create(provisionStatusFiles.ProvisionCompleteFile)
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion aks-node-controller/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ toolchain go1.23.0
require (
github.com/Azure/agentbaker v0.20240503.0
github.com/blang/semver v3.5.1+incompatible
github.com/fsnotify/fsnotify v1.8.0
github.com/stretchr/testify v1.9.0
google.golang.org/protobuf v1.35.2
gopkg.in/fsnotify.v1 v1.4.7
)

require (
Expand Down
6 changes: 2 additions & 4 deletions aks-node-controller/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down Expand Up @@ -44,8 +44,6 @@ google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojt
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
4 changes: 0 additions & 4 deletions aks-node-controller/helpers/const.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package helpers

const (
contractVersion = "v0"
)

const (
VMTypeStandard = "standard"
VMTypeVmss = "vmss"
Expand Down
1 change: 1 addition & 0 deletions aks-node-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func configureLogging() func() {
logPath := setupLogPath()

if err := os.MkdirAll(filepath.Dir(logPath), 0755); err != nil {
//nolint:forbidigo // there is no other way to communicate the error
fmt.Printf("failed to create log directory: %s\n", err)
os.Exit(1)
}
Expand Down
6 changes: 5 additions & 1 deletion aks-node-controller/parser/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func getUlimitContent(u *aksnodeconfigv1.UlimitConfig) string {
m["LimitMEMLOCK"] = u.GetMaxLockedMemory()
}

return base64.StdEncoding.EncodeToString([]byte(header + createSortedKeyValuePairs(m, " ")))
return header + createSortedKeyValuePairs(m, " ")
}

// getPortRangeEndValue returns the end value of the port range where the input is in the format of "start end".
Expand Down Expand Up @@ -495,6 +495,10 @@ func getGpuImageSha(vmSize string) string {
return agent.GetAKSGPUImageSHA(vmSize)
}

func getGpuDriverType(vmSize string) string {
return agent.GetGPUDriverType(vmSize)
}

func getGpuDriverVersion(vmSize string) string {
return agent.GetGPUDriverVersion(vmSize)
}
Expand Down
Loading

0 comments on commit 1fd8c83

Please sign in to comment.