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

[template] Allow passing in a template string using RawTemplate #591

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

Conversation

stuggi
Copy link
Contributor

@stuggi stuggi commented Jan 9, 2025

Right all templates are expected to be local files.
This change allows passing in optional templates via RawTemplate where the template is a full template string.

@stuggi stuggi requested review from abays, olliewalsh and dprince January 9, 2025 15:46
stuggi added a commit to stuggi/keystone-operator that referenced this pull request Jan 9, 2025
…cret

OverrideSecret - secret holding httpd conf snippet to override/extend the
vhost endpoint config. Per endpoint vhost all files of the secret gets
rendered and placed into /etc/httpd/conf/httpd_override_<key>.conf .
In the httpd template at the end of the vhost those templates get
included using `Include conf/httpd_override_*.conf`.

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

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

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/keystone-operator that referenced this pull request Jan 10, 2025
…iceConfigSecret

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

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

Signed-off-by: Martin Schuppert <[email protected]>
for filename, tmplData := range t.AdditionalTemplate {
var renderedTemplate string
var err error
// if tmplData contains either new lines or spaces its expected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems very fragile, e.g spaces are valid in file paths.
Could add a new field instead of re-using AdditionalTemplate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could do that, but I hope we are not using spaces in our templates which are part of our operator images

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olliewalsh changed and introduced a new field RawTemplate . If you can think of a better naming, let me know :)

@stuggi stuggi changed the title [template] Allow passing in a template string as AdditionalTemplate [template] Allow passing in a template string using RawTemplate Jan 10, 2025
Right all templates are expected to be local files.
This change allows passing in optional templates via RawTemplate
where the template is a full templace string.

Signed-off-by: Martin Schuppert <[email protected]>
stuggi added a commit to stuggi/keystone-operator that referenced this pull request Jan 10, 2025
…iceConfigSecret

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

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

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants