Deploy your plugin on a cluster

You can deploy the plugin to a OKD cluster.

Build an image with Docker

To deploy your plugin on a cluster, you need to build an image and push it to an image registry.

Procedure

  1. Build the image with the following command:

    1. $ docker build -t quay.io/my-repositroy/my-plugin:latest .
  2. Optional: If you want to test your image, run the following command:

    1. $ docker run -it --rm -d -p 9001:80 quay.io/my-repository/my-plugin:latest
  3. Push the image by running the following command:

    1. $ docker push quay.io/my-repository/my-plugin:latest

Deploy your plugin on a cluster

After pushing an image with your changes to a registry, you can deploy the plugin to a cluster.

Procedure

  1. To deploy your plugin to a cluster, install a Helm chart with the name of the plugin as the Helm release name into a new namespace or an existing namespace as specified by the -n command-line option. Provide the location of the image within the plugin.image parameter by using the following command:

    1. $ helm upgrade -i my-plugin charts/openshift-console-plugin -n my-plugin-namespace --create-namespace --set plugin.image=my-plugin-image-location

    Where:

    n <my-plugin-namespace>

    Specifies an existing namespace to deploy your plugin into.

    --create-namespace

    Optional: If deploying to a new namespace, use this parameter.

    --set plugin.image=my-plugin-image-location

    Specifies the location of the image within the plugin.image parameter.

  2. Optional: You can specify any additional parameters by using the set of supported parameters in the charts/openshift-console-plugin/values.yaml file.

  1. plugin:
  2. name: ""
  3. description: ""
  4. image: ""
  5. imagePullPolicy: IfNotPresent
  6. replicas: 2
  7. port: 9443
  8. securityContext:
  9. enabled: true
  10. podSecurityContext:
  11. enabled: true
  12. runAsNonRoot: true
  13. seccompProfile:
  14. type: RuntimeDefault
  15. containerSecurityContext:
  16. enabled: true
  17. allowPrivilegeEscalation: false
  18. capabilities:
  19. drop:
  20. - ALL
  21. resources:
  22. requests:
  23. cpu: 10m
  24. memory: 50Mi
  25. basePath: /
  26. certificateSecretName: ""
  27. serviceAccount:
  28. create: true
  29. annotations: {}
  30. name: ""
  31. patcherServiceAccount:
  32. create: true
  33. annotations: {}
  34. name: ""
  35. jobs:
  36. patchConsoles:
  37. enabled: true
  38. image: "registry.redhat.io/openshift4/ose-tools-rhel8@sha256:e44074f21e0cca6464e50cb6ff934747e0bd11162ea01d522433a1a1ae116103"
  39. podSecurityContext:
  40. enabled: true
  41. runAsNonRoot: true
  42. seccompProfile:
  43. type: RuntimeDefault
  44. containerSecurityContext:
  45. enabled: true
  46. allowPrivilegeEscalation: false
  47. capabilities:
  48. drop:
  49. - ALL
  50. resources:
  51. requests:
  52. cpu: 10m
  53. memory: 50Mi

Verification

You can see the list of the enabled plugins on the Overview page or by navigating from AdministrationCluster SettingsConfigurationConsole operator.openshift.ioConsole plugins.

It can take a few minutes for the new plugin configuration to appear. If you do not see your plugin, you might need to refresh your browser if the plugin was recently enabled. If you recieve any errors at runtime, check the JS console in browser developer tools to look for any errors in your plugin code.

Disabling your plugin in the browser

Console users can use the disable-plugins query parameter to disable specific or all dynamic plugins that would normally get loaded at run-time.

Procedure

  • To disable a specific plugin(s), remove the plugin you want to disable from the comma-separated list of plugin names.

  • To disable all plugins, leave an empty string in the disable-plugins query parameter.

Cluster administrators can disable plugins in the Cluster Settings page of the web console