forked from cloudnative-pg/cloudnative-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement CNPG-I plugin infrastructure (cloudnative-pg#3719)
Introduce foundational changes to support dynamic plugins in adherence to the CloudNativePG Interface (CNPG-I). This commit establishes the necessary infrastructure for seamless plugin management. Partially closes: cloudnative-pg#3699 Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com> Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
- Loading branch information
1 parent
e9ea01c
commit 82d1c0e
Showing
21 changed files
with
1,223 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright The CloudNativePG Contributors | ||
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 v1 | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cloudnative-pg/cloudnative-pg/internal/cnpi/plugin/client" | ||
"github.com/cloudnative-pg/cloudnative-pg/internal/configuration" | ||
) | ||
|
||
// NewLoader creates a new plugin client, loading the plugins that are required | ||
// by this cluster | ||
func (plugins PluginConfigurationList) NewLoader(ctx context.Context) (client.Client, error) { | ||
pluginLoader := client.NewUnixSocketClient(configuration.Current.PluginSocketDir) | ||
|
||
// Load the plugins | ||
for _, pluginDeclaration := range plugins { | ||
if err := pluginLoader.Load(ctx, pluginDeclaration.Name); err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
return pluginLoader, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.