* Update Japanese translation for kubectl
* Update test for kubectl help
* apply kubernetes translations rules https://kubernetes.io/ja/docs/contribute/localization/#basic-policy
* Update kubectl help test string
* rebuild kubectl mo file
* fix k8s specific terms to original one
Kubernetes-commit: 37be90f2959691c6d527ebb545675e66c1aac4c7
* Remove deprecated PodRequestsAndLimits from kubectl/pkg/util/resource
The PodRequestsAndLimits function was deprecated in favor of
k8s.io/component-helpers/resource.PodRequests and PodLimits,
which also support pod-level resources. There are no remaining
consumers in kubectl.
This removal includes the unexported helpers: podRequests,
podLimits, determineContainerReqs, max, addResourceList, and
maxResourceList.
* Remove test for deleted max helper function
Kubernetes-commit: e026a9482a167bec567f16f87efe9df4c09dbb06
* kubectl describe: migrate to component-helpers resource package and add pod-level resources test
Refactor describe.go to use k8s.io/component-helpers/resource package for pod resource
calculations. This migration enables proper support for pod-level resources feature.
Changes:
- Import resourcehelper from k8s.io/component-helpers/resource
- Replace PodRequestsAndLimits() with separate PodRequests() and PodLimits() calls
Add TestDescribeNodeWithPodLevelResources to verify describeNodeResource works correctly
when pods have pod-level resources (Spec.Resources) configured.
Signed-off-by: KunWuLuan <kunwuluan@gmail.com>
* address review feedback: verify computed values in test and deprecate PodRequestsAndLimits
---------
Signed-off-by: KunWuLuan <kunwuluan@gmail.com>
Co-authored-by: KunWuLuan <kunwuluan@gmail.com>
Kubernetes-commit: 63080a762b383dbac02c44b3755e15543132d44e
... and update users to use standard library functions.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Kubernetes-commit: d42d1e3d1f73ac2975b89f9482c2ecfaeeed13f6
This commit fixes a fatal crash (concurrent map read/write) in
NewCompositedCompilerFromTemplate by:
- Refactoring CEL EnvSet composition to eliminate cloning and symbol conflicts
- Adding NewCompositedCompilerForTypeChecking for typechecking
- Removing deprecated CompositionEnv type and functions
- Adding regression test for concurrency race condition
- Using mustExtend helper function for clearer intent
Kubernetes-commit: 7bc62e74ab39048b00194b8ef6ead09c2dfb5e98
klog calls during init are becoming a problem because now test/e2e/framework
depends in test/utils/ktesting which bumps up the default verbosity during init
to make test output more complete when there is no argument parsing.
For cadvisor, an upstream fix is
needed (https://github.com/google/cadvisor/pull/3778). For kubectl we can make
it silently accept the valid (!) LC_ALL=C.
Kubernetes-commit: d17aaf5e29f209ca71047078650e9dcd266e47a4
This has been replaced by `//build:...` for a long time now.
Removal of the old build tag was automated with:
for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
Kubernetes-commit: ad79e479c2314d1de91e54bc5630c52027f12e21
I can't find evidence that anything is using this anymore, if anyone does depend on this it is a tiny function that depends only on public symbols and they can just place a copy somewhere else.
Kubernetes-commit: 4e29dcdf7567cd79749b7ad35378538b1b523247
The output format is now used by the `Complete()` function, so it must
be set before invoking said function.
The commit also adds a unit tests for this scenario.
Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Kubernetes-commit: f3d278e75d1137f1c91dde7415bc577af3c3be82
This allows consumers of term to not pull in dependencies on
github.com/gorilla/websocket and github.com/moby/spdystream.
Kubernetes-commit: 640dabd58b04b72f646ed85947cb8b407b36dc08
* Add JSON & YAML output support for kubectl api-resources
Create a separate `PrintFlags` struct within the apiresources.go file
that handles printing only for `kubetl api-resources` because existing
output formats, i.e., wide and name, are already implemented
independently from HumanReadableFlags and NamePrintFlags.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Use separate printer type for all options
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Unit tests for JSON & YAML outputs
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Separate file for print types
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Move JSON-YAML tests to separate function
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Fix broken unit test
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Unifying JSON & YAML unit test functions
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Fix linter errors
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* PR feedback and linter again
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
---------
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Kubernetes-commit: cb33accc8fc4d44e902da4926eee7b828c5e51ec
LoadTranslations gets called during the init phase:
0 0x0000000005926c56 in k8s.io/kubectl/pkg/util/i18n.LoadTranslations
at ./staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go:146
1 0x0000000005926727 in k8s.io/kubectl/pkg/util/i18n.init.func1
at ./staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go:60
2 0x000000000592780f in k8s.io/kubectl/pkg/util/i18n.lazyLoadTranslations.func1
at ./staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go:191
3 0x0000000001b876e8 in sync.(*Once).doSlow
at /nvme/gopath/go-1.24.0/src/sync/once.go:78
4 0x0000000001b8753e in sync.(*Once).Do
at /nvme/gopath/go-1.24.0/src/sync/once.go:69
5 0x0000000005927565 in k8s.io/kubectl/pkg/util/i18n.lazyLoadTranslations
at ./staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go:187
6 0x00000000059275cd in k8s.io/kubectl/pkg/util/i18n.T
at ./staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go:201
7 0x000000000599fb6d in k8s.io/kubectl/pkg/cmd/apiresources.init
at <autogenerated>:1
8 0x0000000001b41bf4 in runtime.doInit1
at /nvme/gopath/go-1.24.0/src/runtime/proc.go:7350
9 0x0000000001b6bf8a in runtime.doInit
at /nvme/gopath/go-1.24.0/src/runtime/proc.go:7317
10 0x0000000001b33910 in runtime.main
at /nvme/gopath/go-1.24.0/src/runtime/proc.go:254
11 0x0000000001b72881 in runtime.goexit
at /nvme/gopath/go-1.24.0/src/runtime/asm_amd64.s:1700
During init, klog verbosity is either zero (making the log call redundant
because it doesn't print anything) or some other init function reconfigures
logging, in which case the output is potentially confusing because it is not
guaranteed that logging is reconfigured before the log call is invoked.
In other scenarios, flag parsing might switch from klog text format to
something else entirely, which then leads to a mixture of text and e.g. JSON
output. In general, code running during init should not log.
Kubernetes-commit: 0276769c2c85e14902f39760abce82512aa6b120
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:
- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.
This commit was generated with
sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')
Everything was included, except for
package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
Kubernetes-commit: 8a908e0c0bd96a3455edf7e3b5f5af90564e65b0
* Add warning handler callback function in shortcut expander
Currently, errors in client-go are propagated back to the callers via
function returns. However, there is no elegant way for just warning users.
For example, when user wants to get a resource with it's short name format
and if there are multiple resources belonging to this short name, we need to
warn user about this ambugity which one is picked and which ones are discarded.
Not only to overcome this particular case mentioned above, but also propose a
way for the possible warnings in the future, this commit adds a warningHandler
callback function in shortcutExpander.
* Add warningPrinter functionality in ConfigFlags
ConfigFlags has neither warning user in a standardized
format functionality nor passing warning callback functions to other upper level
libraries such as client-go.
This commit adds an ability that user can set warningPrinters
according to their IOStreams and this warningPrinters will be used
to raise possible warnings happening not only in cli-runtime but
also in client-go.
* Pass warning callback function in ConfigFlags to shortcutExpander
This commit passes warning callback function to print possible
warnings happened in shortcut expander to warn user in a
standardized format.
* Add integration test for CRDs having ambiguous short names
This commit adds integration test to assure that warning message
related to this ambiguity is printed when resources are being retrieved via their short name
representations in cases where multiple resources have same
short names.
This integration test also ensures that the logic behind which resource
will be selected hasn't been changed which may cause disperancies in
clusters.
* Remove defaultConfigFlag global variable
* Move default config flags initialization into function
* Skip warning for versions of same group/resource
* Run update-vendor
* Warn only once when there are multiple versions registered for ambiguous resource
* Apply gocritic review
* Add multi-resource multi-version ambiguity unit test
Kubernetes-commit: a504aed54d028dbc8ea2508142c94d309f5f1ec6
Update the resource calculation so that it accumulates the resources
from scheduled pods correctly when those pods contain restartable
init containers.
Kubernetes-commit: 479b2d03a4369b8ae4565ba73850c703331cdcc5
This allows commands like kubectl port-forward, when used with deployments, to avoid selecting a pod that is terminating (due to a rollout, for example).
Kubernetes-commit: d281daee335dc3b2aa67fb3128f00d7d2f5f7d91
Update the template.pot file with the current state of the messages in kubectl. That allows localized messages to be updated accordingly and picked up correctly.
Kubernetes-commit: dfce076c6cf0ad8f7a896a87c07143c63e2d67bd
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Kubernetes-commit: 45836971f27ca70cd7742e8ee66e99e3c648cf9f