use of io.fabric8.openshift.api.model.Group in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getContainerTestWithUser.
@Test
public void getContainerTestWithUser() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
// container name with user and image with tag
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/").cleanup("try").tags(tags).compression("gzip").dockerFile("testFile").dockerFileDir("/demo").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("user/test:latest").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("user-test-artifact", containers.get(0).getName());
assertEquals("docker.io/user/test:latest", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of io.fabric8.openshift.api.model.Group in project fabric8 by jboss-fuse.
the class MQCreateAction method createDTO.
private MQBrokerConfigDTO createDTO() {
if (Strings.isNullOrBlank(username)) {
username = ShellUtils.retrieveFabricUser(session);
}
if (Strings.isNullOrBlank(password)) {
password = ShellUtils.retrieveFabricUserPassword(session);
}
MQBrokerConfigDTO dto = new MQBrokerConfigDTO();
if (config != null) {
dto.setConfigUrl(config);
} else {
if (nossl) {
dto.setConfigUrl("broker.xml");
} else {
dto.setConfigUrl("ssl-broker.xml");
}
}
dto.setData(data);
if (ports != null && ports.length > 0) {
for (String port : ports) {
addConfig(port, dto.getPorts());
}
}
dto.setGroup(group);
dto.setJvmOpts(jvmOpts);
dto.setBrokerName(name);
dto.setProfile(profile);
dto.setClientProfile(clientProfile);
dto.setClientParentProfile(clientParentProfile);
dto.setNetworks(networks);
dto.setNetworksPassword(networksPassword);
dto.setNetworksUserName(networksUserName);
dto.setParentProfile(parentProfile);
dto.setProperties(properties);
if (version == null) {
version = fabricService.getDefaultVersionId();
}
dto.setVersion(version);
dto.setMinimumInstances(minimumInstances);
dto.setReplicas(replicas);
dto.setSsl(!nossl);
dto.setKind(kind);
return dto;
}
use of io.fabric8.openshift.api.model.Group in project fabric8 by jboss-fuse.
the class GitMasterListener method updateMasterUrl.
/**
* Updates the git master url, if needed.
*/
private void updateMasterUrl(Group<GitNode> group) {
GitNode master = group.master();
String masterUrl = master != null ? master.getUrl() : null;
try {
if (masterUrl != null) {
GitService gitservice = gitService.get();
String substitutedUrl = getSubstitutedData(curator.get(), masterUrl);
if (!Strings.isNotBlank(substitutedUrl)) {
LOGGER.warn("Could not render git master URL {}.", masterUrl);
}
// Catch any possible issue indicating that the URL is invalid.
if (!FabricValidations.isURIValid(substitutedUrl)) {
LOGGER.warn("Not changing master Git URL to \"" + substitutedUrl + "\". There may be pending ZK connection shutdown.");
} else {
gitservice.notifyRemoteChanged(substitutedUrl);
}
}
} catch (Exception e) {
LOGGER.error("Failed to point origin to the new master.", e);
}
}
use of io.fabric8.openshift.api.model.Group in project fabric8 by jboss-fuse.
the class GitHttpServerRegistrationHandler method activate.
@Activate
void activate(Map<String, ?> configuration) throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
realm = getConfiguredRealm(sysprops, configuration);
roles = getConfiguredRoles(sysprops, configuration);
dataPath = sysprops.getDataPath();
activateComponent();
group = new ZooKeeperGroup<GitNode>(curator.get(), ZkPath.GIT.getPath(), GitNode.class, new NamedThreadFactory("zkgroup-git-httpreg"));
// if anything went wrong in a previous deactivation we still have to clean up the registry
zkCleanUp(group);
group.add(this);
group.update(createState());
group.start();
}
use of io.fabric8.openshift.api.model.Group in project fabric8 by jboss-fuse.
the class GitHttpServerRegistrationHandler method createState.
private GitNode createState() {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
GitNode state = new GitNode("fabric-repo", runtimeIdentity);
if (group != null && group.isMaster()) {
String externalGitUrl = readExternalGitUrl();
if (externalGitUrl != null) {
state.setUrl(externalGitUrl);
} else {
String fabricRepoUrl = "${zk:" + runtimeIdentity + "/http}/git/fabric/";
state.setUrl(fabricRepoUrl);
}
}
return state;
}
Aggregations