os.CreateTemp seems to perform the exactly same task here, and its
implementation seems having considered many more edge cases than the
implementation here. This patch uses os.CreateTemp here to avoid
reinventing the wheel.
Kubernetes-commit: de0f030bcec55944dcbf81a9eec4f4d87f76567f
As discussed during the alpha review, the ReadOnly field is not really
needed because volume mounts can also be read-only. It's a historical
oddity that can be avoided for generic ephemeral volumes as part
of the promotion to beta.
Kubernetes-commit: 555d4a12bf58f19cbd79f866e2abce13490bde40
Assume the following CRDs exist (ordered by priority, the first is the highest):
- authentications.migration.k8s.io (K=Authentications, G=migration.k8s.io)
- authentications.metal3.io (K=Authentications, G=metal3.io)
- authentications.whereabouts.cni.cncf.io (K=Authentications, G=whereabouts.cni.cncf.io)
- authentications.snapshot.storage.k8s.io (K=Authentications, G=snapshot.storage.k8s.io)
In case 'kubectl explain authentications' is ran, the highest priority definition (in this case authentications.migration.k8s.io)
is returned. In case a user wants to explain authentication CRD of a different group, --api-version flag has to be set alongside
to point to a specific group and version. E.g. --api-version=metal3.io/v1
This PR allows to dismiss --api-version flag and perform a prefix check to select a resource (e.g. CRD) whose (resource, group) pair
fully prefixes requested resource. E.g. running 'kubectl explain authentications.metal3.io' will return
description of authentications.metal3.io. The same holds for optional field path.
I.e. 'kubectl explain authentications.metal3.io.spec' will return description of spec field
of authentications.metal3.io.spec. In case no resource match is found, the search falls back
to selecting the highest priority gvr that matches the resource.
In case --api-version is set, no prefix matching is performed. To cover cases
such as 'kubectl explain authentications.metal3.io --api-version=authentications.metal3.io/v1' where
fields path coincide with the resource fully specified name (to access .metal3.io field of authentications.metal3.io).
Kubernetes-commit: 30674db1595e3a24273ceb71cbfe67bb300ad951
The behavior of the container defaulting in attach/exec is inconsistent
and should be unified. As a user, when we default the vast majority of
pods will have a small number of containers and so printing the container
names inline (as kubectl logs did) is more appropriate. The debug message
we printed about using describe was already longer than 99% of all pod
container names, so we were wasting user time.
Unify container selection for exec and attach to be consistent with old
behavior. Properly handle the --quiet flag (should not print in that case)
for both commands. Remove EnableCmdSuggestion and the machinery it needs.
The message now prints:
> Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-ensure-env-vars (init), etcd-resources-copy (init)
Kubernetes-commit: 43e8ebbbcd3f57d18d8151efb6242f88a763b06d
--quiet means no informational output for the human that could be
confused with the output of the shell / command on the other side.
Kubernetes-commit: 75700d32bff0e28c7093ef384de78dbdd0db61b2
Currently, server-side dry-run fetches the OpenAPI schema for every
single object.
This change fetches the OpenAPI schema only once.
Kubernetes-commit: caa158610dfb53de3582ed6df0eb37359206fc66
Right now, there is no way to use these annotations, support multiple
`kubectl` versions, and not give users annoying warnings every time they
run `kubectl log`.
If a user is setting *both* annotations, they clearly know that the old
on is deprecated. Therefor, we should not warn them.
Kubernetes-commit: a7882d8a4264cdb9eaab9dc3d67cf0cc5afd5886
- update according to KEP: move getContainerName to helper
Signed-off-by: pacoxu <paco.xu@daocloud.io>
Kubernetes-commit: b54e823dbce08bff6fab979243663b0fea5a351f
`kubectl get` supports specifying a comma separated list of resource types. E.g.:
```bash
kubectl get pods,secrets
```
Will list all pods and secrets in the current namespace.
This commit adds support to the kubectl bash completion for this feature. Which means if you type `kubectl get pods,sec<tab>` it will be auto-completed to `kubectl get pods,secrets` (assuming the cluster does not have a CRD starting with `sec`).
Kubernetes-commit: 51671ecc2e258d50c7b1315b7b68c4e239f7e829
* Remove the dependency between create namespace command and generators
* Update create_namespace.go
format the file
rename "kruntime" package to "runtime"
remove the reliance of generators
replace dynamic client with typed client
rename "options" to "o" in "NewNamespaceOptions" fun for better reading and comparison with other create cmd
remove Namespace and EnforceNamespace from NamespaceOptions
remove Mapper from NamespaceOptions
refactory the "Run" fun
refactory the "Run" fun
Update create_namespace.go and create_namespace_test.go
* Update create_namespace.go and create_namespace_test.go
* fix createNamespace function
* fix createNamespace function
* fix createNamespace function
* remove the wrong comment in NamespaceOptions
* add validate operation for cobra.Command
* add some unit tests
* add some unit tests
* remove the call of Validate() from createNamespace() and update return type of createNamespace()
* update test suite for the new createNamespace()
Kubernetes-commit: 6990d75625b6aaa32c1aa5a99a174775868263bc
Enables the PatchOrReplace call for the cordon helper to accept a
user-supplied context to be used for the client.Patch/Update calls to
alter the node status while cordoning/uncordoning the node.
Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
Kubernetes-commit: 017eaa519de5926fd75a9ddc61bedf2398b69653
It took me a while to spot this subtlety.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Kubernetes-commit: 7c764c8550121b48a6e2678700b6a80fa7d3e2f0
When using GNU diffutils, some commands (e.g. --color[=WHEN])
requires an equal sign.
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Kubernetes-commit: 722751accf7607f4d0573778e85027c63e1802ce
No need extra vars just for a single validation.
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Kubernetes-commit: ea017e53af84b05154f275fabcfc95a61b091493
cleanup: change klog.Fatalf to fmt.Errorf for kubectl auth reconcile
cleanup: change klog.Fatalf to fmt.Errorf for
Kubernetes-commit: 3b3a6d27cd1a55fff173427ac9d74d35de7f5acf
fix kubectl label error when local=true is set.
fix kubectl label error when local=true is set.
Kubernetes-commit: cb7009a63bbc90569493f070463ae6715088d46a
Certain missing comments and typos in comments are fixed in the files
that implement `kubectl create` subcommands.
Kubernetes-commit: 1c5c8601e479cc3b32809868c250aeb256796484
Otherwise, the namespace gets set to what's a current namespace
in provided kubeconfig. Which can be different from default.
Kubernetes-commit: d4e89547f065ac5eee67ab4646fb3cee874dc1a9
vendor/k8s.io/kubectl/pkg/cmd/scale/scale.go:212:2: this value of err is never used (SA4006)
Kubernetes-commit: 5710e1b162ea90a3df2622d09864bf2411eb5fd7
When trying to upload an unexisting file to a pod,
kubectl currently doesn't print any error message
and terminates with a zero exit code.
This adds a check and fails explicitly in such cases.
Kubernetes-commit: 3fa5b504423f169723b911547cd22ae85da168e0
cleanup: use i18n.T only on string literals
cleanup: sort imports
Add i18n dependency for wait.go
Remove translation on envResource
cleanup: translate string instead of variable
cleanup: sort imports
cleanup: translate string literal only
Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
Currently, if users try to use external diff command with arguments
will fail because the entire command won't be available through $PATH.
This patch allow users to use external diff tools with args (or not)
via KUBECTL_EXTERNAL_DIFF env.
Reference: https://github.com/kubernetes/kubectl/issues/937
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Kubernetes-commit: a6158c01b9add5b580059d24cb66e54c37ea2531
in: staging/src/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go
test: TestCreateRoleBinding
On go version 1.15.3, casting int to string using `string(int)` causes
the test to fail with this error:
>> k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create
vendor/k8s.io/kubectl/pkg/cmd/create/create_rolebinding_test.go:75:9:
conversion from int to string yields a string of one rune, not a
string of digits (did you mean fmt.Sprint(x)?)
FAIL k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/create
[build failed]
FAIL
make: *** [Makefile:185: test] Error 1
Kubernetes-commit: 1e0bbe61ae4d4e186bc8d0991210d1613dc71996
The option --delete-local-data according with users is not clear.
This patch deprecate --delete-local-data in favor of --delete-emptydir-data.
Reference:
https://github.com/kubernetes/kubernetes/issues/80228
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Kubernetes-commit: 625e47aaa2769d221c59e5b9b05b4ac97212719b
* api: structure change
* api: defaulting, conversion, and validation
* [FIX] validation: auto remove second ip/family when service changes to SingleStack
* [FIX] api: defaulting, conversion, and validation
* api-server: clusterIPs alloc, printers, storage and strategy
* [FIX] clusterIPs default on read
* alloc: auto remove second ip/family when service changes to SingleStack
* api-server: repair loop handling for clusterIPs
* api-server: force kubernetes default service into single stack
* api-server: tie dualstack feature flag with endpoint feature flag
* controller-manager: feature flag, endpoint, and endpointSlice controllers handling multi family service
* [FIX] controller-manager: feature flag, endpoint, and endpointSlicecontrollers handling multi family service
* kube-proxy: feature-flag, utils, proxier, and meta proxier
* [FIX] kubeproxy: call both proxier at the same time
* kubenet: remove forced pod IP sorting
* kubectl: modify describe to include ClusterIPs, IPFamilies, and IPFamilyPolicy
* e2e: fix tests that depends on IPFamily field AND add dual stack tests
* e2e: fix expected error message for ClusterIP immutability
* add integration tests for dualstack
the third phase of dual stack is a very complex change in the API,
basically it introduces Dual Stack services. Main changes are:
- It pluralizes the Service IPFamily field to IPFamilies,
and removes the singular field.
- It introduces a new field IPFamilyPolicyType that can take
3 values to express the "dual-stack(mad)ness" of the cluster:
SingleStack, PreferDualStack and RequireDualStack
- It pluralizes ClusterIP to ClusterIPs.
The goal is to add coverage to the services API operations,
taking into account the 6 different modes a cluster can have:
- single stack: IP4 or IPv6 (as of today)
- dual stack: IPv4 only, IPv6 only, IPv4 - IPv6, IPv6 - IPv4
* [FIX] add integration tests for dualstack
* generated data
* generated files
Co-authored-by: Antonio Ojea <aojea@redhat.com>
Kubernetes-commit: 6675eba3eff1c8e565c4060a9c1396f75da7cc3e
Some unit tests throw this warning.
W1013 09:06:21.581870 176998 helpers.go:567] --dry-run=true is deprecated (boolean value) and can be replaced with --dry-run=client.
This patch removes the warning by using --dry-run=client instead of --dry-run=true.
The unit tests that are affected are:
make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/apply GOFLAGS=-v
make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/create GOFLAGS=-v
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Kubernetes-commit: ad7cbac16354e19981e986bbc2b3fd9cfa930d45
Empty key and non-empty effect means to match all keys and values and
the specified effect. However "kubectl describe" prints it without space
between effect and operator. This patch adds the space for this case.
Kubernetes-commit: 04185f4e533b9b8ebaabe1ed09516e85c5ed1ae1
Add `create ingress` unit tests
Move src code to staging dir
Update create command to reflect new API
Replaced deprecated `extensions` api with `networking`
Fix `missing strict dependencies`
Update BUILD
Update BUILD
Fix commit conflict with upstream
Update after review
* Removed obsolete files
* Moved v1beta to v1 api
Fixed gofmt
Fixed deps imports
Merge with PR #94327
Revert changes
Revert go.mod
Revert BUILD
No need to update generated BUILD
Add required deps to BUILD
Update BUILD
Kubernetes-commit: be45584a03aa9f3a3fd73e3d9cc69545da92616e
Clarify that `REMOTE_PORT` is interpreted as identifying a _Service_ port when provided `TYPE` is `service`.
Also, highlight support for specifying a named port as `REMOTE_PORT`.
Kubernetes-commit: 68e8fd5f33647f22a1bd9ff8508003a969036e25
fixed syntax, wrote a test
fixed a test
.
1
Update staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go
Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>
added test
.
fix
fix test
fixed a test
gofmt
lint
fix
function name
validation fix
.
godocs added
.
Kubernetes-commit: 316eff8dee1bb7a5929a28bc07bace910bb0e126
- Changed kubectl top to sort first at the pod level and then at the container level when --sort-by and --containers are used together.
- Refactored printSinglePodMetrics into two separate functions instead of passing in bool to change behavior.
- Refactored MetricsSorters to simplify code.
- Added unit tests to test container sorting.
- Fixed pod sorting unit tests which were not working because it was checking for --sort-by command line flag which was never true.
Kubernetes-commit: 04266b37ded103ddb84a192ec816499904fce1d1
If a service has both TCP and UDP but the TCP port appears before in the
range loop, it will be considered a UDP-only port and the forwarding
will fail.
Fix that by calculating the difference between UDP ports and TCP ports.
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Kubernetes-commit: 21b598cbe752dc5d2a2bca0e46729c9e72d162a3