Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Kubernetes dependency to v1.28.13 #256

Merged
merged 4 commits into from
Aug 21, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.21
cache: true
cache-dependency-path: go.sum
- name: Checkout code
uses: actions/checkout@v4
- name: Check vendors
Expand All @@ -34,7 +36,9 @@ jobs:
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.21
cache: true
cache-dependency-path: go.sum
- name: compile
run: make all
test:
Expand All @@ -47,7 +51,7 @@ jobs:
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.21
- name: make test
run: make test
e2e:
Expand All @@ -66,7 +70,7 @@ jobs:
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.21
- name: run e2e
run: |
export ARTIFACTS_PATH=${{ github.workspace }}/e2e-logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swr-latest-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- name: build images
env:
REGISTRY: ${{secrets.SWR_REGISTRY}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swr-released-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- name: build images
env:
REGISTRY: ${{secrets.SWR_REGISTRY}}
Expand Down
83 changes: 67 additions & 16 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- pkg/apigw

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
Expand All @@ -29,21 +20,81 @@ linters:
enable:
# linters maintained by golang.org
- gofmt
- golint
- revive
- govet
# linters default enabled by golangci-lint .
- deadcode
- errcheck
- gosimple
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

# All available settings of specific linters.
linters-settings:
gci:
skip-generated: false
custom-order: true
gosec:
severity: medium
confidence: medium
revive:
enable-all-rules: true
severity: warning
rules:
- name: var-naming
disabled: false
arguments:
- ["API", "ID", "IDS", "IP", "VM", "JSON", "HTTP", "URL", "XML", "YAML", "CSS", "ACL", "CPU", "SQL", "EIP"] # AllowList
- name: cognitive-complexity
disabled: true
- name: add-constant
disabled: true
- name: use-any
disabled: true
- name: max-public-structs
disabled: true
- name: cyclomatic
severity: warning
disabled: false
exclude: [""]
arguments: [5]
- name: line-length-limit
disabled: false
arguments: [150]
- name: cyclomatic
disabled: false
arguments: [15]
issues:
# The list of ids of default excludes to include or disable. By default it's empty.
include:
# There are too many issues about comments from golint, fix them in future.
#- EXC0002 # disable excluding of issues about comments from golint
# Which dirs to exclude: issues from them won't be reported.
# Can use regexp here: `generated.*`, regexp is applied on full path,
# including the path prefix if one is set.
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-dirs:
- pkg/apigw
- pkg/cloudprovider/huaweicloud/model
- pkg/cloudprovider/huaweicloud/wrapper/model
- test
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- pkg/cloudprovider/huaweicloud/elb.go
- pkg/cloudprovider/huaweicloud/elb_connection.go
- pkg/cloudprovider/huaweicloud/http.go
- pkg/cloudprovider/huaweicloud/nat.go
- pkg/cloudprovider/huaweicloud/nat_connections.go
- pkg/cloudprovider/huaweicloud/throttle.go
- pkg/utils/loggertripper.go
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- revive

20 changes: 12 additions & 8 deletions cmd/cloud-controller-manager/cloud-controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
cloudprovider "k8s.io/cloud-provider"
"k8s.io/cloud-provider/app"
"k8s.io/cloud-provider/app/config"
"k8s.io/cloud-provider/names"
"k8s.io/cloud-provider/options"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
Expand All @@ -44,15 +45,16 @@ import (
)

func main() {
rand.Seed(time.Now().UnixNano())
rand.Seed(time.Now().UnixNano()) //nolint:staticcheck

ccmOptions, err := options.NewCloudControllerManagerOptions()
if err != nil {
klog.Fatalf("unable to initialize command options: %v", err)
}

fss := cliflag.NamedFlagSets{}
command := app.NewCloudControllerManagerCommand(ccmOptions, cloudInitializer, app.DefaultInitFuncConstructors, fss, wait.NeverStop)
aliases := names.CCMControllerAliases()
command := app.NewCloudControllerManagerCommand(ccmOptions, cloudInitializer, app.DefaultInitFuncConstructors, aliases, fss, wait.NeverStop)

// TODO: once we switch everything over to Cobra commands, we can go back to calling
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
Expand All @@ -66,13 +68,13 @@ func main() {
defer logs.FlushLogs()

if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
fmt.Fprintf(os.Stderr, "error: %v\n", err) // nolint: revive
os.Exit(1)
}
}

func cloudInitializer(config *config.CompletedConfig) cloudprovider.Interface {
cloudConfig := config.ComponentConfig.KubeCloudShared.CloudProvider
func cloudInitializer(cfg *config.CompletedConfig) cloudprovider.Interface {
cloudConfig := cfg.ComponentConfig.KubeCloudShared.CloudProvider
logPrint("cloudConfig: ", cloudConfig)
// initialize cloud provider with the cloud provider name and config file provided
cloud, err := cloudprovider.InitCloudProvider(cloudConfig.Name, cloudConfig.CloudConfigFile)
Expand All @@ -84,10 +86,12 @@ func cloudInitializer(config *config.CompletedConfig) cloudprovider.Interface {
}

if !cloud.HasClusterID() {
if config.ComponentConfig.KubeCloudShared.AllowUntaggedCloud {
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
if cfg.ComponentConfig.KubeCloudShared.AllowUntaggedCloud {
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. " +
"Please tag your cluster to avoid any future issues")
} else {
klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. " +
"This check can be bypassed by setting the allow-untagged-cloud option")
}
}
return cloud
Expand Down
Loading
Loading