Skip to content

Commit

Permalink
tidy: collect builtin plugins to new builtins package
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyzimmer committed Aug 3, 2023
1 parent ff03c85 commit 4ad0b69
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pkg/cmd/ctlcmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import (
"google.golang.org/grpc/credentials/insecure"
"gopkg.in/yaml.v3"

"github.com/webmeshproj/webmesh/pkg/plugins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/ldap"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/ldap"
"github.com/webmeshproj/webmesh/pkg/util"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/mesh/mesh_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (

"github.com/webmeshproj/webmesh/pkg/context"
meshnet "github.com/webmeshproj/webmesh/pkg/net"
"github.com/webmeshproj/webmesh/pkg/plugins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/ldap"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/ldap"
)

func (s *meshStore) joinWithPeerDiscovery(ctx context.Context, features []v1.Feature) error {
Expand Down
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions pkg/plugins/builtins/builtins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2023 Avi Zimmerman <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package builtins contains the built-in plugin implementations.
package builtins

import (
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/ipam"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/ldap"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/mtls"
"github.com/webmeshproj/webmesh/pkg/plugins/clients"
)

// NewPluginMap returns a map of the built-in plugins.
func NewPluginMap() map[string]clients.PluginClient {
return map[string]clients.PluginClient{
"ipam": clients.NewInProcessClient(&ipam.Plugin{}),
"mtls": clients.NewInProcessClient(&mtls.Plugin{}),
"basic-auth": clients.NewInProcessClient(&basicauth.Plugin{}),
"ldap": clients.NewInProcessClient(&ldap.Plugin{}),
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 2 additions & 10 deletions pkg/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ import (
"google.golang.org/protobuf/types/known/structpb"

"github.com/webmeshproj/webmesh/pkg/context"
"github.com/webmeshproj/webmesh/pkg/plugins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins"
"github.com/webmeshproj/webmesh/pkg/plugins/clients"
"github.com/webmeshproj/webmesh/pkg/plugins/ipam"
"github.com/webmeshproj/webmesh/pkg/plugins/ldap"
"github.com/webmeshproj/webmesh/pkg/plugins/mtls"
)

var (
Expand All @@ -43,12 +40,7 @@ var (

// NewManager creates a new plugin manager.
func NewManager(ctx context.Context, opts *Options) (Manager, error) {
builtIns := map[string]clients.PluginClient{
"ipam": clients.NewInProcessClient(&ipam.Plugin{}),
"mtls": clients.NewInProcessClient(&mtls.Plugin{}),
"basic-auth": clients.NewInProcessClient(&basicauth.Plugin{}),
"ldap": clients.NewInProcessClient(&ldap.Plugin{}),
}
builtIns := builtins.NewPluginMap()
var auth, ipamv4, ipamv6 clients.PluginClient
allPlugins := make(map[string]clients.PluginClient)
stores := make([]clients.PluginClient, 0)
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import (

"github.com/webmeshproj/webmesh/pkg/context"
"github.com/webmeshproj/webmesh/pkg/mesh"
"github.com/webmeshproj/webmesh/pkg/plugins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/ldap"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/basicauth"
"github.com/webmeshproj/webmesh/pkg/plugins/builtins/ldap"
"github.com/webmeshproj/webmesh/pkg/services/dashboard"
"github.com/webmeshproj/webmesh/pkg/services/leaderproxy"
"github.com/webmeshproj/webmesh/pkg/util"
Expand Down

0 comments on commit 4ad0b69

Please sign in to comment.