Skip to content

Latest commit

 

History

History
1245 lines (1015 loc) · 37.6 KB

File metadata and controls

1245 lines (1015 loc) · 37.6 KB

OLM Descriptor Reference

  1. podCount
  2. resourceRequirements
  3. k8sResourcePrefix
  4. booleanSwitch
  5. checkbox
  6. text
  7. number
  8. password
  9. updateStrategy
  10. imagePullPolicy
  11. nodeAffinity
  12. podAffinity
  13. podAntiAffinity
  14. selector
  15. DEPRECATED fieldGroup
  16. DEPRECATED arrayFieldGroup
  17. select
  18. advanced
  19. endpointList
  20. fieldDependency
  21. hidden

  1. podStatuses
  2. w3Link
  3. conditions
  4. text
  5. k8sPhase
  6. k8sPhaseReason
  7. k8sResourcePrefix

  1. fieldGroup
  2. arrayFieldGroup

specDescriptors

A specDescriptor is for describing the property of a spec field in your Custom Resource. Each entry should contain the following:

  • displayName - The user-friendly name of the field
  • description - Concise information about what the field represents
  • path - The dot-delimited path of the field in the object
  • x-descriptors (Optional) - UI component information about the field capabilities

You can customize how a field is presented in the UI with a specDescriptor. Use a user-friendly displayName and concise description to overwrite the field name and potentially lengthy description of a field in the schema based on where the path is pointing to. This applies to any schema property and in any level of the nested structures.

The x-descriptors is used to determine which "capabilities" this descriptor has and which UI component to use on different views in the OpenShift Console.

For example, some x-descriptors also provides a "DISPLAY VIEW" that allows you to expose the specified schema property on Operand's Details view in the console as well as on the Creation Form. A canonical list of React UI x-descriptors for OpenShift can be found below.

You can see more information on Operand's Creation Forms.

x-descriptors

1. podCount

x-descriptors

This descriptor allows you to specify the number of pods for your instance. See example from [CSV] etcd Operator:


- displayName: Size
  description: The desired number of member Pods for the etcd cluster.
  path: size
  x-descriptors:
  - 'urn:alm:descriptor:com.tectonic.ui:podCount'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW

2. resourceRequirements

x-descriptors

This descriptor allows you to specify the mini/max amount of compute resources required/allowed. See example from [CSV] etcd Operator:


- description: Limits describes the minimum/maximum amount of compute resources
  required/allowed
displayName: Resource Requirements
path: pod.resources
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW - Resource Limits MODIFY VIEW - Resource Requests

3. k8sResourcePrefix

x-descriptors

This descriptor allows you to specify the prerequisite kubernetes object (e.g. Secrets, ServiceAccount, Service, ConfigMap, Namespace, etc) for your instance. See example from [CSV] Couchbase Operator:


- description: The name of the secret object that stores the server's TLS
  certificate.
displayName: Server TLS Secret
path: tls.static.member.serverSecret
x-descriptors:
- urn:alm:descriptor:io.kubernetes:Secret

With optional label selector being specified:


x-descriptors:
- urn:alm:descriptor:io.kubernetes:Deployment?tier!=frontend,environment in (production, qa)'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content of the actual kubernetes object being specified.

4. booleanSwitch

x-descriptors

This descriptor allows you to specify the true or false value for the configuration. See example from [CSV] Eclipse Che Operator:


- description: TLS routes
  displayName: TLS Mode
  path: server.tlsSupport
  x-descriptors:
    - urn:alm:descriptor:com.tectonic.ui:booleanSwitch

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW

5. checkbox

x-descriptors

This descriptor allows you to specify the true or false value for the configuration. See example for Business Automation Operator:


- displayName: ImageRegistry Insecure
  description: A flag used to indicate the specified registry is insecure.
  path: imageRegistry.insecure
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:checkbox'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Display View also serves as the Modify view.

6. text

x-descriptors

This descriptor allows you to specify a text input for a string data type. See example from [CSV] Portworx Operator:


- path: image
  displayName: Image
  description: The docker image name and version of Portworx Enterprise.
  x-descriptors:
  - 'urn:alm:descriptor:com.tectonic.ui:text'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content with YAML editor.

7. number

x-descriptors

This descriptor allows you to specify a number input for a number data type. See example from [CSV] KEDA Operator:


- displayName: Cooldown Period
  description: Cooldown Period
  path: cooldownPeriod
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:number'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content with YAML editor.

8. password

x-descriptors

This descriptor allows you to specify a text input for a password data type. See example for Grafana Operator:


- displayName: Admin Password
  description: The Admin Password of Grafana.
  path: adminPassword
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:password'

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content with YAML editor.

9. updateStrategy

x-descriptors

This descriptor allows you to specify the strategy of your pods being replaced when a new version of the deployment exist. See example for Portworx Operator:


- displayName: Update Strategy
  description: The update strategy of the deployment
  path: updateStrategy
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:updateStrategy'

UI

CREATION VIEW DISPLAY VIEW
[TODO] Missing the display of "Max Unavailable" and "Max Surge"

MODIFY VIEW

10. imagePullPolicy

x-descriptors

This descriptor allows you to specify the policy for pulling your container image. See example from [CSV] Appsody Operator:


- description: image pull policy for container image
  displayName: Pull Policy
  path: pullPolicy
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:imagePullPolicy

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
[TODO] * Currently Missing - The DISPLAY VIEW should be a text link to be able to access MODIFY VIEW that renders widget on the modal.

11. nodeAffinity

x-descriptors

This descriptor allows you to specify which nodes your pod is eligible to be scheduled on based on labels on the node. See example for Prometheus Operator:


- displayName: Node Affinity
  description: Node affinity is a group of node affinity scheduling
  path: affinity.nodeAffinity
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:nodeAffinity'

UI

CREATION VIEW DISPLAY VIEW
[TODO] cannot display the configuration

MODIFY VIEW
[TODO] * Currently Missing - The DISPLAY VIEW should be a text link to be able to access MODIFY VIEW that renders widget on the modal.

12. podAffinity

x-descriptors

This descriptor allows you to specify which nodes your pod is eligible to be scheduled based on labels on pods that are already running on the node. See example for Prometheus Operator:


- displayName: Pod Affinity
  description: Pod affinity is a group of inter pod affinity scheduling rules.
  path: affinity.podAffinity
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:podAffinity'

UI

CREATION VIEW DISPLAY VIEW
[TODO] cannot display the configuration

MODIFY VIEW
[TODO] * Currently Missing - The DISPLAY VIEW should be a text link to be able to access MODIFY VIEW that renders widget on the modal.

13. podAntiAffinity

x-descriptors

This descriptor allows you to specify which nodes your pod is eligible to be scheduled based on labels on pods that are already running on the node. See example for Prometheus Operator:


- displayName: Pod Anti Affinity
  description: Pod anti affinity is a group of inter pod anti affinity scheduling rules.
  path: affinity.podAntiAffinity
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:podAntiAffinity'

UI

CREATION VIEW DISPLAY VIEW
[TODO] cannot display the configuration

MODIFY VIEW
[TODO] * Currently Missing - The DISPLAY VIEW should be a text link to be able to access MODIFY VIEW that renders widget on the modal.

14. selector

x-descriptors

This descriptor allows you to specify labels for identifying a set of objects via a label selector (The label selector is the core grouping primitive in Kubernetes). See example from [CSV] Prometheus Operator:


- description: A selector for the ConfigMaps from which to load rule files
  displayName: Rule Config Map Selector
  path: ruleSelector
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:selector:core:v1:ConfigMap

UI

CREATION VIEW
[TODO] * Currently Missing - The CREATION VIEW should allow users to define “a set of labels” for “matchLabels”, similar to Console’s “Search” view.
DISPLAY VIEW
MODIFY VIEW
[TODO] Currently Missing

See Kubernetes doc for details in resources-that-support-set-based-requirement.

15. fieldGroup

This x-descriptor has been deprecated. See the entry in the deprecated section.

16. arrayFieldGroup

This x-descriptor has been deprecated. See the entry in the deprecated section.

17. select

x-descriptors

This descriptor allows you to specify a set of predefined options (e.g. enum: type) for a dropdownUI component. See example from [CSV] Strimzi Apache Kafka Operator:


- description: The type of storage used by Kafka brokers
  displayName: Kafka storage
  path: kafka.storage.type
  x-descriptors:
    - urn:alm:descriptor:com.tectonic.ui:select:ephemeral
    - urn:alm:descriptor:com.tectonic.ui:select:persistent-claim
    - urn:alm:descriptor:com.tectonic.ui:select:jbod

UI

CREATION VIEW DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content of the actual kubernetes object being specified.

18. advanced

x-descriptors

This descriptor allows you to specify fields as "Advanced Configurations" for any schema property. The advanced fields will be displayed within a collapsible section at the bottom of the parent schema structure. See example for Business Automation Operator:


- description: Selected if the image registry is insecure.
  displayName: Insecure
  path: imageRegistry.insecure
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
    - 'urn:alm:descriptor:com.tectonic.ui:advanced'
- description: >- Image registry's base 'url:port'. e.g. registry.example.com:5000.
        Defaults to 'registry.redhat.io'.
  displayName: Registry
  path: imageRegistry.registry
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:text'
    - 'urn:alm:descriptor:com.tectonic.ui:advanced'

UI

CREATION VIEW DISPLAY VIEW
[TODO] * Currently Missing.
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”.

19. endpointList

x-descriptors

This descriptor is created specifically for Prometheus Operator to specify a list of endpoints allowed for the ServiceMonitor it manages. See example from [CSV] Prometheus Operator:


- description: A list of endpoints allowed as part of this ServiceMonitor
  displayName: Endpoints
  path: endpoints
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:endpointList

UI

CREATION VIEW
* Currently, this descriptor does not provide “Creation View”.

DISPLAY VIEW
MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”. Users would have to edit the content with YAML editor.

20. fieldDependency

x-descriptors

This descriptor allows you to specify a field as the dependent of a Control Field and shows the Dependent Field when the current value of the Control Field is equal to the expected value:

'urn:alm:descriptor:com.tectonic.ui:fieldDependency:CONTROL_FIELD_PATH:EXPECTED_VALUE'

Usage

  1. Add "fieldDependency" to 'x-descriptors' array of the Dependent Field(s).
  2. Replace "CONTROL_FIELD_PATH" with the 'path' property of the Control Field object.
  3. Replace "EXPECTED_VALUE" with the actual expected value.

Requirements

  1. The Dependent Field will be exposed right after the Control Field on the form (ignores the rules mentioned in Ordering of Form Fields).
  2. The Dependent Field doesn't have to be a "leaf" in the schema.

The Dependent Field(s) will be displayed only when the current value of the Control Field is equal to the expected value.

Example


- displayName: Enable Upgrades
  description: >-
      Set true to enable automatic micro version product upgrades, it is disabled by default.
  path: upgrades.enabled
  x-descriptors:
      - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
- displayName: Include minor version upgrades
  description: >-
      Set true to enable automatic minor product version upgrades, it is
      disabled by default. Requires spec.upgrades.enabled to be true.
  path: upgrades.minor
  x-descriptors:
      - 'urn:alm:descriptor:com.tectonic.ui:fieldDependency:upgrades.enabled:true'
      - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'

UI

CREATION VIEW
* When "Enable Upgrades" (CONTROL FIELD) is set to "TRUE":
DISPLAY VIEW
[TODO] cannot display the dependency

MODIFY VIEW
* Currently, this descriptor does not provide “Modify View”.

21. hidden

x-descriptors

This descriptor allows you to exclude non-user facing fields from the "auto-generated creation form" by specifying them as "hidden" schema fields. See example for Portworx Operator:


 - displayName: HIDDEN FIELDS - Network and all its children fields
   description: >-
      HIDDEN FIELDS - The network related fields to be used by Portworx for data traffic.
   path: network
   x-descriptors:
     - 'urn:alm:descriptor:com.tectonic.ui:hidden'
 - displayName: HIDDEN FIELDS - Start Port
   description: >-
      HIDDEN FIELDS - It is the starting port in the range of ports used by Portworx.
   path: startPort
   x-descriptors:
     - 'urn:alm:descriptor:com.tectonic.ui:hidden'

Usage

  1. You can apply "hidden" to any schema property path (doesn't have to be a "leaf" in the schema). All the children properties, if any, will be hidden as well.
  2. The descriptor will hide the target property and all of its child fields.
  3. The field(s) will be hidden on the UI but can still be accessed through the YAML editor.

statusDescriptors

A statusDescriptor is for describing the property of a status field in your Custom Resource. The structure of the statusDescriptors is similar to specDescriptors and includes the same fields. The only difference is the set of valid x-descriptors described below.

x-descriptors

1. podStatuses

x-descriptors

This descriptor allows you to expose the status of pods for your instance. It expects the output format in the status block of your instance in:


status:
  [PATH_TO_THE_FIELD]:
    [STATE_1]:
      - [FIELD_MEMBER_NAME]
      - [FIELD_MEMBER_NAME]
      - [FIELD_MEMBER_NAME]
    [STATE_2]:
      - [FIELD_MEMBER_NAME]
      - [FIELD_MEMBER_NAME]
    [STATE_3]:
      - [FIELD_MEMBER_NAME]

Example

See example from [CSV] 3Scale Operator:


- displayName: Deployments
  description: API Manager Deployment Configs
  path: deployments
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:podStatuses'

The status block of the field being specified:


status:
  deployments:
    ready:
      - apicast-staging
      - system-memcache
      - system-redis
      - zync-database
    starting:
      - apicast-production
      - backend-cron
      - backend-listener
      - backend-redis
      - backend-worker
      - system-mysql
      - system-sidekiq
      - system-sphinx
      - zync
      - zync-que
    stopped:
      - system-app

On the DISPLAY VIEW:

Hover over to see the number of members in "ready" state.
Hover over to see the number of members in "starting" state.

2. w3Link

x-descriptors

This descriptor allows you to expose an external link of your instance. It expects the output format in the status block of your instance in:


status:
  [PATH_TO_THE_FIELD]: [FIELD_VALUE]

Example

See example from [CSV] Eclipse Che Operator:


- description: Route to access Eclipse Che
  displayName: Eclipse Che URL
  path: cheURL
  x-descriptors:
  - urn:alm:descriptor:org.w3:link

The status block of the field being specified:


status:
  
  cheURL: 'http://che-tony.apps.rhamilto.devcluster.openshift.com'

On the DISPLAY VIEW:

Click on the link sends users to target URL.
Hover over displayName shows descriptions on tooltip.

3. conditions

x-descriptors

This descriptor allows you to expose an array of PodConditions of your instance. It expects the output format in the status block of your instance in:


status:
  [PATH_TO]:
    conditions:
      - lastTransitionTime: [VALUE]
        lastUpdateTime: [VALUE]
        message: [VALUE]
        reason: [VALUE]
        status: [VALUE]
        type: [VALUE]

Example

See example from [CSV] Nexus Operator:


- displayName: Deployment Conditions
  description: Nexus server deployment conditions
  path: deploymentStatus.conditions
  x-descriptors:
    - 'urn:alm:descriptor:io.kubernetes.conditions'

The status block of the field being specified:


status:
  deploymentStatus:
    conditions:
      - lastTransitionTime: '2020-02-22T01:00:10Z'
        lastUpdateTime: '2020-02-22T01:00:10Z'
        message: Deployment does not have minimum availability.
        reason: MinimumReplicasUnavailable
        status: 'False'
        type: Available
      - lastTransitionTime: '2020-02-22T01:00:10Z'
        lastUpdateTime: '2020-02-22T01:00:10Z'
        message: ReplicaSet "nexus3-5dc585f884" is progressing.
        reason: ReplicaSetUpdated
        status: 'True'
        type: Progressing
  

On the DISPLAY VIEW:

Hover over displayName shows descriptions on tooltip.
* Note that Openshift Console shows `status.conditions` in a full-width table at the bottom of the object details view by default even without this "conditions" statusDescriptor.

4. text

x-descriptors

This descriptor allows you to expose the status field of your instance in plain text.

Example

See example from [CSV] Spark Operator:


- displayName: Application State
  description: Current state of the application.
  path: applicationState.state
  x-descriptors:
  - urn:alm:descriptor:text

The status block of the field being specified:


status:
  applicationState:
    state: SUBMITTED
  

On the DISPLAY VIEW:

Hover over displayName shows descriptions on tooltip.

5. k8sPhase

x-descriptors

This descriptor allows you to expose the status phase of your instance in plain text.

Example

See example from [CSV] KEDA Operator:


- path: phase
  description: Phase
  displayName: Phase
  x-descriptors:
    - 'urn:alm:descriptor:io.kubernetes.phase'

The status block of the field being specified:


status:
  phase: Installation Succeeded
  

On the DISPLAY VIEW:

6. k8sPhaseReason

x-descriptors

This descriptor allows you to expose the phase reason of your instance in plain text.

Example

See example from [CSV] KEDA Operator:


- path: reason
  description: Reason
  displayName: Reason
  x-descriptors:
    - 'urn:alm:descriptor:io.kubernetes.phase:reason'

The status block of the field being specified:


status:
  
  reason: KEDA v1.2.0 is installed in namespace 'keda'
  

On the DISPLAY VIEW:

7. k8sResourcePrefix

x-descriptors

This descriptor allows you to expose a kubernetes object for your instance.

Example

See example from [CSV] etcd Operator:


- description: The service at which the running etcd cluster can be accessed.
  displayName: Service
  path: serviceName
  x-descriptors:
    - urn:alm:descriptor:io.kubernetes:Service

The status block of the field being specified:


status:
  
  serviceName: example-client
  

On the DISPLAY VIEW:

Hover over displayName shows descriptions on tooltip.

DEPRECATED Descriptors

Label

x-descriptors [DEPRECATED]


x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:label'
  • Use text specDescriptor instead for string data type input/output.

namespaceSelector

x-descriptors [DEPRECATED]


x-descriptors:
    'urn:alm:descriptor:com.tectonic.ui:namespaceSelector'

fieldGroup

x-descriptors [DEPRECATED]

This x-descriptor is NO longer necessary.

Starting from OCP 4.5, the field grouping of object and array structures are now schema-based and auto-generated for the Creation View.

You can still overwrite the displayName and description for objects and/or arrays in the same way as individual fields. Simply use a specDescriptors directly against the object/array (no x-descriptors are necessary).

Example

See an example for Portworx Operator. To customize the displayName and fields on the "stork" object:

  1. Add a specDescriptor to overwrite the displayName with path property of the "stork".
  2. Add a specDescriptor with booleanSwitch x-descriptor, and path property of "stork.enabled".
  3. Add a specDescriptor with text x-descriptor, and path property of "stork.image".

- displayName: Stork Configurations
  description: Specifies the configurations for Stork.
  path: stork
- displayName: Enabled
  description: Specifies if Stork is enabled.
  path: stork.enabled
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
- displayName: Image
  description: The docker image name and version of Stork.
  path: stork.image
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:text'

UI

CREATION VIEW DISPLAY VIEW
[TODO] Cannot display fields in a group

MODIFY VIEW
[TODO] * Currently Missing

arrayFieldGroup

x-descriptors [DEPRECATED]

This x-descriptor is NO longer necessary.

Starting from OCP 4.5, the grouping of object and array structures are now schema-based and auto-generated in the Creation View.

You can still provide your own displayName and description for objects and/or arrays in the same way as individual fields. Simply use a specDescriptor directly against the object/array (no x-descriptors are necessary).

Example

See an example for Strimzi Operator. To customize the displayName and fields on the "overrides" (kafka.storage.overrides) array structure:

  1. Add a specDescriptor to overwrite the displayName with path property "kafka.storage.overrides".

  2. Add a specDescriptor with number x-descriptor, and path property of "kafka.storage.overrides[0].broker".

Note: Need to add the "array index notation" in the path property of the descriptor
  1. Add a specDescriptor with text x-descriptor, and path property of "kafka.storage.overrides[0].class".
Note: Need to add the "array index notation" in the path property of the descriptor

- displayName: Kafka Storage Override Configurations
  description: Specifies the configurations for storage overrides.
  path: kafka.storage.overrides
- description: The Broker ID to be assigned with the specified Storage Class.
  displayName: Broker ID
  path: kafka.storage.overrides[0].broker
  x-descriptors:
    - 'urn:alm:descriptor:com.tectonic.ui:number'
- description: The Storage Class to be assigned.
  displayName: Storage Class
  path: kafka.storage.overrides[0].class
  x-descriptors:
    - 'urn:alm:descriptor:io.kubernetes:StorageClass'

UI

CREATION VIEW
Note: The * required field has a higher "sort weight" and will be rendered earlier in the form.

In this example, "Kafka Storage" (kafka.storage.type) is a required field of "Storage" (kafka.storage) object, so it is rendered before "Kafka Storage Override Configurations" (kafka.storage.overrides) array structure.

See more information on Ordering of Form Fields.
DISPLAY VIEW
[TODO] Cannot display fields in a group

MODIFY VIEW
[TODO] * Currently Missing