Created
December 4, 2019 16:51
-
-
Save backspace/32a89b62cf1fc19d292eee5f3763d91a to your computer and use it in GitHub Desktop.
Exercising hashicorp/nomad#5944: UI: Change Run Job availability based on ACLs
This file contains 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
namespace "list-only-namespace" { | |
capabilities = ["list-jobs"] | |
} | |
namespace "permissive-namespace" { | |
policy = "write" | |
} | |
namespace "wildcard-*" { | |
capabilities = ["list-jobs"] | |
} | |
agent { | |
policy = "read" | |
} | |
node { | |
policy = "read" | |
} |
This file contains 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
acl = { | |
enabled = true | |
} |
This file contains 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
export NOMAD_TOKEN=`nomad acl bootstrap | grep "Secret ID" | cut -d " " -f 7` | |
echo "Management token: $NOMAD_TOKEN" | |
export USER_NOMAD_TOKEN=`nomad acl token create -name=user -policy=user| grep "Secret ID" | cut -d " " -f 7` | |
echo "User token: $USER_NOMAD_TOKEN" | |
nomad acl policy apply anonymous anonymous-policy.hcl | |
nomad acl policy apply user user-policy.hcl | |
nomad namespace apply list-only-namespace | |
nomad namespace apply permissive-namespace | |
nomad namespace apply wildcard-something | |
nomad namespace apply wildcard-specific | |
nomad namespace apply other | |
# Now if you run the UI, you can try it out with the management token, the user token, and without a token (anonymous). |
This file contains 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
# Must be at least Nomad 0.10.2 | |
nomad agent -dev -config=client-acl.hcl |
This file contains 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
namespace "list-only-namespace" { | |
capabilities = ["list-jobs"] | |
} | |
namespace "permissive-namespace" { | |
policy = "write" | |
} | |
namespace "wildcard-*" { | |
policy = "write" | |
} | |
namespace "wildcard-specific" { | |
capabilities = ["list-jobs"] | |
} | |
namespace "default" { | |
policy = "write" | |
} | |
agent { | |
policy = "read" | |
} | |
node { | |
policy = "read" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment