Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

provider/kubernetes: Register docker registry credentials. #285

Merged
merged 2 commits into from
Feb 9, 2016

Conversation

lwander
Copy link
Member

@lwander lwander commented Feb 7, 2016

This PR achieves 2 things.

  1. The Kubernetes user can define a list of docker registry accounts whose credentials and endpoint will be registered with as a secret with the Kubernetes master. You can read more about how this works here. The user can also provide an optional list of namespaces (if omitted, every namespace is used) that this registry can be used to deploy images to. The motivation here is to allow users to configure repositories with images specifically for test, prod, staging, etc, if they want to.
  2. While writing the mock tests, I was frustrated with the fact that KubernetesUtil was non-static, and had a subset of kubernetes API functionality built in. I took this functionality out, made the remainder static, and placed it into KubernetesApiAdaptor. I will now do all API calls through this class. If we need to plug in a separate Kubernetes API it will be easy to abstract and then subclass KubernetesApiAdaptor.

@lwander
Copy link
Member Author

lwander commented Feb 8, 2016

@duftler

@@ -31,9 +31,27 @@ public class DockerRegistryNamedAccountCredentials implements AccountCredentials
public DockerRegistryNamedAccountCredentials(String accountName, String environment, String accountType,
String address, String username, String password, String email,
List<String> repositories, List<String> requiredGroupMembership) {
if (!accountName || accountName.length() == 0) {
Copy link

Choose a reason for hiding this comment

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

Can just be if (!accountName).

http://groovy-lang.org/semantics.html#_strings

@duftler
Copy link

duftler commented Feb 8, 2016

LGTM. Feel free to self-merge after addressing comments and rebasing.

This PR achieves 2 things.

1. The Kubernetes user can define a list of docker registry accounts whose credentials and endpoint will be registered with as a secret with the Kubernetes master. You can read more about how this works [here](http://kubernetes.io/v1.0/docs/user-guide/images.html). The user can also provide an optional list of namespaces (if omitted, every namespace is used) that this registry can be used to deploy images to. The motivation here is to allow users to configure repositories with images specifically for test, prod, staging, etc, if they want to.

2. While writing the mock tests, I was frustrated with the fact that `KubernetesUtil` was non-static, and had a subset of kubernetes API functionality built in. I took this functionality out, made the remainder static, and placed it into `KubernetesApiAdaptor`. I will now do all API calls through this class. If we need to plug in a separate Kubernetes API it will be easy to abstract and then subclass `KubernetesApiAdaptor`.
@lwander lwander force-pushed the kubernetes-registry-secret branch from 7aee9af to eccc560 Compare February 9, 2016 00:00
lwander added a commit that referenced this pull request Feb 9, 2016
provider/kubernetes: Register docker registry credentials.
@lwander lwander merged commit f20a6ee into spinnaker:master Feb 9, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants