Giter Club home page Giter Club logo

Comments (6)

wzshiming avatar wzshiming commented on August 22, 2024
# oom.yaml
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
  name: oom
spec:
  resourceRef:
    apiGroup: v1
    kind: Pod
  selector:
    matchExpressions:
    - key: .status.phase
      operator: In
      values:
      - Running
    matchExtraResources:
    - resourceRef:
        apiGroup: custom.metrics.k8s.io/v1beta2
        kind: MetricValue
      selector:
        matchCEL:
        - expression: |
            self.metadata.name == target.metadata.name &&
            self.metadata.namespace == target.metadata.namespace &&
            OOM(self.spec.containers, target.spec.containers)
  next:
    patches:
    - subresource: status
      root: status
      template: |
        {{ $now := Now }}
        {{ $root := target }}
        conditions:
        - lastProbeTime: null
          lastTransitionTime: {{ $now | Quote }}
          message: ''
          reason: ''
          status: "False"
          type: Ready
        - lastProbeTime: null
          lastTransitionTime: {{ $now | Quote }}
          message: ''
          reason: ''
          status: "True"
          type: OutOfMemory
        containerStatuses:
        {{ range $index, $item := .spec.containers }}
        {{ $origin := index $root.status.containerStatuses $index }}
        - image: {{ $item.image | Quote }}
          name: {{ $item.name | Quote }}
          ready: false
          restartCount: {{ $origin.restartCount }}
          started: false
          state:
            terminated:
              exitCode: 137
              finishedAt: {{ $now | Quote }}
              reason: OOMKilled
              startedAt: {{ $now | Quote }}
        {{ end }}
        phase: Failed

from kwok.

wzshiming avatar wzshiming commented on August 22, 2024
# node-image-exists.yaml
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
  name: node-image-exists
spec:
  resourceRef:
    apiGroup: v1
    kind: Node
  selector:
    matchExtraResources:
    - resourceRef:
        apiGroup: v1
        kind: Pod
      selector:
        matchExpressions:
        - key: .status.phase
          operator: In
          values:
          - Running
          - ContainerCreating
  next:
    patches:
    - subresource: status
      root: status
      template: |
        {{ $exist := list }}
        images:
        {{ range .status.images }}
        - names:
          {{ range .names }}
          {{ $exist = append $exist . }}
          - {{ . | Quote }}
          {{ end }}
          {{ if .sizeBytes }}
          sizeBytes: {{ .sizeBytes }}
          {{ end }}
        {{ end }}
        
        {{ range matchExtraResources }}
        {{ range .spec.containers }}
        {{ if not (in $exist .image) }}
        - names:
          - {{ .image | Quote }}
        {{ end }}
        {{ end }}
        {{ end }}

from kwok.

caozhuozi avatar caozhuozi commented on August 22, 2024

Whats the major difference between Trigger and Stage v1alpha2? Do they have any overlap in functionality?

from kwok.

wzshiming avatar wzshiming commented on August 22, 2024

Whats the major difference between Trigger and Stage v1alpha2?

Trigger can be thought of as a Stage between different resources.

from kwok.

wzshiming avatar wzshiming commented on August 22, 2024

Redesigning the API to put it in Stage

from kwok.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.