Linux - K8S - 调度策略 - CRD扩展

## CRD实践

```sh
# 因为实际中,我们CRD都是根据业务需求去使用它,关键在于我们如何在控制器和operator中如何使用它

[23:07:07 root@master1 scheduler]#cat 17-scheduler-crd-user-v1.yaml 
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: users.auth.ilinux.io
spec:
  group: auth.ilinux.io
  names:
    kind: User
    plural: users
    singular: user
    shortNames: 
    - u
  scope: Namespaced
  versions:
  - served: true
    storage: true
    name: v1alpha1
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              userID:
                type: integer
                minimum: 1
                maximum: 65535
              groups:
                type: array
                items:
                  type: string
              email:
                type: string
              password:
                type: string
                format: password
            required: ["userID","groups"]

[23:09:25 root@master1 scheduler]#cat 18-scheduler-crd-user-v1-test.yaml 
apiVersion: auth.ilinux.io/v1alpha1
kind: User
metadata:
  name: admin
  namespace: default
spec:
  userID: 1
  email: noisedu@example.com
  groups:
  - superusers
  - adminstrators
  password: www.example.com

```

  

posted @ 2022-01-16 23:14  每天都在学习的自己  阅读(132)  评论(0)    收藏  举报