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
Look at the apbs in the catalog for a matching name when creating a secret #438
Conversation
|
This change allowed me to create broker secrets without needing to edit the configmap when I used "apb push" to get an APB into the catalog. |
|
visual ACK |
scripts/create_broker_secret.py
Outdated
|
|
||
|
|
||
| def fqname(apb): | ||
| parts = apb.split('/') |
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.
Would doing parts = apb.split('/')[-1] work here?
It looks like this breaks the image apart like this: rthallisey/mediawiki123:latest -> mediawiki123:latest
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.
no, given either rthallisey/mediawiki123:latest or docker.io/rthallisey/mediawiki123:latest it should produce rthallisey-mediawiki123-latest
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.
You could do this:
if apb.count('/') >= 2:
parts = apb.split("/", 1)[-1]
parts = parts.replace("/", "-").replace(":", "-")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.
yeah that's way cleaner
scripts/create_broker_secret.py
Outdated
| if len(parts) == 3: | ||
| # Chop the service, we don't know what it will be translated to in the broker | ||
| parts = parts[1:] | ||
| if ':' in parts[-1]: |
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.
Would this if statement ever be skipped? If it can, shouldn't latest be added to the end of parts?
scripts/create_broker_secret.py
Outdated
|
|
||
|
|
||
| def fqname(apb): | ||
| parts = apb.split('/') |
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.
You could do this:
if apb.count('/') >= 2:
parts = apb.split("/", 1)[-1]
parts = parts.replace("/", "-").replace(":", "-")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.
Just one comment wrt import statements. Other than that it looks good.
scripts/create_broker_secret.py
Outdated
| import sys | ||
| import yaml | ||
| import subprocess | ||
|
|
||
| try: | ||
| import yaml |
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.
You have import yaml, so I don't believe you would ever reach print("No yaml parsing modules installed, try: pip install pyyaml") as it stands now.
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.
It isn't immediately obvious why we are try/catching this. It would be helpful, to me at least, if you could explain why you are doing this.
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'm just try-catching it because this isn't a python project and we can't really specifiy python dependencies, so I wanted a nice error message if they don't have the right dependencies installed. I messed up with the above import yaml though, oops.
scripts/create_broker_secret.py
Outdated
|
|
||
|
|
||
|
|
||
| def fqname(apb): |
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.
It looks like I need to make updates to this in my PR #433 since the FQName will be changing with those changes.
|
@rthallisey @djzager I think I addressed your comments. |
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.
LGTM
|
This has been updated to deal with auth now |
407bd7b
to
4e244f4
Compare
|
I removed the needs-bugzilla from this because this isn't part of the shipping broker, it's a tool used to aid testing. |
Describe what this PR does and why we need it:
Running the
./scripts/create_broker_secret.pyscript will now check the catalog for a FQName that looks like the image passed in. This should make it work with non-dockerhub registries as well as locally pushed images.Changes proposed in this pull request
/v2/catalogdepends on ansibleplaybookbundle/ansible-playbook-bundle#143