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

Add basic documentation about the template engine #5625

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/plugin_server_nodeattestor_aws_iid.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Sample configuration:
}
```

If `assume_role` is set, the SPIRE server will assume the role as specified by the template `arn:{{Partition}}:iam::{{AccountID}}:role/{{AssumeRole}}` where `Partition` comes from the AWS NodeAttestor plugin configuration if specified otherwise set to 'aws', `AccountID` is taken from the AWS IID document sent by the SPIRE agent to the SPIRE server and `AssumeRole` comes from the AWS NodeAttestor plugin configuration.
If `assume_role` is set, the SPIRE server will assume the role as specified by the template `arn:{{Partition}}:iam::{{AccountID}}:role/{{AssumeRole}}` where `Partition` comes from the AWS NodeAttestor plugin configuration if specified otherwise set to 'aws', `AccountID` is taken from the AWS IID document sent by the SPIRE agent to the SPIRE server and `AssumeRole` comes from the AWS NodeAttestor plugin configuration. Details about the template engine are available [here](template_engine.md).

In the following configuration,

Expand Down
1 change: 1 addition & 0 deletions doc/plugin_server_nodeattestor_azure_msi.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ All the selectors have the type `azure_msi`.

The agent path template is a way of customizing the format of generated SPIFFE IDs for agents.
The template formatter is using Golang text/template conventions, it can reference values provided by the plugin or in a [MSI access token](https://learn.microsoft.com/en-us/azure/active-directory/develop/access-tokens#payload-claims).
Details about the template engine are available [here](template_engine.md).

Some useful values are:

Expand Down
1 change: 1 addition & 0 deletions doc/plugin_server_nodeattestor_gcp_iit.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The service account must have IAM permissions and Authorization Scopes granting

The agent path template is a way of customizing the format of generated SPIFFE IDs for agents.
The template formatter is using Golang text/template conventions, it can reference values provided by the plugin or in a [Compute Engine identity token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity#payload).
Details about the template engine are available [here](template_engine.md).

Some useful values are:

Expand Down
1 change: 1 addition & 0 deletions doc/plugin_server_nodeattestor_x509pop.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ A sample configuration:

The agent path template is a way of customizing the format of generated SPIFFE IDs for agents.
The template formatter is using Golang text/template conventions, it can reference values provided by the plugin or in a [golang x509.Certificate](https://pkg.go.dev/crypto/x509#Certificate)
Details about the template engine are available [here](template_engine.md).

Some useful values are:

Expand Down
13 changes: 13 additions & 0 deletions doc/template_engine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Go Text Template Engine

## About

In various plugins, the go based text/template engine is used. More information about this language can be found [here](https://pkg.go.dev/text/template).

## Functions

In addition to the built in functions as described [here](https://pkg.go.dev/text/template#hdr-Functions), we also include a set of functions from the SPRIG library.

The list of SPRIG functions is available [here](https://github.com/spiffe/spire/blob/main/pkg/common/agentpathtemplate/template.go#L11).

The functions behavior can be found in the SPRIG documentation [here](https://masterminds.github.io/sprig/).
Loading