Commit Graph

97 Commits

Author SHA1 Message Date
tanshanshan 8d99f185d1 fix some golint in staging/src/k8s.io/apiserver/pkg/admission/plugin/
Kubernetes-commit: 3de8767dc6ca8d47d29f99c2956a5fcf54df84d9
2018-09-26 14:30:50 +08:00
Jingyi Hu 90f716757e *: Remove comment tags in GoDoc
Adding blank line between comment tag and package name in doc.go. So
that the comment tags such as '+k8s:deepcopy-gen=package' do not show up
in GoDoc.

Kubernetes-commit: 61117761cd4a1b2e6ad9ff2d7eb915f3d2739dc6
2018-09-04 14:08:32 -07:00
fengzixu 0e8a1a0c6e Modification: revise some errors about golint in some packages
1. pkg/client
2. staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testing

Related to: https://github.com/kubernetes/kubernetes/issues/68026

Kubernetes-commit: 1fbb8b20e20616e1a1e957c01b1bb595c7703433
2018-08-31 13:22:25 +08:00
Mehdy Bohlool 21f6e2bcdd Refactor addmission webhook hook client to a util package
Kubernetes-commit: 5652d5cffadcd8a2f107b6aecf5fc06c0fc473f1
2018-08-26 23:20:23 +10:00
jennybuckley 817f61120c Support dry run in admission webhooks
Kubernetes-commit: 2d0ec48f9beea6182a9a3bfdcc5eb98e50b44f77
2018-08-21 16:06:27 -07:00
Cao Shufeng 9ee094cdf2 support annotations for admission webhook
Kubernetes-commit: 0ebfc3e07866494049f44cd008e5cbfe4d81d4af
2018-07-31 13:25:53 +08:00
jennybuckley fef02d6bec Add test cases for webhook dry run
Kubernetes-commit: 3a506be626398f927049c3ce735fd29ac0efd5f1
2018-08-07 14:59:29 -07:00
jennybuckley 53e7058d7c Fix typo in webhook dry-run check
Kubernetes-commit: aa36dc94cd7a2e538ad5e6ef8999fbbe9dc0df78
2018-08-07 14:37:24 -07:00
jennybuckley dc1d8e7050 block dry run if a webhook would be called
Kubernetes-commit: e4c219df42c77ecb8f0588197072bef81bca7429
2018-08-07 09:27:18 -07:00
jennybuckley 91278157f6 Support dry run in admission plugins
Kubernetes-commit: adafb1365e2b9f6c422c437e916e22a4fe1c2e3a
2018-08-06 10:37:44 -07:00
Cao Shufeng 0511e4e41d fix a TODO in ValidatingAdmissionWebhook
Kubernetes-commit: 162499515c0813f579770091dc30925207d063b2
2018-06-04 14:55:46 +08:00
Jordan Liggitt a1b44cc72f Do not attempt to convert nil object during DELETE webhook admission
Kubernetes-commit: aad0e2e15f789fc3768d6e5607b86e8b824b3917
2018-07-20 00:15:49 -04:00
Clayton Coleman 7694cbf962 generated: Avoid use of reflect.Call in conversion code paths
Kubernetes-commit: ef561ba8b58a4427a51b2b5dbb9ad633e45f04a7
2018-07-03 16:17:14 -04:00
Mikhail Mazurskiy 0f7bbcadfb Add missing error handling in schema-related code
Kubernetes-commit: bfe313d5f351dfae086a85a97e7103183173e5b5
2018-06-03 14:59:58 +10:00
Dmitry Rozhkov d51f943047 fix field removal in mutating admission webhooks
A mutating admission controller webhook doesn't remove object fields
when instructed to.

E.g. when the JSON patch

  [
    {"op": "remove", "path": "/spec/containers/0/resources/limits/fpga-arria10"},
    {"op": "add", "path": "/spec/containers/0/resources/limits/fpga-interface-id-524abcf", "value": 1}
  ]

is applied to this pod

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
spec:
  restartPolicy: Never
  containers:
    -
      name: test-pod-container
      image: ubuntu:bionic
      imagePullPolicy: IfNotPresent
      command: [ "ls", "-l", "/" ]
      resources:
        limits:
          fpga-arria10: 1

in order to replace the resource name "fpga-arria10" with something understandable
by the device plugin the resulting pod spec still contains the old field plus
a new one. The resulting pod looks like

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
spec:
  restartPolicy: Never
  containers:
    -
      name: test-pod-container
      image: ubuntu:bionic
      imagePullPolicy: IfNotPresent
      command: [ "ls", "-l", "/" ]
      resources:
        limits:
          fpga-arria10: 1
          fpga-interface-id-524abcf: 1

The patch unmarshals patched JSON into a new empty object instead of
existing one. Otherwise JSON unmarshaling reuses existing maps, keeping
existing entries as specified in the "encoding/json" standard package.

Kubernetes-commit: 4a72e17bd227b79ed89981735691af3601043bf9
2018-05-23 16:57:54 +03:00
Mikhail Mazurskiy 5b356b15a2 Use Dial with context
Kubernetes-commit: 5e8e570dbda6ed89af9bc2e0a05e3d94bfdfcb61
2018-05-19 08:14:37 +10:00
David Eads c41d1d0993 simplify api registration
Kubernetes-commit: c5445d3c56e06ab366b9cca34bd69c5cc386ec47
2018-05-07 08:32:20 -04:00
Matthias Bertschy 0203b2aa93 Update all script to use /usr/bin/env bash in shebang
Kubernetes-commit: 9b15af19b22e91284eeb89827b2091caaec25bf6
2018-04-16 18:31:44 +02:00
David Eads 88d943c0e6 eliminate indirection from type registration
Kubernetes-commit: e7fbbe0e3c91f34836b999e695aa133503cfdae5
2018-04-24 08:21:23 -04:00
Jordan Liggitt 62408eb418 Honor existing CA bundle and TLS server name in webhook client
Kubernetes-commit: 54c883f27bdb9ac1bd6602e34643296644e574f7
2018-04-17 01:01:30 -04:00
Dr. Stefan Schimanski 584fe98b64 admission/webhook: fix panic from empty response in mutating webhooks
Kubernetes-commit: 10969e1b8dcb89cc97d591df63be7464cefb454b
2018-02-12 14:58:57 +01:00
Dr. Stefan Schimanski 378bb80fc8 admission/webhook: refactor to webhook = generic-webhook + source + dispatcher
- unify test cases
- remove broken VersionedAttributes override abstraction

  This overriding had no effect. The versioned.Attributes were never
  used as admission.Attributes.Better make the versioned objects
  explicit than hiding them under a wrong abstraction.
- remove wrapping of scheme.Convert
- internalize conversion package

Kubernetes-commit: 72f8a369d021037ca6179339d50ad595b5462a6c
2018-01-16 10:37:41 +01:00
fisherxu 716af975eb regenerated all files and remove all YEAR fields
Kubernetes-commit: b49ef6531c11f1c834e0d7591f5c965f6193c711
2018-01-22 20:37:53 +08:00
Kubernetes Publisher 627fa76a8b sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:38:17 +00:00
Chao Xu f86f44d94d Make admission webhooks work in custom apiservers.
Created a scheme that only understands admission/v1beta1 and use it to
encode/decode admissionReviews.

Also made the NegotiationSerializer setup static

Kubernetes-commit: 3ab516035d17c2b2798797eb8ee85522ccbc051e
2018-03-09 11:25:34 -08:00
jennybuckley c28dea8a20 Make admission webhooks not ignore scheme
Kubernetes-commit: 7d5696eb6d98a0ce76e4fe18c3e37aec05060b46
2018-03-08 11:35:13 -08:00
jennybuckley 89e1aa5933 Prevent webhooks from affecting admission requests for webhooks
Kubernetes-commit: 58b43ad27d00191cf5291d8508dc346f1924b785
2018-03-05 16:35:52 -08:00
jennybuckley 9fa0aca343 Run hack/update-all.sh
Kubernetes-commit: c8dacd8e631f59ef158c79156d77a99fd2a632cc
2018-02-26 17:16:14 -08:00
Jeff Grafton 1ab12b2dc8 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
hzxuzhonghu 9535cc877f run update bazel staging-dep
Kubernetes-commit: ea7a71301009fb3e0426ea93f070c27538e59f86
2017-11-29 23:28:53 +08:00
hzxuzhonghu 3dc2191ae3 add wait ready for mutating/validating webhook configuration
Kubernetes-commit: ec3925978511cc6b844c5b479c9b30ae21a0136a
2017-12-06 11:06:04 +08:00
hzxuzhonghu 3661bfee32 admission registration use shared informer instead of poll
Kubernetes-commit: f2875274423dac61293069f79eddf1c397e7376a
2017-11-29 23:12:19 +08:00
halfcrazy 6f8c3a80da fix typo in package apiserver
Kubernetes-commit: 0da91a8577ddfdeaff985cbb6c0da69d5a2ffc81
2018-02-01 03:04:33 +08:00
Yang Guo 3db227c747 Split ClientConfigFor()
Kubernetes-commit: 05fbc22064b0502e3f66a60c82a34302850dcb41
2018-01-25 21:31:02 -08:00
Yang Guo 907f1ed78c Use SSH tunnel for webhook communication iff the webhook is deployed as a service
Kubernetes-commit: 454276c23ce39f261564e9cbebe0df8adab14a6d
2018-01-22 16:18:34 -08:00
Chao Xu fcee784ffb Never let cluster-scoped resources skip webhooks
Kubernetes-commit: 0d717272ccbec12189946325594a8a5f29d6bd68
2018-01-11 18:05:54 -08:00
Cao Shufeng 2a2505e824 remove duplicated import
Kubernetes-commit: 4e7398b67b12390486012dd6f9d708dd64f961f3
2018-01-11 19:15:11 +08:00
Cao Shufeng f193a275c6 remove invalid and useless functions from unit test
Kubernetes-commit: eb1650ce567e0bf19f310817502a7a4fe3049a11
2018-01-12 17:22:33 +08:00
Dr. Stefan Schimanski 574b95f04b admission: do not leak admission config types outside of the plugins
Kubernetes-commit: 1a552bbe149373c056ee004304d7e5abaa89f4c6
2017-11-27 14:44:04 +01:00
Chao Xu 0055602f99 fix a typo
Kubernetes-commit: 9d1b687914226514992d9f47c639847930d315b2
2018-01-11 18:24:24 -08:00
Chao Xu b0adab5a27 Let mutating webhook defaults the object after applying the patch sent back by the webhook
Kubernetes-commit: 5029bb56c434c0099fd1d2e78de7531c69430753
2018-01-09 15:58:18 -08:00
Christoph Blecker e0f0630269 Regenerate all generated code
Kubernetes-commit: 80e344644e2b6222296f2f03551a8d0273c7cbce
2018-01-02 00:21:07 -08:00
Jeff Grafton c8a97ee31a Autogenerate BUILD files
Kubernetes-commit: efee0704c60a2ee3049268a41535aaee7f661f6c
2017-12-23 13:06:26 -08:00
hzxuzhonghu d14a5efcb8 remove dead code in lifecycle admission
Kubernetes-commit: 22398f8d3c0d71db5869eace174f5721f8499224
2017-12-05 19:40:31 +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 98e2d6d11f remove reference to v1alpha1
Kubernetes-commit: 7945ae68d0c7cffb070d60ad4d8bfe6ef585c279
2017-11-19 13:54:50 -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
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
Dr. Stefan Schimanski 45dc4adcc3 admission/webhook: move webhook initializer into plugin
Kubernetes-commit: e19257f2ec87d8091defb7935bb3a161fbb229d0
2017-11-15 13:00:24 +01:00