add ability to set imagePullSecrets #64
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind feature
What this PR does / why we need it:
If the
imageswap_pull_secret_source_name
is set, the kubeconfig is loaded ininit_imageswap()
andcreates a Kubernetes CoreV1Api client. It makes a copy of the secret in the k8s object passed in,
then reads in the source secret in the imageswap-system namespace to generate a new secret in the
target namespace from it’s data. This generated secret is then created or updated in the target
namespace.
Added Kubernetes to the Pipfile for the imageswap image and updated the Pipfile.lock accordingly.
Added a new ClusterRole,
imageswap-write-secrets
in deploy/install.yaml to give get and updatepermissions to
imageswap-shared-pull-secrets
and create permissions forsecrets
. Also added a newClusterRoleBinding,
imageswap-write-secrets-crb
for theimageswap-write-secrets
ClusterRole.Added
add_image_pull_secrets
method to add imagePullSecrets to a k8s object. This method is usedin
mutate()
to add imagePullSecrets (if applicable) to a pod or a pod template. The method takes in2 arguments, the modified_spec and the namespace of the target object. There is a side-effect in this
method of creating/updating the secret
imageswap-shared-pull-secrets
in whichever namespace wastargeted.
Added 2 new environment variables:
IMAGESWAP_PULL_SECRET_DESTINATION_NAME: name of secret to be created in the target namespace (set to
imageswap-shared-pull-secrets
so that it will line up with the permissions write/read/deletepermission granted on just that secret in other namespaces)
IMAGESWAP_PULL_SECRET_SOURCE_NAME: name of secret in imageswap-system namespace to copy (the secret
stored at this value will need to be pre-populated by users)
Which issue(s) this PR fixes:
Fixes #21
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., usage docs, etc.: