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
Update example plugin #1061
Conversation
There was a problem hiding this 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). |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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/example/connector.go
Outdated
clientConn net.Conn, | ||
credentialValuesByID connector.CredentialValuesByID, | ||
) (net.Conn, error) { | ||
connector.logger.Debugln("waiting for initial write from client") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
test/plugin/example/plugin.go
Outdated
"pluginAPIVersion": "0.1.0", | ||
"type": "connector.tcp", | ||
"id": "example-tcp-connector", | ||
"description": "it's just an example", |
There was a problem hiding this comment.
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
)
b67ea0e
to
c248c50
Compare
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.
c248c50
to
53e9b5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izgeri LGTM!
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