---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.14.0
  name: appgroups.appgroup.diktyo.x-k8s.io
spec:
  group: appgroup.diktyo.x-k8s.io
  names:
    kind: AppGroup
    listKind: AppGroupList
    plural: appgroups
    shortNames:
    - ag
    singular: appgroup
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: AppGroup is a collection of Pods belonging to the same application.
        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: AppGroupSpec defines the number of Pods and which Pods belong
              to the group.
            properties:
              numMembers:
                description: NumMembers defines the number of Pods belonging to the
                  App Group
                format: int32
                minimum: 1
                type: integer
              topologySortingAlgorithm:
                description: The preferred Topology Sorting Algorithm
                type: string
              workloads:
                description: Workloads defines the workloads belonging to the group
                items:
                  description: AppGroupWorkload represents the Workloads belonging
                    to the App Group.
                  properties:
                    dependencies:
                      description: Dependencies of the Workload.
                      items:
                        description: DependenciesInfo contains information about one
                          dependency.
                        properties:
                          maxNetworkCost:
                            description: Max Network Cost between workloads
                            format: int64
                            maximum: 10000
                            minimum: 0
                            type: integer
                          minBandwidth:
                            anyOf:
                            - type: integer
                            - type: string
                            description: MinBandwidth between workloads
                            pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                            x-kubernetes-int-or-string: true
                          workload:
                            description: Workload reference Info.
                            properties:
                              apiVersion:
                                description: ApiVersion defines the versioned schema
                                  of an object.
                                type: string
                              kind:
                                description: 'Kind of the workload, info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"'
                                type: string
                              name:
                                description: 'Name represents the workload, info:
                                  http://kubernetes.io/docs/user-guide/identifiers#names'
                                type: string
                              namespace:
                                description: Namespace of the workload
                                type: string
                              selector:
                                description: Selector defines how to find Pods related
                                  to the Workload (key = workload). (e.g., workload=w1)
                                type: string
                            required:
                            - kind
                            - name
                            - selector
                            type: object
                        required:
                        - workload
                        type: object
                      type: array
                    workload:
                      description: Workload reference Info.
                      properties:
                        apiVersion:
                          description: ApiVersion defines the versioned schema of
                            an object.
                          type: string
                        kind:
                          description: 'Kind of the workload, info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"'
                          type: string
                        name:
                          description: 'Name represents the workload, info: http://kubernetes.io/docs/user-guide/identifiers#names'
                          type: string
                        namespace:
                          description: Namespace of the workload
                          type: string
                        selector:
                          description: Selector defines how to find Pods related to
                            the Workload (key = workload). (e.g., workload=w1)
                          type: string
                      required:
                      - kind
                      - name
                      - selector
                      type: object
                  required:
                  - workload
                  type: object
                type: array
            required:
            - numMembers
            - topologySortingAlgorithm
            - workloads
            type: object
          status:
            description: AppGroupStatus defines the observed use.
            properties:
              runningWorkloads:
                description: The number of actively running workloads (e.g., number
                  of pods).
                format: int32
                minimum: 0
                type: integer
              scheduleStartTime:
                description: ScheduleStartTime of the group
                format: date-time
                type: string
              topologyCalculationTime:
                description: TopologyCalculationTime of the group
                format: date-time
                type: string
              topologyOrder:
                description: Topology order for TopSort plugin (QueueSort)
                items:
                  description: AppGroupTopologyInfo represents the calculated order
                    for a given Workload.
                  properties:
                    index:
                      description: Topology index.
                      format: int32
                      type: integer
                    workload:
                      description: Workload reference Info.
                      properties:
                        apiVersion:
                          description: ApiVersion defines the versioned schema of
                            an object.
                          type: string
                        kind:
                          description: 'Kind of the workload, info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"'
                          type: string
                        name:
                          description: 'Name represents the workload, info: http://kubernetes.io/docs/user-guide/identifiers#names'
                          type: string
                        namespace:
                          description: Namespace of the workload
                          type: string
                        selector:
                          description: Selector defines how to find Pods related to
                            the Workload (key = workload). (e.g., workload=w1)
                          type: string
                      required:
                      - kind
                      - name
                      - selector
                      type: object
                  type: object
                type: array
            type: object
        type: object
    served: true
    storage: true
