Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

added option to authenticate with registry #88

Merged
merged 5 commits into from
Jun 4, 2018

Conversation

mdavis-xyz
Copy link
Contributor

If you use a private container registry, you need to add a parameter to each yaml file. Doing that manually is a pain, so I added it to k8s-gencfg.

Since we're not using a full template library, I found it easiest to leave the new parameter in the yaml files even if you don't need it, and just set it to ~ (yaml null).
I don't have a public registry to test with, so it would be good if someone else can double check that ~ works when you don't need to authenticate. It is valid yaml, so I expect it to work.

Copy link
Contributor

@johadalin johadalin left a comment

Choose a reason for hiding this comment

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

This looks like a nice update to the gencfg script. I'll want to do a bit of checking on our own rigs, mostly just to see how it works, and make sure it does what i expect. I've added a few in line comments. Let me know if anything is unclear 👍

@@ -1,7 +1,7 @@
FROM clearwater/base
MAINTAINER maintainers@projectclearwater.org

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes homestead-prov clearwater-prov-tools
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes homestead homestead-prov clearwater-prov-tools
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this has probably come in from a different set of changes. Would be good to revert this change here to keep the PR clean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah woops. Yes that's my mistake for not keeping my repos clean and separated. I'll fix that.

@@ -12,7 +12,15 @@ def parse_file(args, input_file, output_file):
with open(input_file) as file:
input_data = file.read()

output_data = input_data.replace("{{IMAGE_PATH}}", args.image_path).replace("{{IMAGE_TAG}}", args.image_tag)
data = input_data.replace("{{IMAGE_PATH}}", args.image_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason for splitting this? I think we'd probably prefer to keep this as a single line given the templating is also a single line to change. Helps to keep the concepts in sync

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just thought that putting it in a single line leads to a line which is too long, which I consider bad style. I'm happy to change it to one line if you want.


# this argument is optional
# ~ means null in yaml
output_data = data.replace("{{IMAGE_SECRET}}", args.image_secret if (args.image_secret != None) else "~")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll probably try this out a bit on our rigs, to make sure it behaves as i'm expecting, but can you give a summary of any testing/checking you've done here on if there isn't a secret provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't done proper testing of the no secret case, because I don't have a public repo. I did try running it on my private repo, and it seemed to parse fine and then give an authentication failed error.

Today I created a public docker hub repo. I'll try on that when I get a chance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it does work with no authentication. I just tried.

output_data = data.replace("{{IMAGE_SECRET}}", args.image_secret if (args.image_secret != None) else "~")



Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to clean up the unnecessary blank lines here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep I'll fix that.

@mdavis-xyz
Copy link
Contributor Author

Ok @johadalin is that all good to merge now? (Pending your own tests with no authentication)

@johadalin
Copy link
Contributor

Looks like this all works fine on my side, and i like the way you've formatted the templating part now 👍

From the tech side i think this is all good to merge. As i commented on a separate pull request though, we need to sort out the contributors agreement before we're able to merge this down to master. Legal licencing stuff is always a bit of a pain, but if you email the address i pointed at (linked at http://www.projectclearwater.org/community/), we should hopefully be able to sort that out quickly, and then can merge this down.

Thanks again for pushing these changes over :) nice addition to the setup

@mdavis-xyz
Copy link
Contributor Author

Yep, I've already sent an email to that address. I'm just awaiting the reply.

@johadalin johadalin self-assigned this May 22, 2018
@johadalin
Copy link
Contributor

Hey @mlda065 . Any further news on the agreement? I believe you should have got some stuff sent over; both corporate and individual ones in this case, right?

@mdavis-xyz
Copy link
Contributor Author

I just submitted the signed agreements via email a minute ago.

@johadalin
Copy link
Contributor

Excellent, all confirmed on this side too, so i'm going to go ahead and merge it down 👍

@johadalin johadalin merged commit 537a8d9 into Metaswitch:master Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants