Skip to content

Commit c59e7a5

Browse files
committed
Allow customize http vhost config using HttpdCustomization.CustomConfigSecret
This change allows to customize the httpd vhost config using this parameter to specify a secret that contains service config data. The content of each provided snippet gets rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<endpoint>_<key> . At the end of the vhost config in the default httpd template these custom configs get included using `Include conf/httpd_custom_<endpoint>_*`. For information on how sections in httpd configuration get merged, check section "How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging All possible parameters which can be use in a template can be looked up in the <service>-config-data secret of the service like: $ oc get secret -n openstack ironic-api-config-data -o json | jq -r .data.templatingParameters | base64 -d $ oc get secret -n openstack ironic-inspector-config-data -o json | jq -r .data.templatingParameters | base64 -d or in the running pod of the service in the file: $ cat /var/lib/config-data/default/templatingParameters The content is a versioned dump of the parameters of the service operator, like: ~~~ DatabaseConnection: mysql+pymysql://user:[email protected]/keystone?read_default_file=/etc/my.cnf KeystoneInternalURL: https://keystone-internal.openstack.svc:5000 KeystonePublicURL: https://keystone-public-openstack.apps-crc.testing VHosts: internal: Override: false SSLCertificateFile: /etc/pki/tls/certs/internal.crt SSLCertificateKeyFile: /etc/pki/tls/private/internal.key ServerName: ironic-api-internal.openstack.svc TLS: true public: Override: false SSLCertificateFile: /etc/pki/tls/certs/public.crt SSLCertificateKeyFile: /etc/pki/tls/private/public.key ServerName: ironic-api-public.openstack.svc TLS: true ... ~~~ Depends-On: openstack-k8s-operators/lib-common#591 Depends-On: openstack-k8s-operators/lib-common#593 Jira: https://issues.redhat.com/browse/OSPRH-13100 Signed-off-by: Martin Schuppert <[email protected]>
1 parent 1d83138 commit c59e7a5

26 files changed

+439
-19
lines changed

api/bases/ironic.openstack.org_ironicapis.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ spec:
7878
But can also be used to add additional files. Those get added to the service config dir in /etc/<service> .
7979
TODO: -> implement
8080
type: object
81+
httpdCustomization:
82+
description: HttpdCustomization - customize the httpd service
83+
properties:
84+
customConfigSecret:
85+
description: |-
86+
CustomConfigSecret - customize the httpd vhost config using this parameter to specify
87+
a secret that contains service config data. The content of each provided snippet gets
88+
rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
89+
In the default httpd template at the end of the vhost those custom configs get
90+
included using `Include conf/httpd_custom_<endpoint>_*`.
91+
For information on how sections in httpd configuration get merged, check section
92+
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
93+
type: string
94+
type: object
8195
keystoneEndpoints:
8296
description: KeystoneEndpoints - Internally used Keystone API endpoints
8397
properties:

api/bases/ironic.openstack.org_ironicinspectors.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ spec:
119119
- start
120120
type: object
121121
type: array
122+
httpdCustomization:
123+
description: HttpdCustomization - customize the httpd service
124+
properties:
125+
customConfigSecret:
126+
description: |-
127+
CustomConfigSecret - customize the httpd vhost config using this parameter to specify
128+
a secret that contains service config data. The content of each provided snippet gets
129+
rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
130+
In the default httpd template at the end of the vhost those custom configs get
131+
included using `Include conf/httpd_custom_<endpoint>_*`.
132+
For information on how sections in httpd configuration get merged, check section
133+
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
134+
type: string
135+
type: object
122136
inspectionNetwork:
123137
description: InspectionNetwork - Additional network to attach to expose
124138
boot DHCP, TFTP, HTTP services.

api/bases/ironic.openstack.org_ironics.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ spec:
122122
But can also be used to add additional files. Those get added to the service config dir in /etc/<service> .
123123
TODO: -> implement
124124
type: object
125+
httpdCustomization:
126+
description: HttpdCustomization - customize the httpd service
127+
properties:
128+
customConfigSecret:
129+
description: |-
130+
CustomConfigSecret - customize the httpd vhost config using this parameter to specify
131+
a secret that contains service config data. The content of each provided snippet gets
132+
rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
133+
In the default httpd template at the end of the vhost those custom configs get
134+
included using `Include conf/httpd_custom_<endpoint>_*`.
135+
For information on how sections in httpd configuration get merged, check section
136+
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
137+
type: string
138+
type: object
125139
networkAttachments:
126140
description: NetworkAttachments is a list of NetworkAttachment
127141
resource names to expose the services to the given network
@@ -603,6 +617,20 @@ spec:
603617
- start
604618
type: object
605619
type: array
620+
httpdCustomization:
621+
description: HttpdCustomization - customize the httpd service
622+
properties:
623+
customConfigSecret:
624+
description: |-
625+
CustomConfigSecret - customize the httpd vhost config using this parameter to specify
626+
a secret that contains service config data. The content of each provided snippet gets
627+
rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
628+
In the default httpd template at the end of the vhost those custom configs get
629+
included using `Include conf/httpd_custom_<endpoint>_*`.
630+
For information on how sections in httpd configuration get merged, check section
631+
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
632+
type: string
633+
type: object
606634
inspectionNetwork:
607635
description: InspectionNetwork - Additional network to attach
608636
to expose boot DHCP, TFTP, HTTP services.

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21
55
require (
66
github.com/onsi/ginkgo/v2 v2.20.1
77
github.com/onsi/gomega v1.34.1
8-
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241216113837-d172b3ac0f4e
8+
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250116145727-01a8948d5dd7
99
k8s.io/api v0.29.12
1010
k8s.io/apimachinery v0.29.12
1111
k8s.io/client-go v0.29.12

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7474
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
7575
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E=
7676
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
77-
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241216113837-d172b3ac0f4e h1:hf4kVQBkyG79WcHBxdQ25QrDBbGFdarebS1Tc0Xclq4=
78-
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241216113837-d172b3ac0f4e/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs=
77+
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250116145727-01a8948d5dd7 h1:vXHpH93PjbAgg5ZN6n5WmxkybVQOs0nhXvVw62o7aZs=
78+
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250116145727-01a8948d5dd7/go.mod h1:YpNTuJhDWhbXM50O3qBkhO7M+OOyRmWkNVmJ4y3cyFs=
7979
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8080
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8181
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

api/v1beta1/common_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,16 @@ type KeystoneEndpoints struct {
7070
// Public endpoint URL
7171
Public string `json:"public"`
7272
}
73+
74+
// HttpdCustomization - customize the httpd service
75+
type HttpdCustomization struct {
76+
// +kubebuilder:validation:Optional
77+
// CustomConfigSecret - customize the httpd vhost config using this parameter to specify
78+
// a secret that contains service config data. The content of each provided snippet gets
79+
// rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
80+
// In the default httpd template at the end of the vhost those custom configs get
81+
// included using `Include conf/httpd_custom_<endpoint>_*`.
82+
// For information on how sections in httpd configuration get merged, check section
83+
// "How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
84+
CustomConfigSecret *string `json:"customConfigSecret,omitempty"`
85+
}

api/v1beta1/ironicapi_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ type IronicAPITemplate struct {
4343
// +operator-sdk:csv:customresourcedefinitions:type=spec
4444
// TLS - Parameters related to the TLS
4545
TLS tls.API `json:"tls,omitempty"`
46+
47+
// +kubebuilder:validation:Optional
48+
// HttpdCustomization - customize the httpd service
49+
HttpdCustomization HttpdCustomization `json:"httpdCustomization,omitempty"`
4650
}
4751

4852
// APIOverrideSpec to override the generated manifest of several child resources.

api/v1beta1/ironicinspector_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ type IronicInspectorTemplate struct {
111111
// +operator-sdk:csv:customresourcedefinitions:type=spec
112112
// TLS - Parameters related to the TLS
113113
TLS tls.API `json:"tls,omitempty"`
114+
115+
// +kubebuilder:validation:Optional
116+
// HttpdCustomization - customize the httpd service
117+
HttpdCustomization HttpdCustomization `json:"httpdCustomization,omitempty"`
114118
}
115119

116120
// InspectorOverrideSpec to override the generated manifest of several child resources.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/ironic.openstack.org_ironicapis.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ spec:
7878
But can also be used to add additional files. Those get added to the service config dir in /etc/<service> .
7979
TODO: -> implement
8080
type: object
81+
httpdCustomization:
82+
description: HttpdCustomization - customize the httpd service
83+
properties:
84+
customConfigSecret:
85+
description: |-
86+
CustomConfigSecret - customize the httpd vhost config using this parameter to specify
87+
a secret that contains service config data. The content of each provided snippet gets
88+
rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<key> .
89+
In the default httpd template at the end of the vhost those custom configs get
90+
included using `Include conf/httpd_custom_<endpoint>_*`.
91+
For information on how sections in httpd configuration get merged, check section
92+
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging
93+
type: string
94+
type: object
8195
keystoneEndpoints:
8296
description: KeystoneEndpoints - Internally used Keystone API endpoints
8397
properties:

0 commit comments

Comments
 (0)