8.2. Cartridge Event Subscriptions


When OpenShift Enterprise adds a cartridge to an application, it uses entries in the Subscribes section of the $cartridge_name/metadata/manifest.yml file in other cartridges to determine what actions to take for those other cartridges. Define subscribe events in the manifest.yml file using the following format:
Subscribes:
  <event_name>:
    Type: "<event type>"

Example 8.2. PHP Cartridge Subscribes Entry

Subscribes:
  set-env:
    Type: "ENV:*"
    Required: false
  set-mysql-connection-info:
    Type: "NET_TCP:db:mysql"
    Required: false
  set-postgres-connection-info:
    Type: "NET_TCP:db:postgres"
    Required: false
  set-doc-url:
    Type: "STRING:urlpath"
    Required: false
When OpenShift Enterprise processes a cartridge publish script, it inputs the result to subscriber scripts in other cartridges that match the Type of the publish event. The input to matching subscriber scripts is prefaced with $cartridge_name/hooks/<event_name> <gear_name> <namespace> <gear_uuid>.
For each matching Subscribes entry, OpenShift Enterprise runs a script named $cartridge_name/hooks/$event_name. OpenShift Enterprise must send and process entries marked with Required: true.
The publisher script determines the format of the information input to the subscriber script. Ensure that subscriber script can parse the input correctly.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.