Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Pod Mutating Webhook & Secret Annotation Injector #241

Closed
wants to merge 40 commits into from

Conversation

EngHabu
Copy link
Contributor

@EngHabu EngHabu commented Mar 19, 2021

TL;DR

Add a Pod Mutating WebHook cmd for flytepropeller. The current setup only implements a secrets injector that can either inject secrets available to FlytePropeller or k8s secrets.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

  • flytepropeller webhook init-certs command issues a CA/Cert/PrivateKey and store them into a secret given a secret name
  • flytepropeller webhook creates a MutatingWebhookConfigration object in etcd., a webhook server and registers it with API Server. From there:
    1. It starts listening to Pods labeled with inject-flyte-secrets: true.
    2. Parses out annotations on the pod to know which secrets to inject
    3. Lookups the env (envVars and mounted files) for the secret, if found it'll inject it directly into the pod
    4. Adds k8s EnvFrom or VolumeMountSource to mount the right secret into the Pod
  • Plugin Manager change to automatically add inject-flyte-secrets: true to CRDs if the task has secrets in its TaskTemplate.

Tracking Issue

flyteorg/flyte#800

kumare3 and others added 30 commits March 5, 2021 11:18
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Ketan Umare <[email protected]>
@EngHabu EngHabu requested a review from kumare3 as a code owner March 19, 2021 17:41
@@ -0,0 +1,208 @@
package cmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets put a top level docs for the intent of this cmd?

@@ -0,0 +1,158 @@
package cmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another package comment?

if err != nil {
return pluginsCore.UnknownTransition, err
}

<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflict?

@@ -0,0 +1,66 @@
package k8s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs on the top?

@@ -0,0 +1,197 @@
package webhook
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely need docs here

@kumare3
Copy link
Contributor

kumare3 commented Mar 19, 2021

I do not know whats the best way to do this, but we should have a general flow somewhere for secrets, maybe in the readme? that Propeller will inject secret proto into annotations and then the injector will actually add the secrets to every pod

@EngHabu
Copy link
Contributor Author

EngHabu commented Mar 19, 2021

too many conflicts... starting a new branch

@EngHabu EngHabu closed this Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants