-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat: plugins as services #16852
base: master
Are you sure you want to change the base?
feat: plugins as services #16852
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.
Some docs change requests
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.
minor nit
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16852 +/- ##
==========================================
- Coverage 49.21% 49.10% -0.12%
==========================================
Files 274 276 +2
Lines 48111 48276 +165
==========================================
+ Hits 23677 23704 +27
- Misses 22090 22227 +137
- Partials 2344 2345 +1 ☔ View full report in Codecov by Sentry. |
782c4e7
to
4709953
Compare
df2caf8
to
a8b8175
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.
Overall, I'm liking the ideas.
I do think we should implement some form of auth on v1. Other unauth'ed components are a problem, and it's difficult to retroactively add that.
I also think some of the new files could use more test coverage.
But generally, looking good!
How about this thing from above: Do you have ideas on how you'd like auth to work? |
Might have to hop on a call to 100% understand the port issue. Gotta focus on ArgoCon stuff for now. re: auth - I think we should probably ask the user to generate a Secret and mount it to the FS of both the repo-server and the plugins. The plugin server would require that the password be present in gRPC call metadata for every call. |
42761cf
to
7dfbd61
Compare
This commit makes the repo server able to use cmp plugins via kubernetes services. It implements argoproj#14132 - read that for details Signed-off-by: Alan Clucas <alan@clucas.org>
Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
7dfbd61
to
504d406
Compare
This is ready for re-review. The CI license check is failing, but it is for everything these days. |
path := fmt.Sprintf("%s/%s", strings.TrimRight(a.filePath, "/"), common.PluginAuthSecretName) | ||
content, err := os.ReadFile(path) | ||
if err != nil { | ||
log.Errorf("No authentication secret present at %s", path) |
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.
As someone who spends an inordinate amount of time reading error messages that involve lousy inputs (especially leading/trailing whitespace), I'd like to encourage people to consistently wrap string variables in a quotation character.
log.Errorf("No authentication secret present at %s", path) | |
log.Errorf("No authentication secret present at '%s'", path) |
Note: ideally argocd would be consistent about whether it's using "
, '
, or "`", but it isn't right now, so if you pick the one that is used the most or by things closest to this code, that'd be great.
@@ -0,0 +1 @@ | |||
tests/unreadable |
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.
Can you add a newline at EOF? (I'm not sure how to get github to let me suggest this...)
if err != nil { | ||
log.Errorf("Unable to connect to config management plugin service with address %s", address) | ||
log.Errorf("Unable to connect to config management plugin with address %s (type %s)", c.address, c.clientType.String()) |
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.
If address has a risk of having garbage characters, then quotes would be good. I'm assuming that type is a relatively constrained thing and thus shouldn't need them.
return &clientSet{address: address, secretPath: secretPath, clientType: clientType} | ||
} | ||
|
||
// wrappedStream wraps around the embedded grpc.ClientStream, and intercepts the RecvMsg and |
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.
Unless there's a stylistic thing for the double space here...
// wrappedStream wraps around the embedded grpc.ClientStream, and intercepts the RecvMsg and | |
// wrappedStream wraps around the embedded grpc.ClientStream, and intercepts the RecvMsg and |
func (c *clientSet) readAuthSecret(root string) (string, error) { | ||
tryPath := c.secretPath | ||
for { | ||
path := fmt.Sprintf(filepath.Join(root, tryPath, common.PluginAuthSecretName)) |
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.
This should make the linter happy:
path := fmt.Sprintf(filepath.Join(root, tryPath, common.PluginAuthSecretName)) | |
path := filepath.Join(root, tryPath, common.PluginAuthSecretName) |
The alternative would be:
path := fmt.Sprintf("%s", filepath.Join(root, tryPath, common.PluginAuthSecretName))
The current code is risky in C languages if someone could construct root
, tryPath
, or common.PluginAuthSecretName
to include %...
(I expect go might not count as a C language here, but it's good practice to avoid risky style...)
} | ||
tryPath = filepath.Dir(tryPath) | ||
} | ||
return ``, status.Errorf(codes.Unauthenticated, "No authentication secret present at %s or parents", filepath.Join(root, c.secretPath)) |
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.
I'd probably want quotes around %s
.
I'm not sure what parents
is in context. (It's also possible it needs a possessive '
marker.)
// PluginConfigFileName is the Plugin Config File is a ConfigManagementPlugin manifest located inside the plugin container | ||
PluginConfigFileName = "plugin.yaml" | ||
// PluginAuthSecretName is the name of the authentication secret located inside the plugin container | ||
PluginAuthSecretName = "secret" | ||
// PluginAuthTokenHeader is the name of the header to be used for auth. It must be lower case. |
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.
// PluginAuthTokenHeader is the name of the header to be used for auth. It must be lower case. | |
// PluginAuthTokenHeader is the name of the header to be used for auth. It must be lowercase. |
|
||
!!! Ensure that: | ||
1. The argocd-repo-server deployment has `automountServiceAccountToken: true` | ||
2. The argocd-repo-server's service account has a role binding allowing `get`, `list` and `watch` on services. |
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.
2. The argocd-repo-server's service account has a role binding allowing `get`, `list` and `watch` on services. | |
2. The argocd-repo-server's service account has a role binding allowing `get`, `list` and `watch` on services. |
This commit makes the repo server able to use cmp plugins via kubernetes services.
Closes #14132 - read that for details of the design
Some discussion points for this PR:
Checklist: