Coder Social home page Coder Social logo

Comments (4)

atorrescogollo avatar atorrescogollo commented on July 21, 2024 2

Hi @domruf , In think Kyverno should work for this. The approach mentioned is similar to this clusterpolicy.

from k8s-sidecar-injector.

domruf avatar domruf commented on July 21, 2024 1

@atorrescogollo thank you very much. I think this will be very helpful.

from k8s-sidecar-injector.

domruf avatar domruf commented on July 21, 2024

@atorrescogollo I have the same use case. Have you found a way to make it work? Or maybe a different project that is able to do this?

from k8s-sidecar-injector.

atorrescogollo avatar atorrescogollo commented on July 21, 2024

I think something like this would work:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: inject-certs
  annotations:
    policies.kyverno.io/title: Autoinject custom CA to pods
    policies.kyverno.io/category: Certificates
    policies.kyverno.io/subject: Pod
    policies.kyverno.io/description: >-
      Automount custom CA certificates when an annotation `inject-certs=enabled` is found
spec:
  background: false
  rules:
  - name: add-volume
    match:
      resources:
        kinds:
        - Pod
    preconditions:
      all:
        - key: "{{request.object.metadata.annotations.\"inject-certs\"}}"
          operator: Equals
          value: "enabled"
        - key: "{{request.operation}}"
          operator: In
          value:
          - CREATE
          - UPDATE
    mutate:
      foreach:
        - list: "request.object.spec.containers"
          patchStrategicMerge:
            spec:
              containers:
              - name: "{{ element.name }}"
                volumeMounts:
                  - name: "etc-ssl-certs"
                    mountPath: "/etc/ssl/certs"
              volumes:
              - name: etc-ssl-certs
                configMap:
                  name: ca-pemstore

from k8s-sidecar-injector.

Related Issues (20)

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.