{"id":13798222,"url":"https://github.com/bbl/secretize","last_synced_at":"2025-05-13T05:31:47.805Z","repository":{"id":47431701,"uuid":"311134491","full_name":"bbl/secretize","owner":"bbl","description":"Kubernetes secrets generator plugin for kustomize","archived":false,"fork":false,"pushed_at":"2021-07-24T20:24:28.000Z","size":98,"stargazers_count":69,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-18T13:44:29.225Z","etag":null,"topics":["azure-vault","hashicorp-vault","k8s-secret","kubernetes","kubernetes-secrets","kustomize","kustomize-plugin","secret-management"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-08T19:06:49.000Z","updated_at":"2024-09-05T18:39:35.000Z","dependencies_parsed_at":"2022-08-23T22:30:56.239Z","dependency_job_id":null,"html_url":"https://github.com/bbl/secretize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbl%2Fsecretize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbl%2Fsecretize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbl%2Fsecretize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbl%2Fsecretize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbl","download_url":"https://codeload.github.com/bbl/secretize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253883119,"owners_count":21978611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-vault","hashicorp-vault","k8s-secret","kubernetes","kubernetes-secrets","kustomize","kustomize-plugin","secret-management"],"created_at":"2024-08-04T00:00:40.619Z","updated_at":"2025-05-13T05:31:47.417Z","avatar_url":"https://github.com/bbl.png","language":"Go","readme":"\u003cp  align=\"center\"\u003e\n  \u003cimg width=\"409\" height=\"450\" src=\".assets/logo.png\"/\u003e\n  \u003cbr\u003e\n\u003ci\u003e Secretize is a kustomize plugin that helps generating kubernetes secrets from various sources.  \u003cbr\u003e\nIt's like a swiss army knife, but for kubernetes secrets. \u003c/i\u003e \n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cimg src=\"https://goreportcard.com/badge/github.com/bbl/secretize\" /\u003e\n   \u003cimg src=\"https://github.com/bbl/secretize/workflows/CI/badge.svg\"\u003e\n   \u003ca href=\"https://codecov.io/gh/bbl/secretize\"\u003e\n     \u003cimg src=\"https://codecov.io/gh/bbl/secretize/branch/main/graph/badge.svg\" /\u003e\n   \u003c/a\u003e\n  \n\u003c/p\u003e\n\n---\n\n## Sources\n\nSecretize is able to generate secrets using the following providers:\n\n- [AWS Secret Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html)\n- [Azure Vault](https://docs.microsoft.com/en-us/azure/key-vault/)\n- [Hashicorp Vault](https://www.vaultproject.io/)\n- [Other K8S secrets](https://kubernetes.io/docs/concepts/configuration/secret/)\n- [Environment variables](https://en.wikipedia.org/wiki/Environment_variable)\n\nIt is possible to use multiple providers at once.\n\n\n## Installation\n\nInstall secretize to your `$XDG_CONFIG_HOME/kustomize/plugin` folder:\n\n1. Export the `XDG_CONFIG_HOME` variable if it's not already set:\n\n```bash\nexport XDG_CONFIG_HOME=~/.config\n```\n\n2. Download the release binary into the kustomize plugin folder:\n\n```bash\nexport SECRETIZE_DIR=\"$XDG_CONFIG_HOME/kustomize/plugin/secretize/v1/secretgenerator\"\nmkdir -p \"$SECRETIZE_DIR\"\ncurl -L https://github.com/bbl/secretize/releases/download/v0.0.1/secretize-v0.0.1-linux-amd64.tar.gz  | tar -xz -C $SECRETIZE_DIR\n```\n\n## Usage\n\nAll providers can generate two types of secrets: `literals` and `kv` (Key-Value secrets).  \nLiteral secrets simply generate a single string output, while KV secrets will output with a dictionary of the key-value pairs.   \n\nThe full configuration API could be found in the [examples/secret-generator.yaml](./examples/secret-generator.yaml) file.\n\n### AWS Secrets Manager\n\nFetching literal secrets is as simple, as using a default kustomize `secretGenerator` plugin:\n\n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: aws-sm-secrets\nsources:\n    - provider: aws-sm\n      literals: \n        - mySecret\n        - newName=mySecret \n```\n\nThe above config would query AWS Secrets Manager provider to get the `mySecret` string value. As a result, the following manifest will be generated:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: aws-sm-secrets\ndata:\n  mySecret: c2VjcmV0X3ZhbHVlXzE= # a sample base64 encoded data \n  newName: c2VjcmV0X3ZhbHVlXzE=\n```\n \nNow let's assume that value of `mySecret` is a json string:\n```json\n{\n  \"secret_key_1\":\"secret_value_1\", \n  \"secret_key_2\": \"secret_value_2\"\n}\n```\n\nThe generator config can be slightly modified, to generate a `kv` secret:\n\n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: aws-sm-secrets\nsources:\n    - provider: aws-sm\n      kv: \n        - mySecret\n```\n\nAs a result, the following secret is generated:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: aws-sm-secrets\ndata:\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n  secret_key_2: c2VjcmV0X3ZhbHVlXzI=\n```\n\n### Azure Vault\n\nAzure Vault configuration is pretty similar to the above examples. However, there's additional `params` field, which is used to specify the Vault Name: \n\n\n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: aws-sm-secrets\nsources:\n  - provider: azure-vault\n    params:\n      name: vault-name\n    kv:\n      - kv-secrets # will treat this as JSON, the same way as in the AWS example\n    literals:\n      - literal-secret-1\n      - new_name=literal-secret-1\n```\n\n\n### Hashicorp Vault\n\nSome providers only support key-value output, e.g. Hashicorp Vault and K8S Secret. \nFor instance, the `mySecret` in Hashicorp Vault might look like the following:\n```bash\nvault kv get secret/mySecret\n====== Data ======\nKey           Value\n---           -----\nsecret_key_1  secret_value_1\nsecret_key_2  secret_value_2\n```\n\nQuerying provider's `kv` secrets will generate the corresponding key-value data:\n\n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: hashicorp-vault-secrets\nsources:\n    - provider: hashicorp-vault\n      kv: \n        - secret/data/mySecret # you need to specify the full path in hashicorp vault provider\n```\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: hashicorp-vault-secrets\ndata:\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n  secret_key_2: c2VjcmV0X3ZhbHVlXzI=\n```\n\nHowever you're able to query a certain literal in the key-value output using the following syntax: `secret-name:key`, e.g.:\n  \n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: hashicorp-vault-secrets\nsources:\n    - provider: hashicorp-vault\n      literals:\n          - secret/data/mySecret-1:secret_key_1\n```\n\nAs a result, the following manifest will be generated:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: hashicorp-vault-secrets\ndata:\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n```\n\n## Kubernetes Secret\n\nKubernetes secret provider is similar to the Hashicorp Vault. Additionally, this provider expects the `params` field with the `namespace` specification.   \nYou're able to get the entire secret data using the `kv` query, or get a particular key using the `literals` query with the `:` delimiter syntax:\n\n```yaml\n# The original secret in a default namespace\n#\napiVersion: v1\nkind: Secret\nmetadata:\n  name: original-secret\n  namespace: default\ndata:\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n  secret_key_2: c2VjcmV0X3ZhbHVlXzI=\n---\n# Secret generator configuration\n#\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: kubernetes-secrets\nsources:\n    - provider: k8s-secret\n      params:\n        namespace: default\n      kv:\n        - original-secret\n      literals:\n        - new_name=original-secret:secret_key_1\n---\n# Generated secret\n#\napiVersion: v1\nkind: Secret\nmetadata:\n  name: kubernetes-secrets\ndata:\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n  secret_key_2: c2VjcmV0X3ZhbHVlXzI=\n  new_name: c2VjcmV0X3ZhbHVlXzE=\n\n```\n \n\n## Env \n\nThe environment variables plugin is similar to the AWS and Azure plugins. The `literals` would simply fetch corresponding environment variables, while `kv` would treat each variable as JSON and try to parse it:\n\n```yaml\napiVersion: secretize/v1\nkind: SecretGenerator\nmetadata:\n  name: env-secrets\nsources:\n    - provider: env\n      kv:\n        - MY_KV_SECRET\n      literals: \n        - MY_LITERAL_SECRET\n```\n\nSecretize will fetch the corresponding environment variables during the `kustomize build` command:\n\n```bash\nexport MY_KV_SECRET='{\"secret_key_1\":\"secret_value_1\", \"secret_key_2\": \"secret_value_2\"}'\nexport MY_LITERAL_SECRET=super_secret\n\nkustomize build\n```\n\nThe following secret is generated:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: env-kv-secrets\ndata:\n  MY_LITERAL_SECRET: c3VwZXJfc2VjcmV0\n  secret_key_1: c2VjcmV0X3ZhbHVlXzE=\n  secret_key_2: c2VjcmV0X3ZhbHVlXzI=\n```\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Generators"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbl%2Fsecretize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbl%2Fsecretize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbl%2Fsecretize/lists"}