apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: consoleplugins.console.openshift.io
spec:
  conversion:
    strategy: None
  group: console.openshift.io
  names:
    kind: ConsolePlugin
    listKind: ConsolePluginList
    plural: consoleplugins
    singular: consoleplugin
  scope: Cluster
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: "ConsolePlugin is an extension for customizing OpenShift web
          console by dynamically loading code from another service running on the
          cluster. \n Compatibility level 4: No compatibility is provided, the API
          can change at any point for any reason. These capabilities should not be
          used by applications needing long term support."
        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: ConsolePluginSpec is the desired plugin configuration.
            properties:
              displayName:
                description: displayName is the display name of the plugin.
                minLength: 1
                type: string
              proxy:
                description: proxy is a list of proxies that describe various service
                  type to which the plugin needs to connect to.
                items:
                  description: ConsolePluginProxy holds information on various service
                    types to which console's backend will proxy the plugin's requests.
                  properties:
                    alias:
                      description: "alias is a proxy name that identifies the plugin's
                        proxy. An alias name should be unique per plugin. The console
                        backend exposes following proxy endpoint: \n /api/proxy/plugin/<plugin-name>/<proxy-alias>/<request-path>?<optional-query-parameters>
                        \n Request example path: \n /api/proxy/plugin/acm/search/pods?namespace=openshift-apiserver"
                      maxLength: 128
                      minLength: 1
                      pattern: ^[A-Za-z0-9-_]+$
                      type: string
                    authorize:
                      default: false
                      description: "authorize indicates if the proxied request should
                        contain the logged-in user's OpenShift access token in the
                        \"Authorization\" request header. For example: \n Authorization:
                        Bearer sha256~kV46hPnEYhCWFnB85r5NrprAxggzgb6GOeLbgcKNsH0
                        \n By default the access token is not part of the proxied
                        request."
                      type: boolean
                    caCertificate:
                      description: caCertificate provides the cert authority certificate
                        contents, in case the proxied Service is using custom service
                        CA. By default, the service CA bundle provided by the service-ca
                        operator is used.
                      pattern: ^-----BEGIN CERTIFICATE-----([\s\S]*)-----END CERTIFICATE-----\s?$
                      type: string
                    service:
                      description: 'service is an in-cluster Service that the plugin
                        will connect to. The Service must use HTTPS. The console backend
                        exposes an endpoint in order to proxy communication between
                        the plugin and the Service. Note: service field is required
                        for now, since currently only "Service" type is supported.'
                      properties:
                        name:
                          description: name of Service that the plugin needs to connect
                            to.
                          maxLength: 128
                          minLength: 1
                          type: string
                        namespace:
                          description: namespace of Service that the plugin needs
                            to connect to
                          maxLength: 128
                          minLength: 1
                          type: string
                        port:
                          description: port on which the Service that the plugin needs
                            to connect to is listening on.
                          format: int32
                          maximum: 65535
                          minimum: 1
                          type: integer
                      required:
                      - name
                      - namespace
                      - port
                      type: object
                    type:
                      description: type is the type of the console plugin's proxy.
                        Currently only "Service" is supported.
                      pattern: ^(Service)$
                      type: string
                  required:
                  - alias
                  - type
                  type: object
                type: array
              service:
                description: service is a Kubernetes Service that exposes the plugin
                  using a deployment with an HTTP server. The Service must use HTTPS
                  and Service serving certificate. The console backend will proxy
                  the plugins assets from the Service using the service CA bundle.
                properties:
                  basePath:
                    default: /
                    description: basePath is the path to the plugin's assets. The
                      primary asset it the manifest file called `plugin-manifest.json`,
                      which is a JSON document that contains metadata about the plugin
                      and the extensions.
                    minLength: 1
                    pattern: ^/
                    type: string
                  name:
                    description: name of Service that is serving the plugin assets.
                    maxLength: 128
                    minLength: 1
                    type: string
                  namespace:
                    description: namespace of Service that is serving the plugin assets.
                    maxLength: 128
                    minLength: 1
                    type: string
                  port:
                    description: port on which the Service that is serving the plugin
                      is listening to.
                    format: int32
                    maximum: 65535
                    minimum: 1
                    type: integer
                required:
                - basePath
                - name
                - namespace
                - port
                type: object
            required:
            - service
            type: object
        required:
        - metadata
        - spec
        type: object
    served: true
    storage: true
