GithubHelp home page GithubHelp logo

openlab-red / mutating-webhook-vault-agent Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 4.0 106 KB

Mutating Admission Controller - Vault Agent Sidecar Injection

License: Apache License 2.0

Dockerfile 2.00% Go 98.00%
vault-agent-webhook admission-controllers mutating-webhook openshift kubernetes vault-agent secrets

mutating-webhook-vault-agent's Introduction

Mutating Webhook Vault Agent

DEPRECATED

In favour of Vault Agent Injector

More info how to use with OpenShift: https://github.com/openlab-red/hashicorp-vault-for-openshift

Build Vault Agent Webhook container

    oc project hashicorp

    oc apply -f build/webhook-build.yaml

    oc start-build vault-agent-webhook --follow

Deploy Vault Agent WebHook

  1. Create the sidecar vault agent configuration

    oc apply -f build/sidecar-configmap.yaml
    
  2. Process Mutating WebHook Template.

    The template is going to create the following resources:

    • vault-agent-webhook-psp PodSecurityPolicy
    • vault-agent-webhook-clusterrole ClusterRole
    • vault-agent-webhook ServiceAccount
    • vault-agent-webhook-rolebinding ClusterRoleBinding
    • vault-agent-webhook Service
    • vault-agent-webhook DeploymentConfig
    • vault-agent-webhook MutatingWebhookConfiguration

    2.1 Get service-ca.crt from the configmap ca-bundle.

    oc extract configmap/vault-agent-webhook-cabundle --confirm
    export CA_BUNDLE=$(cat service-ca.crt | base64 | tr -d '\n')
    

    2.2 Process the webhook-template

    oc process -f build/webhook-template.yaml -p CA_BUNDLE=${CA_BUNDLE} | oc apply -f -
    
    PARAMETER DEFAULT DESCRIPTION
    CA_BUNDLE CA used by kubernetes to trust the webhook
    VAULT_NAMESPACE hashicorp Hashicorp Vault Namespac
    GIN_MODE release Http server startup mode gin-gonic
    LOG_LEVEL INFO Log level from logrus

Verify Sidecar Injection

  1. Label the target project where you want the webhook to inject the vault agent sidecar container.

    oc label namespace app sidecar.agent.vaultproject.io/webhook=enabled
    
  2. Add the sidecar.agent.vaultproject.io/inject annotation with value true to the pod template spec to enable injection.

    oc patch dc/thorntail-example -p '{
                                     "spec": {
                                       "template": {
                                         "metadata": {
                                           "annotations": {
                                             "sidecar.agent.vaultproject.io/inject": "true",
                                             "sidecar.agent.vaultproject.io/secret": "secret/example",
                                             "sidecar.agent.vaultproject.io/filename": "application.yaml",
                                             "sidecar.agent.vaultproject.io/role": "example"
                                           }
                                         }
                                       }
                                     }
                                   }'
    
  3. The vault agent webhook will:

    • Create or Update the vault agent configmap
    • Inject Vault agent sidecar container
    • Inject Vault secret fetcher sidecar container
    • Mount Vault volume to the app container

References

mutating-webhook-vault-agent's People

Contributors

eye0fra avatar schen1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mutating-webhook-vault-agent's Issues

Deployed to openshift 4.3 and got a build error.

Expectations:
Following the steps, my expectation is to see two pods in the namespace.
Build pod is in "Failed" state and the errors are :
STEP 1: FROM docker.io/golang:1.11
STEP 2: LABEL authors="Mattia Mascia [email protected]"
823cb071399627a31b62c23b734a0c7128d8a5b2465e6e80110664f058d198e8
STEP 3: ADD https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 /usr/bin/dep
error: build error: error building at STEP "ADD https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 /usr/bin/dep": source can't be a URL for COPY

Don't know how to proceed.
Any assistance is appreciated.

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.