|
| 1 | +// Module included in: |
| 2 | +// title-admin.adoc |
| 3 | + |
| 4 | +[id="proc-rhdh-deployment-config_{context}"] |
| 5 | += Configuring {product} deployment |
| 6 | + |
| 7 | +The {product} operator exposes a `rhdh.redhat.com/v1alpha2` API Version of its Custom Resource Definition (CRD). This CRD exposes a generic `spec.deployment.patch` field, which gives you full control over the {product-short} Deployment resource. This field can be a fragment of the standard `apps.Deployment` Kubernetes object. |
| 8 | + |
| 9 | +.Procedure |
| 10 | + |
| 11 | +. Create a {product-short} Custom Resource Definition with the following fields: |
| 12 | + |
| 13 | +-- |
| 14 | +.Example |
| 15 | +[source, yaml] |
| 16 | +---- |
| 17 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 18 | +kind: Backstage |
| 19 | +metadata: |
| 20 | + name: developer-hub |
| 21 | +spec: |
| 22 | + deployment: |
| 23 | + patch: |
| 24 | + spec: |
| 25 | + template: |
| 26 | +---- |
| 27 | + |
| 28 | +`labels`:: |
| 29 | +Add labels to the {product-short} pod. |
| 30 | ++ |
| 31 | +.Example adding the label `my=true` |
| 32 | +[source, yaml] |
| 33 | +---- |
| 34 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 35 | +kind: Backstage |
| 36 | +metadata: |
| 37 | + name: developer-hub |
| 38 | +spec: |
| 39 | + deployment: |
| 40 | + patch: |
| 41 | + spec: |
| 42 | + template: |
| 43 | + metadata: |
| 44 | + labels: |
| 45 | + my: true |
| 46 | +---- |
| 47 | + |
| 48 | +`volumes`:: |
| 49 | +Add an additional volume named `my-volume` and mount it under `/my/path` in the {product-short} application container. |
| 50 | ++ |
| 51 | +.Example additional volume |
| 52 | +[source, yaml] |
| 53 | +---- |
| 54 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 55 | +kind: Backstage |
| 56 | +metadata: |
| 57 | + name: developer-hub |
| 58 | +spec: |
| 59 | + deployment: |
| 60 | + patch: |
| 61 | + spec: |
| 62 | + template: |
| 63 | + spec: |
| 64 | + containers: |
| 65 | + - name: backstage-backend |
| 66 | + volumeMounts: |
| 67 | + - mountPath: /my/path |
| 68 | + name: my-volume |
| 69 | + volumes: |
| 70 | + - ephemeral: |
| 71 | + volumeClaimTemplate: |
| 72 | + spec: |
| 73 | + storageClassName: "special" |
| 74 | + name: my-volume |
| 75 | +---- |
| 76 | ++ |
| 77 | +Replace the default `dynamic-plugins-root` volume with a persistent volume claim (PVC) named `dynamic-plugins-root`. Note the `$patch: replace` directive, otherwise a new volume will be added. |
| 78 | ++ |
| 79 | +.Example `dynamic-plugins-root` volume replacement |
| 80 | +[source, yaml] |
| 81 | +---- |
| 82 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 83 | +kind: Backstage |
| 84 | +metadata: |
| 85 | + name: developer-hub |
| 86 | +spec: |
| 87 | + deployment: |
| 88 | + patch: |
| 89 | + spec: |
| 90 | + template: |
| 91 | + spec: |
| 92 | + volumes: |
| 93 | + - $patch: replace |
| 94 | + name: dynamic-plugins-root |
| 95 | + persistentVolumeClaim: |
| 96 | + claimName: dynamic-plugins-root |
| 97 | +---- |
| 98 | + |
| 99 | +`cpu` request:: |
| 100 | + |
| 101 | +Set the CPU request for the {product-short} application container to 250m. |
| 102 | ++ |
| 103 | +.Example CPU request |
| 104 | +[source, yaml] |
| 105 | +---- |
| 106 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 107 | +kind: Backstage |
| 108 | +metadata: |
| 109 | + name: developer-hub |
| 110 | +spec: |
| 111 | + deployment: |
| 112 | + patch: |
| 113 | + spec: |
| 114 | + template: |
| 115 | + spec: |
| 116 | + containers: |
| 117 | + - name: backstage-backend |
| 118 | + resources: |
| 119 | + requests: |
| 120 | + cpu: 250m |
| 121 | +---- |
| 122 | + |
| 123 | +`my-sidecar` container:: |
| 124 | + |
| 125 | +Add a new `my-sidecar` sidecar container into the {product-short} Pod. |
| 126 | ++ |
| 127 | +.Example side car container |
| 128 | +[source, yaml] |
| 129 | +---- |
| 130 | +apiVersion: rhdh.redhat.com/v1alpha2 |
| 131 | +kind: Backstage |
| 132 | +metadata: |
| 133 | + name: developer-hub |
| 134 | +spec: |
| 135 | + deployment: |
| 136 | + patch: |
| 137 | + spec: |
| 138 | + template: |
| 139 | + spec: |
| 140 | + containers: |
| 141 | + - name: my-sidecar |
| 142 | + image: quay.io/my-org/my-sidecar:latest |
| 143 | +---- |
| 144 | + |
| 145 | +-- |
| 146 | + |
| 147 | +[role="_additional-resources"] |
| 148 | +.Additional resources |
| 149 | + |
| 150 | +* To learn more about merging, see link:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md#basic-patch-format[Strategic Merge Patch]. |
0 commit comments