1. 11 Jun, 2018 4 commits
    • David Ashpole's avatar
    • Kubernetes Submit Queue's avatar
      Merge pull request #64916 from mfojtik/ds-01-improve-mem-usage · e6f64d0a
      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>.
      
      improve memory footprint of daemonset simulate
      
      **What this PR does / why we need it**:
      
      This is an alternative for https://github.com/kubernetes/kubernetes/pull/64915 (it might be not needed if that PR will merge)
      
      During memory profiling of OpenShift, we noticed a significant amount of object allocations done by `IsControlledBy()`. @sttts found that the `GetObjectReferences()` method is doing a deep-copy of the object references. 
      
      ![screen shot 2018-06-08 at 14 22 59](https://user-images.githubusercontent.com/44136/41157922-7af953f2-6b27-11e8-9a16-bda8c3edfe07.png)
      
      This PR simplify the `IsControlledBy()` to just iterate over the ownerRefs, without copying them. 
      
      **Release note**:
      
      ```release-note
      NONE
      ```
      e6f64d0a
    • Kubernetes Submit Queue's avatar
      Merge pull request #64255 from rojkov/fix-field-removal · d70e7844
      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>.
      
      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.
      
      **Release note**:
      ```release-note
      Webhooks for the mutating admission controller now support "remove" operation.
      ```
      d70e7844
    • Dmitry Rozhkov's avatar
      fix field removal in mutating admission webhooks · 4a72e17b
      Dmitry Rozhkov authored
      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.
      4a72e17b
  2. 09 Jun, 2018 1 commit
  3. 08 Jun, 2018 5 commits
  4. 07 Jun, 2018 22 commits
  5. 06 Jun, 2018 8 commits