8000 Add operator to manage any resource created and deleted · Issue #1126 · kubernetes-sigs/kwok · GitHub 8000
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add operator to manage any resource created and deleted #1126
Open
@wzshiming

Description

@wzshiming

What would you like to be added?

apiVersion: resource.operator.kwok.x-k8s.io/v1alpha1
kind: Resource
metadata:
  name: node-2c4g
spec:
  templateName: node
  replicas: 10
  parameters:
    allocatable:
      cpu: 2
      memory: 4Gi
---
apiVersion: resource.operator.kwok.x-k8s.io/v1alpha1
kind: Resource
metadata:
  name: node-4c8g
spec:
  templateName: node
  replicas: 10
  parameters:
    allocatable:
      cpu: 4
      memory: 8Gi
---
apiVersion: resource.operator.kwok.x-k8s.io/v1alpha1
kind: ResourceTemplate
metadata:
  name: node
spec:
  parameters:
    podCIDR: "10.0.0.1/24"
    allocatable:
      cpu: 32
      memory: 256Gi
      pods: 110
    capacity: {}
    nodeInfo:
      architecture: amd64
      operatingSystem: linux
  template: |-
    kind: Node
    apiVersion: v1
    metadata:
      name: {{ Name }}
      annotations:
        kwok.x-k8s.io/node: fake
        node.alpha.kubernetes.io/ttl: "0"
        metrics.k8s.io/resource-metrics-path: "/metrics/nodes/{{ Name }}/metrics/resource"
      labels:
        beta.kubernetes.io/arch: {{ .nodeInfo.architecture }}
        beta.kubernetes.io/os: {{ .nodeInfo.operatingSystem }}
        kubernetes.io/arch: {{ .nodeInfo.architecture }}
        kubernetes.io/hostname: {{ Name }}
        kubernetes.io/os: {{ .nodeInfo.operatingSystem }}
        kubernetes.io/role: agent
        node-role.kubernetes.io/agent: ""
        type: kwok
    spec:
      podCIDR: {{ AddCIDR .podCIDR Index }}
    status:
      allocatable:
      {{ range $key, $value := .allocatable }}
        {{ $key }}: {{ $value }}
      {{ end }}
      {{ $capacity := .capacity }}
      capacity:
      {{ range $key, $value := .allocatable }}
        {{ $key }}: {{ or ( index $capacity $key ) $value }}
      {{ end }}
      nodeInfo:
      {{ range $key, $value := .nodeInfo }}
        {{ $key }}: {{ $value }}
      {{ end }}

Why is this needed?

https://kubernetes.slack.com/archives/C04RG2YSK16/p1716989513415299?thread_ts=1716796734.402529&cid=C04RG2YSK16

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    Status

    📋 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0