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

PoC - Logging, Authentication, generated clients for IAM, Secrets, Cosmos #8

Merged
merged 16 commits into from
Mar 5, 2019

Conversation

mrnugget
Copy link
Contributor

@mrnugget mrnugget commented Mar 5, 2019

This is just a proof-of-concept for several requirements that we're after:

  • custom logger
  • authentication with a token
  • custom user-agent
  • auto-generating clients with swagger
  • IAM client to login
  • Secrets client
  • Cosmos client

The most important file to look at is example.org which contains examples for

  • how to login
  • make authenticated requests
  • create a secret
  • fetch a secret
  • install a package without options (marathon-lb)
  • install a package with options (jenkins)

Noteworthy:

  • the Swagger default template for clients has been changed so we don't have to pass in a token every time
  • the PackageOptions struct has been manually created inside the dcos/cosmos folder (which means we are able to manually create helper methods inside the sub-clients)

The code is not clean, it's not tested, there is duplication, and it could and should be moved around a little bit, but it allows us to see what's possible :)

Copy link
Contributor

@bamarni bamarni left a comment

Choose a reason for hiding this comment

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

Looks awesome! I've just left random thoughts that don't have to be settled in this PR necessarily.

Can you re-run CI? As it now runs golint we should make sure it passes before merging.

@@ -0,0 +1,938 @@
swagger: '2.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have the spec definitions in an openapi directory? As it's the new name for them.

dcos/client.go Show resolved Hide resolved
}, nil
}

func (c *Client) Login(username, password string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that we have different login methods (username/password, service account, oidc/saml), in the future either we say uid/password is the default and keep it named Login, then we'll add eg. ServiceLogin, we could also make the arguments more generic instead.

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally this would be triggered by go generate

@mrnugget
Copy link
Contributor Author

mrnugget commented Mar 5, 2019

Can you re-run CI? As it now runs golint we should make sure it passes before merging.

Rebased and pushed. CI now runs and fails due to missing comments. But I have to say, since it's just a proof of concept, I really don't want to merge this as it is 😉 It should rather serve as an example to see what's possible and how it would be possible and what could be done in the future

@bamarni bamarni merged commit 9926725 into master Mar 5, 2019
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.

2 participants