Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use init container to download packages and functions #411

Merged
merged 6 commits into from
Sep 26, 2022

Conversation

jiangpengcheng
Copy link
Member

@jiangpengcheng jiangpengcheng commented Jun 28, 2022

Fixes #400

Wait for function-mesh-worker-service support oauth2, leave any comment you want

Motivation

Use an init container to download packages/functions from pulsar: #390 (comment)

Modifications

Attach an init container and empty volume if JarLocation/PyLocation/GoLocation is specified

Verifying this change

  • Make sure that the change passes the CI checks.

  • This change added tests and can be verified as follows:

    • Added unit test for generating init container and volume when one of JarLocation/PyLocation/GoLocation is specified
    • Require integration tests for end-to-end deployment with one of JarLocation/PyLocation/GoLocation specified

Documentation

  • doc-required

    need docs for dev

@jiangpengcheng jiangpengcheng requested review from nlu90, freeznet and a team as code owners June 28, 2022 01:48
@github-actions github-actions bot added the doc-required This pr needs a document label Jun 28, 2022
@freeznet freeznet added type/feature Indicates new functionality m/2022-07 labels Jul 1, 2022
@jiangpengcheng
Copy link
Member Author

pulsarctl need some additional steps for oauth2: pulsarcl oauth2 activate and pulsarctl context set, which require some extra parameters like: --issuer-endpoint, --client-id, --audience

there are two ways to achieve this:

  1. adding another field like oauth2 in the PulsarMessaging struct and do oauth2 activate and context set in the init container

  2. make pulsarctl parse those parameters from the auth JSON file, and do oauth2 activate automatically when auth plugin is OAuth2(I don't know why pulsarctl doesn't do this like pulsar-admin, so not sure whether it's possible)

I prefer the 2nd way, do you have any opinions?
@streamnative/serverless

@jiangpengcheng jiangpengcheng changed the title [WIP]Use init container to download packages and functions Use init container to download packages and functions Jul 22, 2022
@jiangpengcheng jiangpengcheng force-pushed the use_init_container branch 2 times, most recently from 9b07407 to c4404d6 Compare August 3, 2022 08:15
@jiangpengcheng
Copy link
Member Author

jiangpengcheng commented Aug 4, 2022

for the compatibility issue, I tested that we can pass undefined fields when creating k8s resources, like with FM v0.4.0, which doesn't define the spec.pulsar.oauth2Config field yet, we can still apply the below config:

  pulsar:
    pulsarConfig: "test-pulsar"
    authSecret: "test-auth"
    tlsSecret: "test-tls"
    oauth2Config:
      audience: "test"
      clientId: "test"
      issuerUrl: "aaa.com"
      keySecretName: "test-secret"
      keySecretKey: "credential.json"

the controller works well and just ignores the undefined oauth2Config.

so for compatibility, we can support passing the oauth2Config in function-mesh-worker-service first, and then merge this pr(let's say it will be released in v0.5.0), finally, we can bump function-mesh to v0.5.0 without any error.

related issue: https://github.com/streamnative/function-mesh-worker-service/issues/334

@jiangpengcheng jiangpengcheng changed the title Use init container to download packages and functions [Waiting] ]Use init container to download packages and functions Aug 4, 2022
@jiangpengcheng jiangpengcheng mentioned this pull request Aug 15, 2022
3 tasks
@jiangpengcheng
Copy link
Member Author

jiangpengcheng commented Sep 20, 2022

@streamnative/serverless
this is ready to review and can be merged after this: https://github.com/streamnative/function-mesh-worker-service/pull/400

@jiangpengcheng jiangpengcheng changed the title [Waiting] ]Use init container to download packages and functions Use init container to download packages and functions Sep 20, 2022
@Huanli-Meng
Copy link
Contributor

Huanli-Meng commented Nov 7, 2022

The doc is updated for this feature through this doc PR. Therefore, remove the doc-required label and add the doc-added label.

@Huanli-Meng Huanli-Meng added doc-added and removed doc-required This pr needs a document labels Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-added m/2022-10 type/feature Indicates new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use init containers to download function
4 participants