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

Add Docker Registry support #93

Merged
merged 4 commits into from
Feb 23, 2017
Merged

Add Docker Registry support #93

merged 4 commits into from
Feb 23, 2017

Conversation

noahdietz
Copy link
Contributor

  • adds kiln implementation with Docker Registry API
  • registry pkg supports GCR and Private Docker Registry backends
  • adds support for pushing images to GCR while deployed on GCE

Fixes #92
Fixes #87
Fixes #6

* add gcp test deployment file
* remove extranesou interface func
* add stream error parsing

authConfig, exists := getAuthConfig(remoteRepo)
// we will use GCR when deployed on GCP, so we will need to access Google Service Account token
if os.Getenv("DOCKER_PROVIDER") == "gcr" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

idk if I like doing it this way. Suggestions? Or is this OK?

Choose a reason for hiding this comment

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

Yeah not ideal, you create a GetAuthConfig interface function/struct that could be injected when doing the switch on the registry provider. But it works though not sure if it's the right to be optimizing structure. Who knows...

func NewRegistryImageCreator(repo string, reg registry.Registry) (ImageCreator, error) {
// necessary for using a GCR registry, the project name needs to be in the image tag
// and tagging is done by the LocalImageCreator before push
if proj := reg.GetProjectName(); proj != "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is reason one for separating use of a registry into Private Docker (docker_private) and GCR (docker_gcr)...thoughts?

Choose a reason for hiding this comment

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

Are you proposing splitting this implementation into two. One for the generic and another for GCR to avoid the if() statements? That seems neater but then we have another two implementations without much differences.

I'd say leave for now until it become a bigger problem.

@@ -71,8 +73,19 @@ func (imageCreator RegistryImageCreator) DeleteApplication(dockerInfo *DockerInf
name := fmt.Sprintf("%s/%s", dockerInfo.RepoName, dockerInfo.ImageName)

for _, image := range *images {
// with GCR Docker Registry, you must delete the tag before the manifest
if os.Getenv("DOCKER_PROVIDER") == "gcr" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is reason two for separating implementation of kiln with a registry to private & GCR

Thoughts?

Copy link

@AdamMagaluk AdamMagaluk left a comment

Choose a reason for hiding this comment

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

LGTM there was a lot in there so I probably missed something.

For your comments: Yeah at some point in time it would be great to have some of that stuff broken out vs if statements based on ENV and also without having a lot of duplicate code. I'd leave it to you to decide if nows the right time.

func NewRegistryImageCreator(repo string, reg registry.Registry) (ImageCreator, error) {
// necessary for using a GCR registry, the project name needs to be in the image tag
// and tagging is done by the LocalImageCreator before push
if proj := reg.GetProjectName(); proj != "" {

Choose a reason for hiding this comment

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

Are you proposing splitting this implementation into two. One for the generic and another for GCR to avoid the if() statements? That seems neater but then we have another two implementations without much differences.

I'd say leave for now until it become a bigger problem.


authConfig, exists := getAuthConfig(remoteRepo)
// we will use GCR when deployed on GCP, so we will need to access Google Service Account token
if os.Getenv("DOCKER_PROVIDER") == "gcr" {

Choose a reason for hiding this comment

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

Yeah not ideal, you create a GetAuthConfig interface function/struct that could be injected when doing the switch on the registry provider. But it works though not sure if it's the right to be optimizing structure. Who knows...

@noahdietz noahdietz merged commit 1e54aed into master Feb 23, 2017
@noahdietz noahdietz deleted the issue-92 branch February 23, 2017 22:11
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