bmson7112 / TTS-VTNet

1 stars 0 forks source link

Kubernetes operator #14

Open bmson7112 opened 1 year ago

bmson7112 commented 1 year ago

Operator thường được sử dụng cho các ứng dụng stateful nhằm tự động hóa 1 số đầu việc như:

Với 1 app, nó sẽ có trạng thái hiện có và trạng thái mong muốn nó phải đạt được, thì operator chính là thứ giúp thực hiện được công việc này . Nó cung cấp khả năng tự động hóa mạnh mẽ cho những tài nguyên mà nó quản lý

Custom resource:

Custom Controller

Sử dụng Custom Resource khi:

CRD:

Ví dụ về 1 file CRD:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: blogposts.iximiuz.com
spec:
  group: iximiuz.com
  names:
    kind: BlogPost
    listKind: BlogPostList
    plural: blogposts
    singular: blogpost
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: BlogPost is a custom resource exemplar
        type: object
        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: BlogPostSpec is the spec for a BlogPost resource
            type: object
            properties:
              title:
                type: string
              author:
                type: string
          status:
            description: BlogPostStatus is the status for a BlogPost resource
            type: object
            properties:
              publishedAt:
                type: string
    served: true
    storage: true
    subresources:
      status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []

Các mức độ, khả năng của operator

image