1. 23 Feb, 2018 28 commits
  2. 22 Feb, 2018 12 commits
    • Kubernetes Submit Queue's avatar
      Merge pull request #59952 from resouer/consts-handler · a195a761
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      Use consts as predicate key names in handlers
      
      **What this PR does / why we need it**:
      
      Per discussion in: https://github.com/kubernetes/kubernetes/pull/59335/files#r168351460
      
      **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
      Fixes #59951
      
      **Special notes for your reviewer**:
      
      **Release note**:
      
      ```release-note
      Use consts as predicate name in handlers
      ```
      a195a761
    • Kubernetes Submit Queue's avatar
      Merge pull request #55168 from nikhita/customresources-subresources · 6e856480
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      apiextensions: add subresources for custom resources
      
      Fixes #38113
      Fixes #58778
      
      **Related**:
      - Proposal: https://github.com/kubernetes/community/pull/913
      - For custom resources to work with `kubectl scale`: https://github.com/kubernetes/kubernetes/pull/58283
      
      **Add types**:
      
      - Add `CustomResourceSubResources` type to CRD.
          - Fix proto generation for `CustomResourceSubResourceStatus`: https://github.com/kubernetes/kubernetes/pull/55970.
      - Add feature gate for `CustomResourceSubResources`.
          - Update CRD strategy: if feature gate is disabled, this feature is dropped (i.e. set to `nil`).
      - Add validation for `CustomResourceSubResources`:
          - `SpecReplicasPath` should not be empty and should be a valid json path under `.spec`. If there is no value under the given path in the CustomResource, the `/scale` subresource will return an error on GET.
          - `StatusReplicasPath` should not be empty and should be a valid json path under `.status`. If there is no value under the given path in the CustomResource, the status replica value in the /scale subresource will default to 0.
          - If present, `LabelSelectorPath` should be a valid json path. If there is no value under `LabelSelectorPath` in the CustomResource, the status label selector value in the `/scale` subresource will default to the empty string.
          - `ScaleGroupVersion` should be `autoscaling/v1`.
          - If `CustomResourceSubResources` is enabled, only `properties` is allowed under the root schema for CRD validation.
      
      **Add status and scale subresources**:
      
      - Use helper functions from `apimachinery/pkg/apis/meta/v1/unstructured/helpers.go`.
          - Improve error handling: https://github.com/kubernetes/kubernetes/pull/56563, https://github.com/kubernetes/kubernetes/pull/58215.
      - Introduce Registry interface for storage.
      - Update storage:
          - Introduce `CustomResourceStorage` which acts as storage for the custom resource and its status and scale subresources. Note: storage for status and scale is only enabled when the feature gate is enabled _and_ the respective fields are enabled in the CRD.
          - Introduce `StatusREST` and its `New()`, `Get()` and `Update()` methods.
          - Introduce `ScaleREST` and its `New()`, `Get()` and `Update()` methods.
              - Get and Update use the json paths from the CRD and use it to return an `autoscaling/v1.Scale` object.
      - Update strategy:
          - In `PrepareForCreate`,
               - Clear `.status`.
               - Set `.metadata.generation` = 1
          - In `PrepareForUpdate`,
               - Do not update `.status`.
                   - If both the old and new objects have `.status` and it is changed, set it back to its old value.
                   - If the old object has a `.status` but the new object doesn't, set it to the old value.
                   - If old object did not have a `.status` but the new object does, delete it.
               - Increment generation if spec changes i.e. in the following cases:
                   - If both the old and new objects had `.spec` and it changed.
                   - If the old object did not have `.spec` but the new object does.
                   - If the old object had a `.spec` but the new object doesn't.
           - In `Validate` and `ValidateUpdate`,
              - ensure that values at `specReplicasPath` and `statusReplicasPath` are >=0 and < maxInt32.
              - make sure there are no errors in getting the value at all the paths.
          - Introduce `statusStrategy` with its methods.
              - In `PrepareForUpdate`:
                  - Do not update `.spec`.
                      - If both the old and new objects have `.spec` and it is changed, set it back to its old value.
                      - If the old object has a `.spec` but the new object doesn't, set it to the old value.
                      - If old object did not have a `.spec` but the new object does, delete it.
                   - Do not update `.metadata`.
              - In `ValidateStatusUpdate`:
                  - For CRD validation, validate only under `.status`.
                  - Validate value at `statusReplicasPath` as above. If `labelSelectorPath` is a path under `.status`, then validate it as well.
      - Plug into the custom resource handler:
          - Store all three storage - customResource, status and scale in `crdInfo`.
          - Use the storage as per the subresource in the request.
          - Use the validator as per the subresource (for status, only use the schema for `status`, if present).
          - Serve the endpoint as per the subresource - see `serveResource`, `serveStatus` and `serveScale`.
      - Update discovery by adding the `/status` and `/scale` resources, if enabled.
      
      **Add tests**:
      
      - Add unit tests in `etcd_test.go`.
      - Add integration tests.
          - In `subresources_test.go`, use the [polymporphic scale client](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go/scale) to get and update `Scale`.
          -  Add a test to check everything works fine with yaml in `yaml_test.go`.
      
      **Release note**:
      
      ```release-note
      `/status` and `/scale` subresources are added for custom resources.
      ```
      6e856480
    • Slava Semushin's avatar
      examples/podsecuritypolicy: add owners. · e69e8799
      Slava Semushin authored
      e69e8799
    • Kubernetes Submit Queue's avatar
      Merge pull request #60131 from soltysh/integration_fixes_followup · fd1527a9
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      Return information about which int tests failed in the summary - followup
      
      @stevekuznetsov you asked about it in https://github.com/kubernetes/kubernetes/pull/59486#discussion_r169351176
      
      /assign @stevekuznetsov 
      
      
      **Release note**:
      ```release-note
      NONE
      ```
      fd1527a9
    • Nikhita Raghunath's avatar
      update generated files · 55ce3ded
      Nikhita Raghunath authored
      55ce3ded
    • Nikhita Raghunath's avatar
      add subresources for custom resources · 6fbe8157
      Nikhita Raghunath authored
      6fbe8157
    • Kubernetes Submit Queue's avatar
      Merge pull request #60186 from feiskyer/vmss-check · a4222bd8
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      Cleanup node type checking for azure nodes
      
      **What this PR does / why we need it**:
      
      This PR cleanup node type checking for azure nodes. It also fixes a problem of `instance not found` error for VMAS nodes in vmss cluster (vmType set to vmss):
      
      ```
      ss.GetPrimaryInterface(k8s-master), ss.getCachedVirtualMachine(k8s-master), err=instance not found
      ```
      
      **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
      Fixes #60185
      
      **Special notes for your reviewer**:
      
      **Release note**:
      
      ```release-note
      NONE
      ```
      a4222bd8
    • Kubernetes Submit Queue's avatar
      Merge pull request #59264 from atlassian/set-gvk-on-conversion-to-unstructured · aded0d92
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      Conversion from typed to unstructured should set GVK
      
      **What this PR does / why we need it**:
      By convention typed objects do not have `TypeMeta` information filled. When the scheme converts a typed object into Unstructured it should set type meta information explicitly otherwise Unstructured object is not recognizable.
      
      **Special notes for your reviewer**:
      Bug was not visible to tests because tests were working with a typed object with `TypeMeta` information filled. It was filled by previous tests. I have refactored tests for better isolation. Also fixed some other issues in tests.
      
      Add `?w=1` to the PR's URL to see the diff with whitespace changes ignored.
      
      **Release note**:
      ```release-note
      NONE
      ```
      /kind bug
      /sig api-machinery
      /cc @smarterclayton @deads2k
      aded0d92
    • Dr. Stefan Schimanski's avatar
      Fix nsenter on Mac · 061a4512
      Dr. Stefan Schimanski authored
      061a4512
    • Maciej Pytel's avatar
      Validation for HPA external metrics · 602aaaf0
      Maciej Pytel authored
      602aaaf0
    • Kubernetes Submit Queue's avatar
      Merge pull request #60095 from MrHohn/addon-manager-bump-istio · 839adb86
      Kubernetes Submit Queue authored
      Automatic merge from submit-queue. 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>.
      
      Bump addon-manager to v8.6
      
      **What this PR does / why we need it**:
      Follow up of https://github.com/kubernetes/kubernetes/pull/59378, build & push a new addon-manager image to pick up the namespace change to support istio addon.
      
      Pushed images for {amd64, arm, arm64, ppc64le, s390x}.
      
      **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
      Fixes #NONE 
      
      **Special notes for your reviewer**:
      /assign @mikedanese @ostromart 
      
      **Release note**:
      
      ```release-note
      NONE
      ```
      839adb86
    • Maciej Szulik's avatar