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

Issue #340 - create application/project events for audit #440

Merged
merged 3 commits into from
Jul 24, 2018

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented Jul 20, 2018

PR implements following changes:

  • app controller, app/project api services produce k8s events on every app/project change
  • api GET /applicaitons//events now return application events is resource name is not specified

PR has one questionable change: k8s event don't have suitable field to store username. I've chosen to use ReportingInstance field for username. All fields seems equally bad for this purpose. Please let me know if you have better idea.

@jessesuen
Copy link
Member

PR has one questionable change: k8s event don't have suitable field to store username. I've chosen to use ReportingInstance field for username. All fields seems equally bad for this purpose. Please let me know if you have better idea.

One thought about this: is it necessary that we dedicate one of these fields as a username? Can't it just be part of the message (e.g. "'admin' synchronized app")

@alexmt
Copy link
Collaborator Author

alexmt commented Jul 23, 2018

It make sense to me. Updated.

func NewServer(ns string, appclientset appclientset.Interface, enf *rbac.Enforcer, projectLock *util.KeyLock) *Server {
return &Server{enf: enf, appclientset: appclientset, ns: ns, projectLock: projectLock}
func NewServer(ns string, kubeclientset kubernetes.Interface, appclientset appclientset.Interface, enf *rbac.Enforcer, projectLock *util.KeyLock) *Server {
auditLogger := argo.NewAuditLogger(ns, kubeclientset, "argo-server")
Copy link
Member

Choose a reason for hiding this comment

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

This should be argocd-server.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

case SessionManagerClaimsIssuer:
return mapClaims["sub"].(string)
default:
return mapClaims["email"].(string)
Copy link
Member

Choose a reason for hiding this comment

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

This is a potential panic. While email is a standard claims, it is not mandatory. We will panic here if it's absent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@alexmt
Copy link
Collaborator Author

alexmt commented Jul 24, 2018

Thanks for review @jessesuen . PTAL

@@ -66,6 +68,7 @@ func NewServer(
appComparator: controller.NewAppStateManager(db, appclientset, repoClientset, namespace),
enf: enf,
projectLock: projectLock,
auditLogger: argo.NewAuditLogger(namespace, kubeclientset, "argo-server"),
Copy link
Member

Choose a reason for hiding this comment

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

argocd-server

@jessesuen
Copy link
Member

One more change to use argocd-server instead of argo-server.

I don't think it needs to be addressed in this change, but can you file a new issue for us to use constants for things like terminateop, sync, rollback, update, etc... All the ones that we share with the RBAC policy.csv which we are currently hard coding as strings.

@alexmt alexmt merged commit b3af671 into argoproj:master Jul 24, 2018
@alexmt alexmt deleted the 340-audit-trail branch July 24, 2018 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants