airshipctl/manifests/function/generate-secrets-example/SecretGenerateExamples.md
SirishaGopigiri 993d13c475 Reverting secret-generation template and adding examples
This reverts commit bfe88fda56.
We are also adding some README.md files and some example yaml
for easy facilitation of secret generation.

Reason for revert: Taking a different approach to implement secret generation https://review.opendev.org/c/airship/airshipctl/+/771736

Change-Id: Idea4271f99b4bc9f0f88440fc19b6ca44686cf2a
2021-01-29 11:02:37 +00:00

1.2 KiB

Secret Generation Examples

Below examples show different function calls in templater that can be used for creation of secrets.

  1. derivePassword function to generate password
password: {{ derivePassword 1 "long" (randAscii 10) "user" "example.com" }}
  1. To generate randonm Ascii or AlphaNum or Numeric or Alpha keys
test1: {{ randAlphaNum <len> }}
test2: {{ randAlpha 5 }}
test3: {{ randNumeric 12 }}
test4: {{ randAscii 10 }}
  1. Generate keys matching regex
regexkey: {{ regexGen "abc[x-z]+" 6 }}
  1. To generate certificate authorities
{{- $ca := genCA <commonName> <validity> }}
{{- $ca := genCA "foo-ca" 365 }}
{{- $ca := genCAWithKey "foo-ca" 365 (genPrivateKey "rsa") }}
  1. Certificate generation(selfsigned and signed)
{{- $cert := genSelfSignedCert <cn> <ip_list> <dns_list> <validity> }}
{{- $cert := genSelfSignedCertWithKey "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 (genPrivateKey "ecdsa") }}
{{- $cert := genSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 $ca }}
{{- $cert := genSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 $ca (genPrivateKey "ed25519")}}