Giter Site home page Giter Site logo

eladleev / kubeseal-convert Goto Github PK

View Code? Open in Web Editor NEW
50.0 3.0 4.0 407 KB

A tool for importing secrets from a pre-existing secrets management systems (e.g. Vault, Secrets Manager) into a SealedSecret :shushing_face:

License: Apache License 2.0

Go 92.39% Makefile 7.61%
cli k8s kubernetes migration platform sealed-secrets secrets-management tools

kubeseal-convert's Introduction

kubeseal-convert

GitHub Workflow Status Go Report Card Renovate

The missing part of Sealed Secrets. ๐Ÿ”

Motivation

kubeseal-convert aims to reduce the friction of importing secrets from a pre-existing secret management systems (e.g. Vault, AWS Secrets Manager, etc..) into a SealedSecret.
Instead of:

  1. Going into AWS Secret Manager
  2. Retrieve the secret who needs to be migrated
  3. Create a "normal" k8s secret
  4. Fill out the values on the secret
  5. Run kubeseal

Just run kubeseal-convert with the secret path.

Table of Contents

Flags & Options

Same as the kubeseal command, kubeseal-convert is un-opinionated. It won't commit the secret to Git, apply it to the cluster, or save it on a specific path.
The SealedSecret will be printed to STDOUT. You can run it as is, as part of CI, or as part of a Job.

./kubeseal-convert <SECRETS_STORE> <PATH> --namespace <NS_NAME> --name <SECRET_NAME>

Flags

Name Description Require Type
-n, --name The Sealed Secret name. V string
--namespace The Sealed Secret namespace. If not specified, taken from k8s context. string
-a, --annotations Sets k8s annotations. KV pairs, comma separated. []string
-l, --labels Sets k8s lables. KV pairs, comma separated. []string
-h, --help Display help. none
-v, --version Display version. none

Supported SM Systems

โœ… AWS Secrets Manager
โœ… Hashicorp Vault
โœ… Azure Key Vault - Contributed by @kroonprins
โœ… Google Secrets Manager

AWS Secrets Manager

The AWS client rely on AWS local configuration variables - config file, environment variables, etc.

Hashicorp Vault

In order to work with the Vault provider, two environment variables needs to be set - VAULT_TOKEN and VAULT_ADDR.
Currently, only kv-v2 is supported.

Azure Key Vault

The <SECRETS_STORE> should contain the vault name from the vault full uri https://<SECRETS_STORE>.vault.azure.net. Authentication to the vault happens either via environment variables, managed identity, or via the az cli (az login).

GCP Secrets Manager

It's highly recommended to use the full secret format: projects/<PROJECT_ID>/secrets/<SECRET_NAME>/versions/<VERSION> If not, kubeseal-convert will try to extract the project ID from the default credentials chain, and will use the latest version of the secret.

Build from source

Prerequisites

  • Go version 1.21+
  • make command installed
  • kubeseal command installed, and a valid communication to the sealed secrets controller.

Building Steps

  1. Clone this repository
git clone https://github.com/EladLeev/kubeseal-convert && cd kubeseal-convert
  1. Build using Makefile
make build
  1. [optional] Set up local env for testing
make init-dev
  1. [optional] Run the example

Examples

./kubeseal-convert sm MyTestSecret --namespace test-ns --name test-secret --annotations converted-by=kubeseal-convert,env=dev --labels test=abc > secret.yaml

or

./kubeseal-convert vlt "mydomain/data/MyTestSecret" --namespace test-ns --name test-secret --annotations converted-by=kubeseal-convert,src=vault --labels test=abc > secret.yaml

This will:

  1. Retrieve a secret called MyTestSecret from AWS Secrets Manager / Hashicorp Vault
  2. Create it on test-ns namespace
  3. Call it test-secret
  4. Add few annotations and labels
  5. Save it as secret.yaml to be push to the repo safely

Contributing

Please read CONTRIBUTING.md for details of submitting a pull requests.

License

This project is licensed under the Apache License - see the LICENSE file for details.

kubeseal-convert's People

Contributors

dependabot[bot] avatar eladleev avatar kroonprins avatar pavel-durov avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kubeseal-convert's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v4
  • actions/setup-go v5
  • actions/checkout v4
.github/workflows/golangci-lint.yml
  • actions/setup-go v5
  • actions/checkout v4
  • golangci/golangci-lint-action v6
.github/workflows/release.yaml
  • actions/checkout v4
  • actions/setup-go v5
  • goreleaser/goreleaser-action v6
gomod
go.mod
  • go 1.22.0
  • go 1.22.6
  • cloud.google.com/go/secretmanager v1.13.6
  • github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
  • github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0
  • github.com/hashicorp/vault/api v1.14.0
  • github.com/spf13/cobra v1.8.1
  • github.com/stretchr/testify v1.9.0
  • golang.org/x/oauth2 v0.22.0
  • github.com/aws/aws-sdk-go-v2 v1.30.4
  • github.com/aws/aws-sdk-go-v2/config v1.27.28
  • github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.32.5
  • k8s.io/api v0.31.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.