|
| 1 | +# Neutron HTTPD Configuration Overrides |
| 2 | + |
| 3 | +The neutron-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 Neutron |
| 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 Neutron 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_connection.conf`): |
| 28 | +```apache |
| 29 | +# Custom connection settings for Neutron |
| 30 | +MaxKeepAliveRequests 200 |
| 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_connection.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_connection.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 `MaxKeepAliveRequests` 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 | +```yaml |
| 62 | +apiVersion: core.openstack.org/v1beta1 |
| 63 | +kind: OpenStackControlPlane |
| 64 | +metadata: |
| 65 | + name: openstack |
| 66 | +spec: |
| 67 | + neutron: |
| 68 | + template: |
| 69 | + extraMounts: |
| 70 | + - extraVol: |
| 71 | + - extraVolType: httpd-overrides |
| 72 | + mounts: |
| 73 | + - mountPath: /etc/httpd/conf_custom |
| 74 | + name: httpd-overrides |
| 75 | + readOnly: true |
| 76 | + volumes: |
| 77 | + - configMap: |
| 78 | + name: httpd-overrides |
| 79 | + name: httpd-overrides |
| 80 | +``` |
| 81 | +
|
| 82 | +## Common Use Cases |
| 83 | +
|
| 84 | +- **Connection Tuning**: Adjust keep-alive settings, connection limits, etc. |
| 85 | +- **Security Headers**: Add custom security headers or configurations |
| 86 | +- **Logging**: Customize Apache logging configuration |
| 87 | +- **Performance Tuning**: Adjust worker processes, thread limits, etc. |
| 88 | +
|
| 89 | +## Verification |
| 90 | +
|
| 91 | +After deploying your custom `HTTPD` configuration, you can verify that the |
| 92 | +settings have been properly applied: |
| 93 | + |
| 94 | +### 1. Find the Neutron Pod |
| 95 | + |
| 96 | +First, identify the running Neutron pod: |
| 97 | + |
| 98 | +```bash |
| 99 | +$ oc get pods -l service=neutron |
| 100 | +``` |
| 101 | + |
| 102 | +### 2. Verify Configuration Loading |
| 103 | + |
| 104 | +Connect to the Neutron Pod and check that your custom configuration has been |
| 105 | +loaded: |
| 106 | + |
| 107 | +```bash |
| 108 | +# Replace <neutron-pod-name> with the actual pod name from step 1 |
| 109 | +oc rsh -c neutron-httpd <neutron-pod-name> |
| 110 | +# Inside the pod, dump the HTTPD configuration and check for your custom settings |
| 111 | +httpd -D DUMP_CONFIG |
| 112 | +``` |
| 113 | + |
| 114 | +### 3. Additional Verification Commands |
| 115 | + |
| 116 | +You can also verify other aspects of the configuration: |
| 117 | + |
| 118 | +```bash |
| 119 | +# Check all loaded configuration files |
| 120 | +$ httpd -D DUMP_INCLUDES |
| 121 | +``` |
0 commit comments