---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.15.0
  name: sonars.edp.epam.com
spec:
  group: edp.epam.com
  names:
    kind: Sonar
    listKind: SonarList
    plural: sonars
    singular: sonar
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: Is connected to sonar
      jsonPath: .status.connected
      name: Connected
      type: boolean
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: Sonar is the Schema for the sonars 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: SonarSpec defines the desired state of Sonar.
            properties:
              defaultPermissionTemplate:
                description: DefaultPermissionTemplate is the name of the default
                  permission template.
                example: Default template for projects
                type: string
              secret:
                description: |-
                  Secret is the name of the k8s object Secret related to sonar.
                  Secret should contain a user field with a sonar username and a password field with a sonar password.
                  Pass the token in the user field and leave the password field empty for token authentication.
                type: string
              settings:
                description: Settings specify which settings should be configured.
                items:
                  description: SonarSetting defines the setting of sonar.
                  properties:
                    fieldValues:
                      additionalProperties:
                        type: string
                      description: Setting field values. To set several values, the
                        parameter must be called once for each value.
                      example:
                        beginBlockRegexp: .*
                        endBlockRegexp: .*
                      type: object
                    key:
                      description: Key is the key of the setting.
                      example: sonar.core.serverBaseURL
                      type: string
                    value:
                      description: Value is the value of the setting.
                      example: https://my-sonarqube-instance.com
                      maxLength: 4000
                      type: string
                    valueRef:
                      description: ValueRef is a reference to a key in a ConfigMap
                        or a Secret.
                      example:
                        secretKeyRef:
                          key: my-key
                          name: my-secret
                      properties:
                        configMapKeyRef:
                          description: Selects a key of a ConfigMap.
                          properties:
                            key:
                              description: The key to select.
                              type: string
                            name:
                              description: |-
                                Name of the referent.
                                More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
                                TODO: Add other useful fields. apiVersion, kind, uid?
                              type: string
                          required:
                          - key
                          type: object
                          x-kubernetes-map-type: atomic
                        secretKeyRef:
                          description: Selects a key of a secret.
                          properties:
                            key:
                              description: The key of the secret to select from.
                              type: string
                            name:
                              description: |-
                                Name of the referent.
                                More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
                                TODO: Add other useful fields. apiVersion, kind, uid?
                              type: string
                          required:
                          - key
                          type: object
                          x-kubernetes-map-type: atomic
                      type: object
                    values:
                      description: Setting multi value. To set several values, the
                        parameter must be called once for each value.
                      example:
                      - '**/vendor/**'
                      - '**/tests/**'
                      items:
                        type: string
                      type: array
                  required:
                  - key
                  type: object
                type: array
              url:
                description: Url is the url of sonar instance.
                type: string
            required:
            - secret
            - url
            type: object
          status:
            description: SonarStatus defines the observed state of Sonar.
            properties:
              connected:
                description: Connected shows if operator is connected to sonar.
                type: boolean
              error:
                description: Error represents error message if something went wrong.
                type: string
              processedSettings:
                description: |-
                  ProcessedSettings shows which settings were processed.
                  It is used to compare the current settings with the settings that were processed
                  to unset the settings that are not in the current settings.
                type: string
              value:
                description: |-
                  Value is status of sonar instance.
                  Possible values:
                  GREEN: SonarQube is fully operational
                  YELLOW: SonarQube is usable, but it needs attention in order to be fully operational
                  RED: SonarQube is not operational
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
