Skip to content

Support create and update source with package name - #8988

Merged
codelipenghui merged 1 commit into
apache:masterfrom
zymap:package-management-source
Dec 30, 2020
Merged

codelipenghui merged 1 commit into
apache:masterfrom
zymap:package-management-source

Conversation

@zymap

@zymap zymap commented Dec 17, 2020 •

Copy link
Copy Markdown
Member

Master Issue: #8676

Motivation

We have a new package management service that can manage all
the source packages. We can use that in the Pulsar Source to manage
source packages.
I reuse the 'packageUrl' for downloading the package from the packages
management service. So user can use the package name as the 'packageUrl'
to download it.

Modifications

  • Support create and update the source with package name
  • Add test for this

---

Master Issue: apache#8676

*Motivation*

We have a new package management service that can manage all
the source packages. We can use that in the Pulsar Source to manage
source pakcages.

*Modifications*

- Support create and update source with package name
- Add test for this
@zymap zymap mentioned this pull request Dec 17, 2020
8 tasks done
@zymap

zymap commented Dec 21, 2020

Copy link
Copy Markdown
Member Author

/pulsarbot run-failure-checks

@zymap

zymap commented Dec 21, 2020

Copy link
Copy Markdown
Member Author

@codelipenghui @wolfstudy @sijie @jiazhai Please take a look when you have time. Thanks.

@sijie sijie added this to the 2.8.0 milestone Dec 22, 2020
return Arrays.stream(PackageType.values()).anyMatch(type -> destPkgUrl.startsWith(type.toString()));
}

private File downloadPackageFile(String packageName) throws IOException, PulsarAdminException {

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.

Why do we need to download the package?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we provide a pkgUrl for creating or updating the functions, the function worker has some pre-check of the packages

clsLoader = FunctionConfigUtils.validate(functionConfig, componentPackageFile);

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.

You need to validate the existence of the package. But I don't think you should download the package.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ideally, we validate the existence is enough. But that depends on we do the packages format check or function check when uploading a package to the package management service. Then we can remove the checks for the functions which are using the package name to register. But for now, we still need to rely on those checks in the function's code.

I looked into the creation of the function. I saw if a function provided with a packageUrl, it will download the package and save it as a temp file and do some checks with it. And also it always passes a File as the parameter for the method call.

functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,

public static ExtractedSourceDetails validate(SourceConfig sourceConfig, Path archivePath,

If we don't download the packages files, we may need to change the existing register function logic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sijie Please take a look when you have time. Thanks.

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.

@zymap The purpose of introducing a package registry is to avoid checking the packages every time when you create a function using this package. If we need to validate the function package in the package registry, let's add the functionality there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sijie ok. I open issue #9081 for adding the validation when uploading a package and will do it in another PR.
Can we merge this PR first? Because this PR will allow us to use the package name to create functions.

@codelipenghui
codelipenghui merged commit f1dbbd1 into apache:master Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants