-
Notifications
You must be signed in to change notification settings - Fork 1.6k
:WIP sparkles: Add KAL and fix missing parts from tutorials #4888
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
:WIP sparkles: Add KAL and fix missing parts from tutorials #4888
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
bdee88d
to
b2c3dbb
Compare
b2c3dbb
to
c7cc7ef
Compare
083eab9
to
d1e8ffe
Compare
mkdir -p $(KUBE_API_LINTER_BUILD_DIR) | ||
cd $(KUBE_API_LINTER_BUILD_DIR) && \ | ||
go mod init local-kube-api-linter && \ | ||
go get sigs.k8s.io/kube-api-linter@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@everettraven @JoelSpeed
Do you see a better way to install with Golang CI 2x?
Would it be possible to do a release of the linter like any initial version, such as v0.1.0, and provide its binary so that we can download it here instead to simplify the install?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're currently trying to build this as a plugin, which means you also need to build the golangci-lint binary within the same Go module so that they share dependencies.
I would recommend using the module version of KAL where you compile a complete custom version of golangci-lint with KAL installed. In the future I hope to have a complete CLI released that is a custom version of golangci-lint, I'll see if I can do something about that next week as that might make this easier
d1e8ffe
to
450a10a
Compare
pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go
Outdated
Show resolved
Hide resolved
a8c6c0d
to
3400dd5
Compare
mkdir -p $(KUBE_API_LINTER_BUILD_DIR) | ||
cd $(KUBE_API_LINTER_BUILD_DIR) && \ | ||
go mod init local-kube-api-linter && \ | ||
go get sigs.k8s.io/kube-api-linter@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're currently trying to build this as a plugin, which means you also need to build the golangci-lint binary within the same Go module so that they share dependencies.
I would recommend using the module version of KAL where you compile a complete custom version of golangci-lint with KAL installed. In the future I hope to have a complete CLI released that is a custom version of golangci-lint, I'll see if I can do something about that next week as that might make this easier
// Valid values are: | ||
// - "Allow" (default): allows CronJobs to run concurrently; | ||
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; | ||
// - "Replace": cancels currently running job and replaces it with a new one | ||
// +optional | ||
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"` | ||
// +kubebuilder:default:=Allow | ||
ConcurrencyPolicy *ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty string is a valid value here? If it's not a valid choice, then this field doesn't need to be a pointer, that could be a bug in KAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that should be a valid value. So, I will try to track this one.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the enum and it's not in the list of valid values, so I'm surprised this would be a pointer
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go
Outdated
Show resolved
Hide resolved
docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go
Outdated
Show resolved
Hide resolved
docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go
Outdated
Show resolved
Hide resolved
docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go
Outdated
Show resolved
Hide resolved
@echo "Setting up local module for kube-api-linter plugin..." | ||
mkdir -p $(KUBE_API_LINTER_BUILD_DIR) | ||
cd $(KUBE_API_LINTER_BUILD_DIR) && \ | ||
go mod init local-kube-api-linter && \ | ||
go get sigs.k8s.io/kube-api-linter@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this achieve? Why was it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to allow us to build the linter locally.
I created the module inside the hack dir to not add any dep to the project itself.
But if we have a release, an easier way by like downloading it then we can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach taken for K/K and other repos has generally to have a separate go.mod for tools (new Go tools directives), and then this doesn't add deps to the main go.mod, but does allow all of the tools to built using the same environment.
I need it to have the linter and be able to build it locally in the hack dir, and without adding any dependencies to the project itself.
But you're building it with the first command, so I'm not sure why there's then a second get of the linter after you've already built the plugin?
Could we start to do releases? Would it be possible to provide it so that it can be downloaded instead of building it?
This is on the todo, but has been lower priority, as so far everyone who has used it has largely been ok with the plugin or module way of building things
pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go
Outdated
Show resolved
Hide resolved
3400dd5
to
6405fe0
Compare
6405fe0
to
8677590
Compare
baebf42
to
0e008e2
Compare
0e008e2
to
abc0678
Compare
5bd34fc
to
416eafe
Compare
faa4c72
to
602961f
Compare
f4cfc8e
to
ba1a810
Compare
ba1a810
to
7b93ca6
Compare
@camilamacedo86: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
I broke the install. |
More info: https://github.com/kubernetes-sigs/kube-api-linter
Experimental PR for: #4809