Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customize http vhost config using HttpdCustomization.CustomConfigSecret #201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stuggi
Copy link
Contributor

@stuggi stuggi commented Jan 20, 2025

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__ .
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 -config-data secret of the service like:

$ oc get secret -n openstack barbican-config-data -o json | jq -r .data.TemplateParameters | base64 -d 
$ oc get secret -n openstack barbican-api-config-data -o json | jq -r .data.TemplateParameters | base64 -d

or in the running pod of the service in the file:
$ cat /var/lib/config-data/default/TemplateParameters

The content is a versioned dump of the parameters of the service operator, like:

DatabaseConnection: mysql+pymysql://user:pwd@openstack.<namespace>.svc/keystone?read_default_file=/etc/my.cnf EnableSecureRBAC: true
EnabledSecretStores: simple_crypto
GlobalDefaultSecretStore: simple_crypto
KeystoneAuthURL: http://keystone-internal.openstack.svc:5000 LogFile: /var/log/barbican/barbican-api.log
ServicePassword: <pwd>
ServiceUser: barbican
SimpleCryptoEnabled: true
SimpleCryptoKEK: ""
TimeOut: 90
TransportURL: rabbit://rabbitmq-secret/fake
VHosts:
  internal:
    Override: true
    ServerName: barbican-internal.<namespace>.svc
    TLS: false
  public:
    Override: true
    ServerName: barbican-public.<namespace>.svc
    TLS: false

Depends-On: openstack-k8s-operators/lib-common#591
Depends-On: openstack-k8s-operators/lib-common#593

Jira: https://issues.redhat.com/browse/OSPRH-13100

@openshift-ci openshift-ci bot requested review from d34dh0r53 and vakwetu January 20, 2025 15:17
Copy link

openshift-ci bot commented Jan 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stuggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Deydra71
Copy link
Contributor

nit: Is actually TemplateParameters, not templatingParameters as described in commit message, if someone'd want to check, otherwise lgtm

…igSecret

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 barbican-config-data -o json | jq -r .data.TemplateParameters | base64 -d
$ oc get secret -n openstack barbicanapi-config-data -o json | jq -r .data.TemplateParameters | base64 -d

or in the running pod of the service in the file:
$ cat /var/lib/config-data/default/TemplateParameters

The content is a versioned dump of the parameters of the service operator, like:

~~~
DatabaseConnection: mysql+pymysql://user:pwd@openstack.<namespace>.svc/keystone?read_default_file=/etc/my.cnf
EnableSecureRBAC: true
EnabledSecretStores: simple_crypto
GlobalDefaultSecretStore: simple_crypto
KeystoneAuthURL: http://keystone-internal.openstack.svc:5000
LogFile: /var/log/barbican/barbican-api.log
ServicePassword: <pwd>
ServiceUser: barbican
SimpleCryptoEnabled: true
SimpleCryptoKEK: ""
TimeOut: 90
TransportURL: rabbit://rabbitmq-secret/fake
VHosts:
  internal:
    Override: true
    ServerName: barbican-internal.<namespace>.svc
    TLS: false
  public:
    Override: true
    ServerName: barbican-public.<namespace>.svc
    TLS: false
~~~

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants