Commit Graph

623 Commits

Author SHA1 Message Date
hzxuzhonghu d14a5efcb8 remove dead code in lifecycle admission
Kubernetes-commit: 22398f8d3c0d71db5869eace174f5721f8499224
2017-12-05 19:40:31 +08:00
Saksham Sharma 0d11a9c252 Use []byte in place of string in envelope.Service.
Kubernetes-commit: 5005a541d6b5b7d950ed621d9c9fd247abb9b4af
2017-11-07 04:24:53 +05:30
Davanum Srinivas 30e6bc192e Drop using cloud provider to set host address feature
As part of the larger plan to drop --cloud-provider and --cloud-config
from kube-apiserver, we need to stop calling Cloud Provider API to
find the external ip address when one is not specified on the command
line.

When ExternalHost is not specified, we check if AdvertiseAddress is
specified and use that, if that is missing then we use os.Hostname().

When testing this feature, found a problem that when ExternalHost
is specified, the port was not added in the generated URL. So fixed
that as well.

Kubernetes-commit: 31332fa84a0928085200ba5a2e35118516ee2c48
2017-12-04 15:06:07 -05:00
hzxuzhonghu 2d197ca9f2 fix typo and adjust import sequence
Kubernetes-commit: 185d5c1f3debec7f7c81cd713307134103038497
2017-11-08 11:43:56 +08:00
yuexiao-wang 46f7a60026 wrong number of args in apiserver/pkg
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>

Kubernetes-commit: 235df842fafe21fe90f5691ca5eb1ab775fbe54d
2017-11-24 10:01:54 +08:00
yanxuean 48fc8a399d missing format args in apiserver/pkg/endpoints
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>

Kubernetes-commit: 08b0883734ab39b3b789c225b14e62f5c25be660
2017-11-23 09:52:56 +08:00
Shiyang Wang e89cc5fee9 Fix Content negotiation incorrect when Accept header uses type parameters
Kubernetes-commit: 66c2ec32f2497616ddd6912cfc97f0b4306f9eea
2017-08-14 16:24:30 +08:00
Mike Danese c463eb3137 certs: add month buckets
Kubernetes-commit: e08c98b171ff9dd3982377103f9e43c311c7a78d
2017-11-27 10:59:56 -08:00
Mik Vyatskov 8977dcee4a Make audit batch webhook backend configurable
Signed-off-by: Mik Vyatskov <vmik@google.com>

Kubernetes-commit: 7e717ef3a6a57d31251ccee94d9e2dd29a70c27b
2017-11-30 18:47:48 +01:00
Maciej Szulik 4ad8f1d59a Return original error instead of negotiation one
Kubernetes-commit: 7c83e736624d9861da44459269925e8a127f5a44
2017-11-14 14:12:21 +01:00
Joe Betz 1f633a162d Reduce memory footprint of admission metrics
Kubernetes-commit: 92dd8b50f304ce19d62b8acf23d1b8c4f9bae00b
2017-11-26 21:54:50 -08:00
Di Xu ed8f1885d6 change DefaultGarbageCollectionPolicy to DeleteDependents for workload controllers
Kubernetes-commit: 344fe56ed30c0b83ab0a01e3b1344ecea3925863
2017-11-06 17:12:57 +08:00
Chao Xu 53b8960359 move the MutatingAdmissionWebhook to the last in the mutating amdission
plugin chain.

Kubernetes-commit: 8e8e32fa05f02331f724930933dfa34be995247c
2017-11-17 14:16:37 -08:00
David Eads 6d575ed0c4 require webhook admission kubeconfigfile to be absolute
Kubernetes-commit: 7e6ce2a04ce8ede20e3bdbcb8a5680a8e54c47a2
2017-11-22 08:17:47 -05:00
Kubernetes Submit Queue e16244b0bc Merge pull request #55812 from deads2k/admission-17-external
Automatic merge from submit-queue (batch tested with PRs 55812, 55752, 55447, 55848, 50984). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make versioned types for webhook admission config

Versioned webhook admission config type as promised in https://github.com/kubernetes/kubernetes/pull/54414.

@kubernetes/sig-api-machinery-pr-reviews
@ericchiang as promised.  fyi.

```yaml
kind: AdmissionConfiguration
apiVersion: apiserver.k8s.io/v1alpha1
plugins:
- name: GenericAdmissionWebhook
  configuration:
    kind: WebhookAdmission
    apiVersion: apiserver.config.k8s.io/v1alpha1
    kubeConfigFile: /path/to/my/file
```

`ADMISSION_CONTROL_CONFIG_FILE=../foo.yaml hack/local-up-cluster.sh`

Kubernetes-commit: 25ebf875b4235cb8f43be2aec699d62e78339cec
2017-12-07 04:34:43 +00:00
Chao Xu 70de900800 update-all generated
Kubernetes-commit: fcf4f15c89c8faf3f23171ea50b9c460ea67a76b
2017-11-19 13:41:10 -08:00
Chao Xu 98e2d6d11f remove reference to v1alpha1
Kubernetes-commit: 7945ae68d0c7cffb070d60ad4d8bfe6ef585c279
2017-11-19 13:54:50 -08:00
hzxuzhonghu 170e8ac6dd pass listener to genericapiserver
Kubernetes-commit: 6ba30f678c232793430a98770e7a851f1e814fd2
2017-11-16 13:32:12 +08:00
Dr. Stefan Schimanski 2ee052ccdf admission: make metrics compositional and move to metrics sub-package
Kubernetes-commit: baba0c827bfddfdc56b69c88e19406966ef900a2
2017-11-17 11:49:55 +01:00
Joe Betz f7181e20ae #55183 follow up: Reinstate admission chain composition and ns test
Kubernetes-commit: d82ae45a4cf7e34cf02755b7eaa6e040da590d67
2017-11-16 21:20:14 -08:00
Cao Shufeng 0ff8c2c2e4 run hack/update-all.sh
Kubernetes-commit: 4a20d729cc22a9d5adef1f778c0b81960f3b10f3
2017-11-19 12:45:21 +08:00
Cao Shufeng d3301ca8d8 [advanced audit]add a policy wide omitStage
Kubernetes-commit: d75c0f0e21af8229ed3147e9a798441221c03574
2017-10-27 10:01:01 +08:00
Chao Xu 86dc6e7b4e Update the validating webhook plugin to be a ValidatingInterface, rather than a MutatingInterface
Kubernetes-commit: cbfc9d33b7c6b9e767e4259910f783c047e83583
2017-11-20 14:57:07 -08:00
Daniel Smith 4406561b46 add detail to flag help
Kubernetes-commit: 2956314cde74f0481be1da6107cc266f56127173
2017-11-17 15:22:53 -08:00
Dr. Stefan Schimanski 45dc4adcc3 admission/webhook: move webhook initializer into plugin
Kubernetes-commit: e19257f2ec87d8091defb7935bb3a161fbb229d0
2017-11-15 13:00:24 +01:00
Dr. Stefan Schimanski a10420dfa0 apiserver: remove unneeded scheme from registry tester
Kubernetes-commit: d4d53c0e2a0b42ba22e6ec64f6d38bb308e841b5
2017-11-17 19:46:12 +01:00
Chao Xu 8a572a63d4 Rename GenericAdmissionWebhook to ValidatingAdmissionWebhook
Kubernetes-commit: d3c0765780fed5576670d6624cc3cc8d691d6392
2017-11-17 21:05:11 -08:00
Clayton Coleman 9f9cf56bb6 Table printers and server generation should always copy ListMeta
Tables should be a mapping from lists, so if the incoming object has
these add them to the table. Allows paging over server side tables.
Add tests on the generic creater and on the resttest compatibility.

Kubernetes-commit: d2a62fd42234a96cbab2dbcf402c168c59b41784
2017-11-15 21:01:49 -05:00
Clayton Coleman ce019febe3 Move unstructured conversion into pkg/runtime
Scheme conversion should support unstructured conversion natively to
allow going from unstructured to typed and back. It is not a higher
level responsibility to do that conversion because the scheme is the
only one who knows what types it supports.

Kubernetes-commit: 557f9ddfe6300ecdbdd70ea67dca63bf6b710ea7
2017-11-13 21:28:57 -05:00
Chao Xu ed64135818 Rename the testdata package to testcerts.
`godep save` somehow fails if there is a testdata go package. See
https://github.com/kubernetes/kubernetes/pull/54892#issuecomment-345035489

Kubernetes-commit: 2052a7e2a3483e341a5a8d1fc5ae8510dd32b2c6
2017-11-17 13:24:48 -08:00
Chao Xu 1b638a5be7 generated bazel
Kubernetes-commit: 6193360eb52b00727df08f67eb8fc364a8df85e9
2017-11-15 16:21:28 -08:00
Chao Xu cb8d15718f Adding the mutating webhook
Kubernetes-commit: ea123f82aae5bc46b9a91c4543c8f742d0db52da
2017-11-14 16:36:28 -08:00
cheftako 556a83dbf9 Admission request/response handling
AdmissionResponse allows mutating webhook to send apiserver a json patch
to mutate the object.
This reflects the imperative nature of AdmissionReview. It adds
AdmissionRequest and AdmissionResponse in place of status/spec.
The AdmissionResponse the allows the mutating webhook
to send back a json path with the mutated version of the requested
object.
Fixed the integration test to clean up properly.
Switched test image to 1.8v5 to reflect API changes.
Make sure to cache test framework client for cleaup test code.
Switched to pointer for patch type.
Factored in @liggitt's feedback.
Factored in @lavalamp's feedback.

Kubernetes-commit: dac3c2e168784bbcf1cbfef8bf5430101e191715
2017-11-06 15:41:26 -08:00
Michael Taufen 0b031bbb8b omitempty
Kubernetes-commit: 1347c094ce51f1fbababe0a2866c9046ea9ba1cc
2017-11-15 21:25:48 -08:00
Michael Taufen 8d690cc5cb ColonSeparatedMultimapStringString: allow multiple Set invocations with default override
The first call to Set will clear the map before adding entries;
subsequent calls will simply append to the map.
This makes it possible to override default values with a command-line
option rather than appending to defaults,
while still allowing the distribution of key-value pairs across
multiple flag invocations.

For example: `--flag "a:hello" --flag "b:again" --flag "b:beautiful"
--flag "c:world"` results in `{"a": ["hello"], "b": ["again",
"beautiful"], "c": ["world"]}`

Kubernetes-commit: 6e49ac382bbd43e5a3f648607f8005bdf0237317
2017-11-07 09:15:26 -08:00
Michael Taufen b96eecee16 omitempty
Kubernetes-commit: 617b49858fad83a72ce072356bb2808a259943c5
2017-11-16 14:47:39 -08:00
Michael Taufen 47c573fba6 Lift embedded structure out of eviction-related KubeletConfiguration fields
- Changes the following KubeletConfiguration fields from `string` to
`map[string]string`:
  - `EvictionHard`
  - `EvictionSoft`
  - `EvictionSoftGracePeriod`
  - `EvictionMinimumReclaim`
- Adds flag parsing shims to maintain Kubelet's public flags API, while
enabling structured input in the file API.
- Also removes `kubeletconfig.ConfigurationMap`, which was an ad-hoc flag
parsing shim living in the kubeletconfig API group, and replaces it
with the `MapStringString` shim introduced in this PR. Flag parsing
shims belong in a common place, not in the kubeletconfig API.
I manually audited these to ensure that this wouldn't cause errors
parsing the command line for syntax that would have previously been
error free (`kubeletconfig.ConfigurationMap` was unique in that it
allowed keys to be provided on the CLI without values. I believe this was
done in `flags.ConfigurationMap` to facilitate the `--node-labels` flag,
which rightfully accepts value-free keys, and that this shim was then
just copied to `kubeletconfig`). Fortunately, the affected fields
(`ExperimentalQOSReserved`, `SystemReserved`, and `KubeReserved`) expect
non-empty strings in the values of the map, and as a result passing the
empty string is already an error. Thus requiring keys shouldn't break
anyone's scripts.
- Updates code and tests accordingly.

Regarding eviction operators, directionality is already implicit in the
signal type (for a given signal, the decision to evict will be made when
crossing the threshold from either above or below, never both). There is
no need to expose an operator, such as `<`, in the API. By changing
`EvictionHard` and `EvictionSoft` to `map[string]string`, this PR
simplifies the experience of working with these fields via the
`KubeletConfiguration` type. Again, flags stay the same.

Other things:
- There is another flag parsing shim, `flags.ConfigurationMap`, from the
shared flag utility. The `NodeLabels` field still uses
`flags.ConfigurationMap`. This PR moves the allocation of the
`map[string]string` for the `NodeLabels` field from
`AddKubeletConfigFlags` to the defaulter for the external
`KubeletConfiguration` type. Flags are layered on top of an internal
object that has undergone conversion from a defaulted external object,
which means that previously the mere registration of flags would have
overwritten any previously-defined defaults for `NodeLabels` (fortunately
there were none).

Kubernetes-commit: 1085b6f7304d46697ab9ed2131774ae9d4550ce2
2017-10-19 15:42:07 -07:00
Clayton Coleman 089e209aad Guarantee that status errors have a kind set
Some errors are invoked outside of negotiation. These errors should
still have a kind and apiVersion (which is only set by structured
encoders, not always availabe). Ensure that all errors by default get a
status kind and version set.

Kubernetes-commit: a1e44fc69bf0faeb47e6d2ebfc2709bbc3f17221
2017-11-15 21:02:34 -05:00
Dr. Stefan Schimanski 29de1cdd6d registry: move generic registry tester into k8s.io/apiserver
Kubernetes-commit: 0b100cb69b9f99445aa523cf9c4abae8f62c751a
2017-11-13 18:07:35 +01:00
hzxuzhonghu c79bc73664 verify token file
Kubernetes-commit: 62c170fc1da2a94cd4dacd56f8f798f491b29ae1
2017-11-10 11:30:51 +08:00
Cao Shufeng b02e718318 remove duplicated import
Kubernetes-commit: 86968e44d09e713b8cd5adca5705bba7e511c033
2017-11-14 11:36:32 +08:00
Chao Xu 0159c24faf generated bazel
Kubernetes-commit: 47ef9aaf2297829998eb1a0a804de9209c1008f1
2017-11-14 16:29:23 -08:00
Chao Xu da1d210644 Reorganize the code in webhook admission plugin.
Move the namespace selector code to package webhook/namespace
Move the conversion related code to package to webhook/versioned
Move errors related code to package webhook/errors
Move admission review related code to package webhook/request

Kubernetes-commit: 51774697b35314b078270e9da24fbe0ff843b981
2017-11-14 15:20:45 -08:00
Chao Xu f88f0f12a1 Reorganize the admission webhook code.
Moved client and kubeconfig related code to webhook/config;
Moved the rule matcher to webhook/rules;
Left TODOs saying we are going to move some other common utilities;
Other code is moved to webhook/validation.

Kubernetes-commit: 1adfacc7eb41da109e970a9c2985fd55b4cbbdfd
2017-11-05 18:11:47 -08:00
Joe Betz 5f443f1654 Align admission metric names with prometheus guidelines
Kubernetes-commit: 369fd81ca151fe2ccb1ac0e6d44aad0eee99abf1
2017-11-14 11:18:31 -08:00
Joe Betz 3773a59cf0 Remove is_system_ns from admission metrics
Kubernetes-commit: 375e2d03ab8c70c8c84676a7eee8b46646036bde
2017-11-13 12:34:36 -08:00
Joe Betz f3058e0b10 Fix admission metrics to track mutating/validating correctly
Also update admission test mocks to better reflect typical usage and fix broken tests.

Kubernetes-commit: 2643c6ae3e7b7bc09e1d3eb695a438b190123083
2017-11-08 17:26:31 -08:00
Joe Betz a1e35e7bfe Add system namespaces to admission metrics. Add tests and leverage test code from PR#55086
Kubernetes-commit: 9d13d1baece20fc611176aad3b6f39ccf9fa4b36
2017-11-06 17:48:59 -08:00
Joe Betz f2028cc5a5 Add admission metrics
Kubernetes-commit: 3940e4f0533a7ee8e50ec939cdcb44c33d4a0ae9
2017-11-06 14:14:33 -08:00
foxyriver dbacfae1f8 stop timer
Kubernetes-commit: cdc4aca9a3d53e21cca4b784718732a9a0852084
2017-11-06 09:51:39 +08:00