Authoring devfiles - Components
Adding a kubernetes or openshift component
You can add either a kubernetes or openshift component to a devfile.
Prerequisites
Procedure
Define a component using the
kubernetesoropenshiftproperty.Provide the content through the
uriorinlinedproperty.Adding an openshift component using the uri property
devfile.yamlcomponents: - name: mysql openshift: uri: petclinic.yamlAdding a kubernetes component using the inlined property
devfile.yamlcomponents: - name: myk8deploy kubernetes: inlined: apiVersion: batch/v1 kind: Job metadata: name: pi spec: template: spec: containers: - name: job image: myimage command: ["some", "command"] restartPolicy: NeverSpecify the endpoint through the endpoint property with
kubernetesoropenshiftcomponents.By default
kubernetesoropenshiftcomponents are not going to be deployed. SpecifydeployByDefault: trueif you want to apply the component at start up.Associate
kubernetesoropenshiftcomponents withapplycommands wthdeploycommand group kind. If thekubernetesoropenshiftcomponent uses an image built by animagecomponent defined in the devfile, you can create a compositedeploycommand to build the image and deploy thekubernetesoropenshiftcomponent. For more information ondeploycommands, see adding a command group.