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

Update example plugin #1061

Merged
merged 2 commits into from Jan 2, 2020
Merged

Update example plugin #1061

merged 2 commits into from Jan 2, 2020

Conversation

izgeri
Copy link
Contributor

@izgeri izgeri commented Dec 30, 2019

What does this PR do (include background context, if relevant)?

We're working on updating the docs to advise on how to build external Secretless connector plugins

This PR updates the template / docs to assume that someone is building an external plugin, and revises the example plugin to be better based on the template.

What ticket does this PR close?

Connected to cyberark/secretless-docs#213

@izgeri izgeri self-assigned this Dec 30, 2019
Copy link
Contributor

@sgnn7 sgnn7 left a comment

Choose a reason for hiding this comment

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

@izgeri A few comments- mostly nits


To create a new Secretless connector plugin, follow these instructions:

1. Copy the relevant template directory (HTTP/TCP) into a folder on your local machine (or to `internal/plugin/connectors/<connector type>` if you are building an internal connector).
Copy link
Contributor

Choose a reason for hiding this comment

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

connector type -> connector_type


If you're not sure which connector type is appropriate for your target service, please refer to the [connector technical overview](https://github.com/cyberark/secretless-broker/tree/master/pkg/secretless/plugin/connector#technical-overview) for guidelines.

1. Update the copied files to implement your connector. Each file includes instructions in the form of TODOs.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably surround the TODO with backticks for clarity here


If you follow the TODO-based instructions included in the files in this directory, you will be able to write integration tests for your connector using `docker-compose`. The included test scripts & files will help you stand up networked containers with docker-compose.

**Note for internal connectors:** The the test directory should be copied into `test/connector/<connector type>/` and renamed to `<connector_name>`. The [`Jenkinsfile`](../../Jenkinsfile) is set up to automatically run the integration tests from this directory with each project build.
Copy link
Contributor

Choose a reason for hiding this comment

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

The line breaks in this file should probably follow the standard editor line length max (80-100 chars) rather than having it all in single lines.

@@ -3,6 +3,9 @@ version: '3.0'
services:
# TODO: add a service for the platform you want secretless to connect with

# TODO: make sure Secretless runs with your plugin
# which may mean adding the .so file as a volume
# and revising the command to pass in the .so using the -p flag
Copy link
Contributor

Choose a reason for hiding this comment

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

Surround .so with backtics in both lines as well as the -p

test/plugin/Dockerfile Show resolved Hide resolved
clientConn net.Conn,
credentialValuesByID connector.CredentialValuesByID,
) (net.Conn, error) {
connector.logger.Debugln("waiting for initial write from client")
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the indentation of the method signature, it might be easier to read with a LF above this line

Copy link
Contributor

Choose a reason for hiding this comment

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

Debugln should probably start capitalized (it's not an error message). Same applies to rest of non-error messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix, but this was a copy-paste from the old example

"pluginAPIVersion": "0.1.0",
"type": "connector.tcp",
"id": "example-tcp-connector",
"description": "it's just an example",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something better/more formal should be used here (eg. Example TCP Plugin)

@izgeri izgeri force-pushed the update-example-plugin branch 2 times, most recently from b67ea0e to c248c50 Compare December 30, 2019 19:00
Geri Jennings added 2 commits January 2, 2020 13:29
The example plugin should be a better copy of the template (eg use two files,
connector.go and plugin.go) so that it's clearer to people trying to build
plugins exactly how to create and build them in practice

This reorganizes the content to better mimic the templates and updates
the Dockerfile to correctly build the plugin.
The connector templates were originally written for internal connectors, but
will be used as a guide by people building external connectors. This commit
revises the languages in the README to default to an external-connector building
audience, but maintains the guidelines for building internal connectors.
Copy link
Contributor

@sgnn7 sgnn7 left a comment

Choose a reason for hiding this comment

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

@izgeri LGTM!

@sgnn7 sgnn7 merged commit b7bf47e into master Jan 2, 2020
@sgnn7 sgnn7 deleted the update-example-plugin branch January 2, 2020 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants