Add http-wasm plugin support to Traefik

This commit is contained in:
Jesse Haka 2023-11-30 22:42:06 +02:00 committed by GitHub
parent b2bb96390a
commit 6858dbdd07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 338 additions and 119 deletions

View file

@ -138,18 +138,28 @@ func checkLocalPluginManifest(descriptor LocalDescriptor) error {
var errs *multierror.Error
switch m.Type {
case "middleware", "provider":
// noop
case typeMiddleware:
if m.Runtime != runtimeYaegi && m.Runtime != runtimeWasm && m.Runtime != "" {
errs = multierror.Append(errs, fmt.Errorf("%s: unsupported runtime '%q'", descriptor.ModuleName, m.Runtime))
}
case typeProvider:
if m.Runtime != runtimeYaegi && m.Runtime != "" {
errs = multierror.Append(errs, fmt.Errorf("%s: unsupported runtime '%q'", descriptor.ModuleName, m.Runtime))
}
default:
errs = multierror.Append(errs, fmt.Errorf("%s: unsupported type %q", descriptor.ModuleName, m.Type))
}
if m.Import == "" {
errs = multierror.Append(errs, fmt.Errorf("%s: missing import", descriptor.ModuleName))
}
if m.IsYaegiPlugin() {
if m.Import == "" {
errs = multierror.Append(errs, fmt.Errorf("%s: missing import", descriptor.ModuleName))
}
if !strings.HasPrefix(m.Import, descriptor.ModuleName) {
errs = multierror.Append(errs, fmt.Errorf("the import %q must be related to the module name %q", m.Import, descriptor.ModuleName))
if !strings.HasPrefix(m.Import, descriptor.ModuleName) {
errs = multierror.Append(errs, fmt.Errorf("the import %q must be related to the module name %q", m.Import, descriptor.ModuleName))
}
}
if m.DisplayName == "" {