|
| 1 | +# Heat HTTPD Configuration Overrides |
| 2 | + |
| 3 | +The heat-operator provides mechanisms to customize the Apache HTTPD server |
| 4 | +configuration through the use of custom configuration files. This feature |
| 5 | +leverages the |
| 6 | +[ExtraMounts](https://github.com/openstack-k8s-operators/dev-docs/blob/main/extra_mounts.md) |
| 7 | +functionality to mount custom HTTPD configuration files into the Heat |
| 8 | +deployment. |
| 9 | + |
| 10 | +## How It Works |
| 11 | + |
| 12 | +1. **Custom Configuration Files**: Create HTTPD configuration files with your |
| 13 | + custom settings |
| 14 | +2. **ConfigMap**: Create ConfigMaps from files containing the overrides |
| 15 | +3. **OpenStackControlPlane Patch**: Patch the control plane to mount the |
| 16 | + generated ConfigMap into Heat containers. The HTTPD configuration |
| 17 | + automatically includes files mounted to `/etc/httpd/conf_custom/*.conf` |
| 18 | + |
| 19 | + |
| 20 | +### Step 1: Create Custom HTTPD Configuration |
| 21 | + |
| 22 | +Create your custom HTTPD configuration file(s). As a best practice the filename |
| 23 | +could start with the `httpd_custom_` prefix, but all `*.conf` files mounted to |
| 24 | +`/etc/httpd/conf_custom/` are automatically included by the `IncludeOptional` |
| 25 | +directive in the base `httpd` configuration. |
| 26 | + |
| 27 | +Example (`httpd_custom_timeout.conf`): |
| 28 | +```apache |
| 29 | +# Custom timeout settings for Heat |
| 30 | +Timeout 300 |
| 31 | +KeepAliveTimeout 15 |
| 32 | +``` |
| 33 | + |
| 34 | +### Step 2. Create a ConfigMap |
| 35 | + |
| 36 | +Create a Kubernetes `ConfigMap` containing your custom configuration files: |
| 37 | + |
| 38 | +```bash |
| 39 | +oc create configmap httpd-overrides --from-file=httpd_custom_timeout.conf |
| 40 | +``` |
| 41 | + |
| 42 | +It is possible to add multiple configuration files containing dedicated |
| 43 | +configuration directives: |
| 44 | + |
| 45 | +```bash |
| 46 | +oc create configmap httpd-overrides \ |
| 47 | + --from-file=httpd_custom_timeout.conf \ |
| 48 | + --from-file=httpd_custom_security.conf \ |
| 49 | + --from-file=httpd_custom_logging.conf |
| 50 | +``` |
| 51 | + |
| 52 | +The following example is based on a single customization file and demonstrates |
| 53 | +how to set custom `Timeout` and `KeepAliveTimeout` parameters. |
| 54 | + |
| 55 | +### Step 3: Configure ExtraMounts in the OpenStackControlPlane |
| 56 | + |
| 57 | +Update your `OpenStackControlPlane` resource to include the custom HTTPD |
| 58 | +configuration files using `extraMounts`. The simplest approach is to mount |
| 59 | +the entire ConfigMap to the target `/etc/httpd/conf_custom` mount point. |
| 60 | + |
| 61 | +Heat exposes two API services (`heatAPI` and `heatCfnAPI`), each with its |
| 62 | +own HTTPD vhost. You can apply overrides to either or both: |
| 63 | + |
| 64 | +```yaml |
| 65 | +apiVersion: core.openstack.org/v1beta1 |
| 66 | +kind: OpenStackControlPlane |
| 67 | +metadata: |
| 68 | + name: openstack |
| 69 | +spec: |
| 70 | + heat: |
| 71 | + template: |
| 72 | + heatAPI: |
| 73 | + extraMounts: |
| 74 | + - extraVol: |
| 75 | + - extraVolType: httpd-overrides |
| 76 | + mounts: |
| 77 | + - mountPath: /etc/httpd/conf_custom |
| 78 | + name: httpd-overrides |
| 79 | + readOnly: true |
| 80 | + volumes: |
| 81 | + - configMap: |
| 82 | + name: httpd-overrides |
| 83 | + name: httpd-overrides |
| 84 | + heatCfnAPI: |
| 85 | + extraMounts: |
| 86 | + - extraVol: |
| 87 | + - extraVolType: httpd-overrides |
| 88 | + mounts: |
| 89 | + - mountPath: /etc/httpd/conf_custom |
| 90 | + name: httpd-overrides |
| 91 | + readOnly: true |
| 92 | + volumes: |
| 93 | + - configMap: |
| 94 | + name: httpd-overrides |
| 95 | + name: httpd-overrides |
| 96 | +``` |
| 97 | +
|
| 98 | +## Common Use Cases |
| 99 | +
|
| 100 | +- **Timeout Adjustments**: Modify request timeout values for specific environments |
| 101 | +- **Security Headers**: Add custom security headers or configurations |
| 102 | +- **Logging**: Customize Apache logging configuration |
| 103 | +- **Performance Tuning**: Adjust worker processes, connection limits, etc. |
| 104 | +
|
| 105 | +## Verification |
| 106 | +
|
| 107 | +After deploying your custom `HTTPD` configuration, you can verify that the |
| 108 | +settings have been properly applied: |
| 109 | + |
| 110 | +### 1. Find the Heat Pod |
| 111 | + |
| 112 | +First, identify the running Heat pod: |
| 113 | + |
| 114 | +```bash |
| 115 | +$ oc get pods -l service=heat |
| 116 | +``` |
| 117 | + |
| 118 | +### 2. Verify Configuration Loading |
| 119 | + |
| 120 | +Connect to the Heat Pod and check that your custom configuration has been |
| 121 | +loaded: |
| 122 | + |
| 123 | +```bash |
| 124 | +# Replace <heat-pod-name> with the actual pod name from step 1 |
| 125 | +oc rsh -c heat-api-httpd <heat-pod-name> |
| 126 | +# Inside the pod, dump the HTTPD configuration and check for your custom settings |
| 127 | +httpd -D DUMP_CONFIG |
| 128 | +``` |
| 129 | + |
| 130 | +### 3. Additional Verification Commands |
| 131 | + |
| 132 | +You can also verify other aspects of the configuration: |
| 133 | + |
| 134 | +```bash |
| 135 | +# Check all loaded configuration files |
| 136 | +$ httpd -D DUMP_INCLUDES |
| 137 | +``` |
0 commit comments