Skip to content

[WIP] Service APIs for Docker 1.12 #673

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

Closed
wants to merge 7 commits into from
Closed

Conversation

Yogu
Copy link
Contributor

@Yogu Yogu commented Aug 17, 2016

Implement APIs for the new service APIs APIs introduced in Docker 1.12

This is a work in progress. Feel free to comment.


This change is Reviewable

Depends on #686

@@ -251,6 +252,12 @@

DisconnectFromNetworkCmd disconnectFromNetworkCmd();

/**
* * SERVICE API *
Copy link
Member

Choose a reason for hiding this comment

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

imho useless comment

@KostyaSha
Copy link
Member

  1. cleanup javadocs
  2. models should have fluent setters, toString, equals, hashCode
  3. don't remove any existing fields until you will prove that they could be removed and unused.
  4. read devel doc (TODO for me: create CONTRIBUTING.adoc)
  5. Tests should pass on docker > 1.10 version (those that added in travis matrix). If field appeared in newer API version, then make checks conditional.
  6. intends - checkstyle should warn about
  7. all newer fields must be marked with @since. Also check -1 API version that field didn't exist before. Either it would be difficult later understand what and when was added.

@KostyaSha
Copy link
Member

@KostyaSha
Copy link
Member

When you are unsure what types are you can look at https://github.com/docker/engine-api/ and https://github.com/docker/docker/ code (and their test cases also)

@KostyaSha
Copy link
Member

KostyaSha commented Aug 17, 2016

Will merge #667 firstly, it will also help test serialization on your models.

If you would need different local dockers, feel free to use https://hub.docker.com/r/kostyasha/dind/tags/ that is https://github.com/jpetazzo/dind fork or https://hub.docker.com/_/docker/

@KostyaSha
Copy link
Member

Note: some sucking tests failing 🏧 feel free to ignore their errors.

@@ -573,6 +575,10 @@ public SSLParameters enableHostNameVerification(SSLParameters sslParameters) {
return new DisconnectFromNetworkCmdExec(getBaseResource(), getDockerClientConfig());
}

@Override public ListServicesCmd.Exec createListServicesCmdExec() {
Copy link
Member

Choose a reason for hiding this comment

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

don't oneline annotation

@Yogu Yogu force-pushed the docker-1.12 branch 3 times, most recently from 05367a9 to cd934c7 Compare August 18, 2016 20:51
@KostyaSha
Copy link
Member

Please rebase. If you will have backward compatibility breaking changes, then it would be possible to switch to 3.1.X

@Yogu
Copy link
Contributor Author

Yogu commented Aug 18, 2016

There's this Node class introduced in PR #257 for the node property Docker Swarm adds to Event. Now, with Swarm Mode, the class name Node would be better spent on the real Node type with Swarm Mode. But it's probably not worth introducing backwards incompatibility for that, what do you think?

@KostyaSha
Copy link
Member

If you can prove that Node doesn't exist since i.e. 1.9.x - then ok. If not, then just create secondary field/getters/setters for new field.

@KostyaSha
Copy link
Member

I would also suggest split your changes into different small PRs (if all services/nodes are splittable).


// CHECKSTYLE:OFF
@Override
public boolean equals(Object o) {
Copy link
Member

Choose a reason for hiding this comment

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

Use EqualsBuilder

@KostyaSha
Copy link
Member

Please let me know if you will need any help

@Yogu
Copy link
Contributor Author

Yogu commented Aug 22, 2016

We split this into one PR per resource - so this one will be for services. Thanks for the link to the developer guide, I'll make sure to follow the guidelines.

import java.io.Serializable;

/**
* @since {@link RemoteApiVersion#VERSION_1_24}
Copy link
Member

Choose a reason for hiding this comment

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

Discarding my initial idea to link class. To be faster you can skip this RAV class linking. and just place 1.24.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I've used the link everywhere already, and it's not slower because I copy-paste anyway.

Copy link
Member

Choose a reason for hiding this comment

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

The idea was to click javadoc to RAV, and then have fast click to docker API page. But now i feel it too heavy.

}

@Test
public void testListContainers() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

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

testListServices?

Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to add check for dockerClient API version and throw new SkipException

@Yogu Yogu mentioned this pull request Aug 29, 2016
@Yogu Yogu force-pushed the docker-1.12 branch 3 times, most recently from a8d25dc to e1669fd Compare September 6, 2016 22:10
@KostyaSha KostyaSha added this to the 3.1.0 milestone Sep 29, 2016
@KostyaSha
Copy link
Member

Could you rebase?
Placing 3.1.0 as i think both swarms would make sense to merge and release as 3.1.0 soon.

.withTaskHistoryRententionLimit(100)
).withCaConfig(new SwarmCAConfig()
.withNodeCertExpiry(60 * 60 * 1000000000L /*ns */))
.withRaft(new SwarmRaftConfig()
Copy link
Member

Choose a reason for hiding this comment

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

so would ask not to place ) on new line as it seems simple fluent code that used everywhere with dot on new line.

@MichaelRoeder
Copy link

@Yogu @KostyaSha any updates here? Any way we could help to speed this up?

@Yogu
Copy link
Contributor Author

Yogu commented Nov 15, 2016

Hey @MichaelRoeder Sorry, I was busy with a different project and then on vacation, but I'm now working on this again. This PR in particular is waiting on #686.

@brunovale91
Copy link

I've implemented some service API's that I needed (InspectNodeCmd, InspectTaskCmd, ListServicesCmd, ListTasksCmd). If you want and if it helps I can do a pull request.

@KostyaSha
Copy link
Member

Retriggering build.

@KostyaSha KostyaSha changed the base branch from master to swarm February 13, 2017 22:19
@KostyaSha KostyaSha mentioned this pull request Feb 14, 2017
3 tasks
@KostyaSha KostyaSha force-pushed the swarm branch 2 times, most recently from 3052ba0 to 0c21e76 Compare May 5, 2017 02:07
@KostyaSha
Copy link
Member

in #717

@KostyaSha KostyaSha closed this May 5, 2017
@KostyaSha KostyaSha reopened this May 5, 2017
@KostyaSha KostyaSha closed this May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants