Support template as annotation for fencing id#32
Open
marjuscako wants to merge 1 commit intokvaps:masterfrom
Open
Support template as annotation for fencing id#32marjuscako wants to merge 1 commit intokvaps:masterfrom
marjuscako wants to merge 1 commit intokvaps:masterfrom
Conversation
Currently the fencing id is set statically in a PodTemplate annotation.
With this patch we add support to parse a template from the annotation
`fencing/id-template`, in order to calculate dynamically the fencing id
based on the node name.
The template itself should expect as input only one argument, the node
name. For example, if a user specifies the annotation:
fencing/id-template: {{ . | lower }}
it will output the node name in lower case. The template supports all
sprig functions of the go-template. The precedence of the fencing id
calculation goes as:
1. If the fencing/id annotation in the node exists, then the fencing id
will be the value of the annotation.
2. If the fencing/id annotation in the PodTemplate exists, then the
fencing id will be the value of the annotation.
3. If the fencing/id-template annotation in the PodTemplate exists, then
the value will be calculated based on this template with input the
node name.
4. The fencing id will equal to the node name.
This patch includes a bump of the Go version, since Go 1.18 does not
support the sprig functions with the text/template.
Signed-off-by: Marjus Cako <marios.cako@hpe.com>
Author
|
I am open to upgrade also to a later version of Go, e.g., the latest. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the fencing id is set statically in a PodTemplate annotation. With this patch we add support to parse a template from the annotation
fencing/id-template, in order to calculate dynamically the fencing id based on the node name.The template itself should expect as input only one argument, the node name. For example, if a user specifies the annotation:
it will output the node name in lower case. The template supports all sprig functions of the go-template. The precedence of the fencing id calculation goes as:
fencing/idannotation in the node exists, then the fencing id will be the value of the annotation.fencing/idannotation in the PodTemplate exists, then the fencing id will be the value of the annotation.fencing/id-templateannotation in the PodTemplate exists, then the value will be calculated based on this template with input the node name.This patch includes a bump of the Go version, since Go 1.18 does not support the sprig functions with the text/template.