Update policy to template the Nomad node name in.

pull/21872/head
Tristan Morgan 3 weeks ago
parent 1403e93437
commit c5dffcceed
No known key found for this signature in database

@ -1,7 +1,7 @@
agent_prefix "" {
policy = "read"
}
node_prefix "" {
node "{{.Name}}" {
policy = "write"
}
service_prefix "" {

@ -5,7 +5,7 @@ mesh = "write"
agent_prefix "" {
policy = "read"
}
node_prefix "" {
node "{{.Name}}" {
policy = "write"
}
service_prefix "" {

@ -71,11 +71,11 @@ func (f *prettyFormatter) FormatTemplatedPolicy(templatedPolicy api.ACLTemplated
switch templatedPolicy.TemplateName {
case api.ACLTemplatedPolicyServiceName:
nameRequiredVariableOutput(&buffer, templatedPolicy.TemplateName, "The name of the service", "api")
case api.ACLTemplatedPolicyNodeName:
case api.ACLTemplatedPolicyNodeName, api.ACLTemplatedPolicyNomadServerName, api.ACLTemplatedPolicyNomadClientName:
nameRequiredVariableOutput(&buffer, templatedPolicy.TemplateName, "The node name", "node-1")
case api.ACLTemplatedPolicyAPIGatewayName:
nameRequiredVariableOutput(&buffer, templatedPolicy.TemplateName, "The api gateway service name", "api-gateway")
case api.ACLTemplatedPolicyDNSName, api.ACLTemplatedPolicyNomadServerName, api.ACLTemplatedPolicyNomadClientName:
case api.ACLTemplatedPolicyDNSName:
noRequiredVariablesOutput(&buffer, templatedPolicy.TemplateName)
default:
buffer.WriteString(" None\n")

@ -1,6 +1,6 @@
{
"TemplateName": "builtin/nomad-client",
"Schema": "",
"Template": "agent_prefix \"\" {\n policy = \"read\"\n}\nnode_prefix \"\" {\n policy = \"write\"\n}\nservice_prefix \"\" {\n policy = \"write\"\n}\nkey_prefix \"\" {\n policy = \"read\"\n}",
"Template": "agent_prefix \"\" {\n policy = \"read\"\n}\nnode \"{{.Name}}\" {\n policy = \"write\"\n}\nservice_prefix \"\" {\n policy = \"write\"\n}\nkey_prefix \"\" {\n policy = \"read\"\n}",
"Description": "Gives the token or role permissions required for integration with a nomad client."
}

@ -1,13 +1,14 @@
Name: builtin/nomad-client
Description: Gives the token or role permissions required for integration with a nomad client.
Input variables: None
Input variables:
Name: String - Required - The node name.
Example usage:
consul acl token create -templated-policy builtin/nomad-client
consul acl token create -templated-policy builtin/nomad-client -var name:node-1
Raw Template:
agent_prefix "" {
policy = "read"
}
node_prefix "" {
node "{{.Name}}" {
policy = "write"
}
service_prefix "" {

@ -1,5 +1,6 @@
Name: builtin/nomad-client
Description: Gives the token or role permissions required for integration with a nomad client.
Input variables: None
Input variables:
Name: String - Required - The node name.
Example usage:
consul acl token create -templated-policy builtin/nomad-client
consul acl token create -templated-policy builtin/nomad-client -var name:node-1

@ -1,6 +1,6 @@
{
"TemplateName": "builtin/nomad-server",
"Schema": "",
"Template": "\nacl = \"write\"\nmesh = \"write\"\n\nagent_prefix \"\" {\n policy = \"read\"\n}\nnode_prefix \"\" {\n policy = \"write\"\n}\nservice_prefix \"\" {\n policy = \"write\"\n}",
"Template": "\nacl = \"write\"\nmesh = \"write\"\n\nagent_prefix \"\" {\n policy = \"read\"\n}\nnode \"{{.Name}}\" {\n policy = \"write\"\n}\nservice_prefix \"\" {\n policy = \"write\"\n}",
"Description": "Gives the token or role permissions required for integration with a nomad server."
}

@ -1,8 +1,9 @@
Name: builtin/nomad-server
Description: Gives the token or role permissions required for integration with a nomad server.
Input variables: None
Input variables:
Name: String - Required - The node name.
Example usage:
consul acl token create -templated-policy builtin/nomad-server
consul acl token create -templated-policy builtin/nomad-server -var name:node-1
Raw Template:
acl = "write"
@ -11,7 +12,7 @@ mesh = "write"
agent_prefix "" {
policy = "read"
}
node_prefix "" {
node "{{.Name}}" {
policy = "write"
}
service_prefix "" {

@ -1,5 +1,6 @@
Name: builtin/nomad-server
Description: Gives the token or role permissions required for integration with a nomad server.
Input variables: None
Input variables:
Name: String - Required - The node name.
Example usage:
consul acl token create -templated-policy builtin/nomad-server
consul acl token create -templated-policy builtin/nomad-server -var name:node-1

Loading…
Cancel
Save