Cluster information:
Kubernetes version: v1.19
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS: CentOS
CNI and version:
CRI and version:
Hi! I’m writing to call for help about how to define a CRD with recursive structs. My requirements are as follows:
I want to defnie a CRD to represent hierarchical queue. Just like this
root
├─ n1
│ ├─ n1,1
│ ├─ n1,2
│ └─ n1,3
├─ n2
│ ├─ n2,1
│ ├─ n2,2
In the hierarchical queue above, root represents the root node. Other nodes are with the same struct defined as follows:
type node struct {
parent *node
weight int
}
So how can I define the CRD HierarchicalQueue
in spec? THX.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.0
creationTimestamp: null
name: hierarchicalqueue.scheduling.volcano.sh
spec:
group: scheduling.volcano.sh
names:
kind: HierarchicalQueue
shortNames:
- hq
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HierarchicalQueue is the Schema for the Hierarchical Queue API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Specification of the hierarchical queue
properties:
queues:
## TODO: definition of queues recursively
served: true
storage: true