Skip to content

WIP: TEST KPA experimental install #4941

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v8
with:
version: v2.2.2
version: v2.3.0
working-directory: ${{ matrix.folder }}
- name: Run linter via makefile target
working-directory: ${{ matrix.folder }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
12 changes: 12 additions & 0 deletions docs/book/src/cronjob-tutorial/testdata/project/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -36,6 +45,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
6 changes: 6 additions & 0 deletions docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
12 changes: 12 additions & 0 deletions docs/book/src/getting-started/testdata/project/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -36,6 +45,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
6 changes: 6 additions & 0 deletions docs/book/src/getting-started/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
12 changes: 12 additions & 0 deletions docs/book/src/multiversion-tutorial/testdata/project/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -36,6 +45,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
6 changes: 6 additions & 0 deletions docs/book/src/multiversion-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/golang/v4/scaffolds/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (s *initScaffolder) Scaffold() error {
&templates.DockerIgnore{},
&templates.Readme{CommandName: s.commandName},
&templates.Golangci{},
&templates.CustomGcl{},
&e2e.Test{},
&e2e.WebhookTestUpdater{WireWebhook: false},
&e2e.SuiteTest{},
Expand Down
51 changes: 51 additions & 0 deletions pkg/plugins/golang/v4/scaffolds/internal/templates/custom-gcl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package templates

import (
"sigs.k8s.io/kubebuilder/v4/pkg/machinery"
)

var _ machinery.Template = &CustomGcl{}

// CustomGcl scaffolds a file ..custom-gcl.yaml which define KAL configuration to install
type CustomGcl struct {
machinery.TemplateMixin
machinery.ProjectNameMixin
}

// SetTemplateDefaults implements machinery.Template
func (f *CustomGcl) SetTemplateDefaults() error {
if f.Path == "" {
f.Path = ".custom-gcl.yml"
}

f.TemplateBody = customGCLTemplate

f.IfExistsAction = machinery.SkipFile

return nil
}

const customGCLTemplate = `version: v2.0.0
name: golangci-custom-linters
destination: ./bin
plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
`
12 changes: 12 additions & 0 deletions pkg/plugins/golang/v4/scaffolds/internal/templates/golangci.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -79,6 +88,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
7 changes: 7 additions & 0 deletions testdata/project-v4-multigroup/.custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
12 changes: 12 additions & 0 deletions testdata/project-v4-multigroup/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -36,6 +45,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
6 changes: 6 additions & 0 deletions testdata/project-v4-multigroup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
7 changes: 7 additions & 0 deletions testdata/project-v4-with-plugins/.custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
12 changes: 12 additions & 0 deletions testdata/project-v4-with-plugins/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ linters:
- unconvert
- unparam
- unused
- kubeapilinter
settings:
revive:
rules:
- name: comment-spacings
- name: import-shadowing
custom:
kubeapilinter:
path: ./bin/golangci-custom-linters
description: "Kube API Linter plugin"
original-url: "sigs.k8s.io/kube-api-linter"
settings:
linters: {}
lintersConfig: {}
exclusions:
generated: lax
rules:
Expand All @@ -36,6 +45,9 @@ linters:
- dupl
- lll
path: internal/*
- path-except: "^api/"
linters:
- kubeapilinter
paths:
- third_party$
- builtin$
Expand Down
6 changes: 6 additions & 0 deletions testdata/project-v4-with-plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
@echo "Running golangci-lint custom..."
@$(LOCALBIN)/golangci-lint custom || { \
echo "golangci-lint failed. Cleaning up..."; \
rm -f $(LOCALBIN)/golangci-lint; \
exit 1; \
}

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand Down
7 changes: 7 additions & 0 deletions testdata/project-v4/.custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v2.0.0
name: golangci-custom-linters
destination: ./bin

plugins:
- module: sigs.k8s.io/kube-api-linter
version: latest
Loading
Loading