# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: verrazzanomonitoringinstances.verrazzano.io
spec:
  conversion:
    strategy: None
  group: verrazzano.io
  names:
    kind: VerrazzanoMonitoringInstance
    listKind: VerrazzanoMonitoringInstanceList
    plural: verrazzanomonitoringinstances
    shortNames:
      - vmi
    singular: verrazzanomonitoringinstance
  scope: Namespaced
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            metadata:
              type: object
            spec:
              type: object
              properties:
                alertmanager:
                  type: object
                  properties:
                    config:
                      pattern: '[A-Za-z0-9-_]+'
                      type: string
                    configMap:
                      pattern: ^\w[^.]+$
                      type: string
                    versionsConfigMap:
                      type: string
                    replicas:
                      pattern: \d+
                      type: number
                    enabled:
                      type: boolean
                    resources:
                      type: object
                      properties:
                        limitCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        limitMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                  required:
                    - enabled
                api:
                  type: object
                  properties:
                    replicas:
                      pattern: \d+
                      type: number
                    resources:
                      type: object
                      properties:
                        limitCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        limitMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                autoSecret:
                  type: boolean
                elasticsearch:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    masterNode:
                      type: object
                      properties:
                        replicas:
                          pattern: \d+
                          type: number
                        javaOpts:
                          type: string
                        resources:
                          type: object
                          properties:
                            limitCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            limitMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                    dataNode:
                      type: object
                      properties:
                        replicas:
                          pattern: \d+
                          type: number
                        javaOpts:
                          type: string
                        resources:
                          type: object
                          properties:
                            limitCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            limitMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                    ingestNode:
                      type: object
                      properties:
                        replicas:
                          pattern: \d+
                          type: number
                        javaOpts:
                          type: string
                        resources:
                          type: object
                          properties:
                            limitCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            limitMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestCPU:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                            requestMemory:
                              pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                              type: string
                    storage:
                      type: object
                      properties:
                        availabilityDomain:
                          pattern: ^[A-Z]+(-?[A-Z0-9]+)*$
                          type: string
                        pvcNames:
                          items:
                            pattern: '[A-Za-z0-9-_]+'
                            type: string
                          minItems: 0
                          type: array
                        size:
                          pattern: ^[1-9]+\d*(Mi|Gi)$
                          type: string
                grafana:
                  type: object
                  properties:
                    dashboardsConfigMap:
                      pattern: ^\w[^.]+$
                      type: string
                    datasourcesConfigMap:
                      pattern: ^\w[^.]+$
                      type: string
                    enabled:
                      type: boolean
                    resources:
                      type: object
                      properties:
                        limitCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        limitMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                    storage:
                      type: object
                      properties:
                        availabilityDomain:
                          pattern: ^[A-Z]+(-?[A-Z0-9]+)*$
                          type: string
                        pvcNames:
                          items:
                            pattern: '[A-Za-z0-9-_]+'
                            type: string
                          minItems: 0
                          type: array
                        size:
                          pattern: ^[1-9]+\d*(Mi|Gi)$
                          type: string
                ingressTargetDNSName:
                  pattern: '[a-z]+[a-z0-9-.]*'
                  type: string
                kibana:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    replicas:
                      pattern: \d+
                      type: number
                    resources:
                      type: object
                      properties:
                        limitCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        limitMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                cascadingDelete:
                  type: boolean
                lock:
                  type: boolean
                prometheus:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    configMap:
                      pattern: ^\w[^.]+$
                      type: string
                    versionsConfigMap:
                      type: string
                    rulesConfigMap:
                      type: string
                    rulesVersionsConfigMap:
                      type: string
                    retentionPeriod:
                      pattern: \d+
                      type: number
                    replicas:
                      pattern: \d+
                      type: number
                    resources:
                      type: object
                      properties:
                        limitCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        limitMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        maxSizeDisk:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        minSizeDisk:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestCPU:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                        requestMemory:
                          pattern: ^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$
                          type: string
                    storage:
                      type: object
                      properties:
                        availabilityDomain:
                          pattern: ^[A-Z]+(-?[A-Z0-9]+)*$
                          type: string
                        pvcNames:
                          items:
                            pattern: '[A-Za-z0-9-_]+'
                            type: string
                          minItems: 0
                          type: array
                        size:
                          pattern: ^[1-9]+\d*(Mi|Gi)$
                          type: string
                secretsName:
                  pattern: ^\w[^.]+$
                  type: string
                serviceType:
                  pattern: '[A-Za-z0-9-_]+'
                  type: string
                slack:
                  type: object
                  properties:
                    id:
                      pattern: '[A-Za-z0-9-_]+'
                      type: string
                    url:
                      pattern: ^(http(s?)://)?((\w+\.)?\w+\.\w+|((2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})\.){3}(2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})(:[1-9]\d*)?)(/)?$
                      type: string
                uri:
                  pattern: '[A-Za-z0-9-_]+'
                  type: string
                versioning:
                  type: object
                  properties:
                    currentVersion:
                      pattern: '[A-Za-z0-9-_]+'
                      type: string
                    desiredVersion:
                      pattern: '[A-Za-z0-9-_]+'
                      type: string
                contactemail:
                  type: string
                natGatewayIPs:
                  items:
                    type: string
                  minItems: 0
                  type: array
          required:
            - metadata
            - spec
    