Skip to content

added keystore support for custom functions auth#3869

Merged
negz merged 1 commit intocrossplane:masterfrom
AndrewChubatiuk:xfn-auth-keystore
May 5, 2023
Merged

added keystore support for custom functions auth#3869
negz merged 1 commit intocrossplane:masterfrom
AndrewChubatiuk:xfn-auth-keystore

Conversation

@AndrewChubatiuk
Copy link
Copy Markdown

@AndrewChubatiuk AndrewChubatiuk commented Mar 15, 2023

Description of your changes

crossplane-xfn doesn't support pulling images from:

  • registries such as ECR, ACR, which are using temporary credentials
  • service account credentials
  • kube secrets

Fixes #3868
Fixes #3717

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Build container locally with precompiled crun v1.8.1 and tested in AWS EKS with and without an access to ECR

@AndrewChubatiuk AndrewChubatiuk requested review from a team as code owners March 15, 2023 08:46
@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 2 times, most recently from 80170da to d628e7a Compare March 15, 2023 09:58
Copy link
Copy Markdown
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

This looks good to me at first glance. Relates loosely to #3717

Could you please fill out the "how has this been tested" section of the PR template, and sign the DCO. You'll need to do both for us to accept this PR.

@AndrewChubatiuk
Copy link
Copy Markdown
Author

This looks good to me at first glance. Relates loosely to #3717

Could you please fill out the "how has this been tested" section of the PR template, and sign the DCO. You'll need to do both for us to accept this PR.

It's not hard to add a support for #3717 as well
Added both test section and DCO

@jbw976
Copy link
Copy Markdown
Member

jbw976 commented Mar 17, 2023

Thanks a lot @AndrewChubatiuk for taking a stab at fixing these issues that have been blocking some early adopters progress on testing composition functions! That's very helpful 🤓

made it compatible with crun 1.8.1.

Do the changes to make it compatible with crun 1.8.1 have any impact to compatibility with older versions of crun? Should we be considering pinning the version of crun we use, as suggested by @negz here?

@bobh66
Copy link
Copy Markdown
Contributor

bobh66 commented Mar 17, 2023

Great work @AndrewChubatiuk ! Thanks for digging into this!
Probably a good idea to pin crun to 1.8.1 as part of these changes, if that interface is going to be fragile.

@AndrewChubatiuk
Copy link
Copy Markdown
Author

it should work with older versions, but anyway only 1.8.1 is available now for debian. I was using build container to test with older versions of crun

Copy link
Copy Markdown
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

Thanks @AndrewChubatiuk. A few comments, but this looks good overall.

Please squash/cleanup your git commits before we merge this (but please do keep the sysfs fix in a separate commit).

}
if opts.pull == ImagePullPolicyNever {
return nil, errors.New(errPullNever)
keychain, err := k8schain.NewInCluster(ctx, k8schain.Options{})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will NewInCluster always fail if in-cluster auth isn't supported?

Or more generally, what causes NewInCluster to fail and what causes remote.WithAuthFromKeychain to fail? It may be worth adding comments to clarify.

@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 3 times, most recently from 89df254 to 5dfec14 Compare March 22, 2023 16:32
@AndrewChubatiuk
Copy link
Copy Markdown
Author

@negz
Moved crun changes to #3893
In this PR additionally:

  • squashed all commits
  • added support for imagePullSecrets and service account credentials
  • removed unused ImagePullAuth

@negz negz added this to the v1.12 milestone Mar 22, 2023
@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 2 times, most recently from 3c7e814 to 5f660df Compare March 26, 2023 06:41
@AndrewChubatiuk AndrewChubatiuk requested a review from a team as a code owner March 26, 2023 06:41
@AndrewChubatiuk AndrewChubatiuk requested a review from bassam March 26, 2023 06:41
@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 2 times, most recently from a3dc9b5 to 800db13 Compare March 26, 2023 06:52
Copy link
Copy Markdown
Member

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Thanks @AndrewChubatiuk, left a couple of comments!

I don't think this PR will be fixing #3718 though which is more about passing credentials for the function itself rather than pulling it image.


// Secrets for pulling function images.
// +optional
ImagePullSecrets []ContainerFunctionImagePullSecret `json:"imagePullSecrets,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
ImagePullSecrets []ContainerFunctionImagePullSecret `json:"imagePullSecrets,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

Any reason not to use the same type as packagePullSecrets?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks @AndrewChubatiuk, left a couple of comments!

I don't think this PR will be fixing #3718 though which is more about passing credentials for the function itself rather than pulling it image.

it's true, removed this issue from PR

@AndrewChubatiuk
Copy link
Copy Markdown
Author

@turkenh made changes, not sure how it's better to pass service account and namespace to RunFunction

@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 5 times, most recently from a5186f3 to 41b0fb3 Compare April 18, 2023 19:03
@jbw976 jbw976 removed this from the v1.12 milestone Apr 24, 2023
@AndrewChubatiuk
Copy link
Copy Markdown
Author

@turkenh @negz are there any additional changes needed?

Copy link
Copy Markdown
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

Sorry this review took so long! I had to switch focus for a while but I expect to be working on Composition Functions again for at least a few weeks. I do think this needs a few more changes - please ping me on Crossplane Slack when you're ready for me to take another look.

@AndrewChubatiuk AndrewChubatiuk force-pushed the xfn-auth-keystore branch 6 times, most recently from 606d6e5 to 9d55288 Compare May 5, 2023 04:34
Signed-off-by: Andrew Chubatiuk <andrew.chubatiuk@motional.com>
Copy link
Copy Markdown
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

Thanks for persisting with this @AndrewChubatiuk! It looks great. I have some ideas for small improvements, but I can open a follow-up PR for those. I'll copy you on that.

@negz negz merged commit 9beac48 into crossplane:master May 5, 2023
@AndrewChubatiuk AndrewChubatiuk deleted the xfn-auth-keystore branch May 5, 2023 22:02
negz added a commit to negz/crossplane that referenced this pull request May 6, 2023
This reduces the complexity of RunFunction a little.

This commit also has a few small cleanups following on to crossplane#3869

Signed-off-by: Nic Cope <nicc@rk0n.org>
negz added a commit to negz/crossplane that referenced this pull request May 6, 2023
This reduces the complexity of RunFunction a little.

This commit also has a few small cleanups following on to crossplane#3869

Signed-off-by: Nic Cope <nicc@rk0n.org>
negz added a commit to negz/crossplane that referenced this pull request May 10, 2023
This reduces the complexity of RunFunction a little.

This commit also has a few small cleanups following on to crossplane#3869

Signed-off-by: Nic Cope <nicc@rk0n.org>
negz added a commit to negz/crossplane that referenced this pull request May 24, 2023
This reduces the complexity of RunFunction a little.

This commit also has a few small cleanups following on to crossplane#3869

Signed-off-by: Nic Cope <nicc@rk0n.org>
plumbis pushed a commit to plumbis/crossplane that referenced this pull request May 31, 2023
This reduces the complexity of RunFunction a little.

This commit also has a few small cleanups following on to crossplane#3869

Signed-off-by: Nic Cope <nicc@rk0n.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add credential helpers support for composition functions Implement imagePullSecrets for Composition Functions

5 participants