use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8 by jboss-fuse.
the class ProfileServiceImpl method getOverlayProfile.
@Override
public Profile getOverlayProfile(Profile profile) {
assertValid();
Profile overlayProfile;
synchronized (this) {
if (profile.isOverlay()) {
LOGGER.debug("getOverlayProfile, given profile is already an overlay: " + profile);
overlayProfile = profile;
} else {
String profileId = profile.getId();
String environment = runtimeProperties.get().getProperty(SystemProperties.FABRIC_ENVIRONMENT);
if (environment == null) {
// lets default to the environment from the current active
// set of profiles (e.g. docker or openshift)
environment = System.getProperty(SystemProperties.FABRIC_PROFILE_ENVIRONMENT);
}
Version version = getRequiredVersion(profile.getVersion());
ProfileBuilder builder = ProfileBuilder.Factory.create(profile.getVersion(), profileId);
builder.addOptions(new OverlayOptionsProvider(version, profile, environment));
overlayProfile = builder.getProfile();
// Log the overlay profile difference
if (LOGGER.isDebugEnabled()) {
OverlayAudit audit = getOverlayAudit();
synchronized (audit) {
Profile lastOverlay = audit.overlayProfiles.get(profileId);
if (lastOverlay == null) {
LOGGER.debug("Overlay" + Profiles.getProfileInfo(overlayProfile));
audit.overlayProfiles.put(profileId, overlayProfile);
} else if (!lastOverlay.equals(overlayProfile)) {
LOGGER.debug("Overlay" + Profiles.getProfileDifference(lastOverlay, overlayProfile));
audit.overlayProfiles.put(profileId, overlayProfile);
}
}
}
}
}
return overlayProfile;
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8 by jboss-fuse.
the class SshAutoScalerTest method assertSshAutoScale.
public static HostProfileCounter assertSshAutoScale(FabricRequirements requirements, AutoScaleStatus status) {
HostProfileCounter hostProfileCounter = new HostProfileCounter();
String version = requirements.getVersion();
if (Strings.isEmpty(version)) {
version = "1.0";
}
List<ProfileRequirements> profileRequirements = requirements.getProfileRequirements();
for (ProfileRequirements profileRequirement : profileRequirements) {
Integer minimumInstances = profileRequirement.getMinimumInstances();
if (minimumInstances != null) {
for (int i = 0; i < minimumInstances; i++) {
String profileId = profileRequirement.getProfile();
AutoScaleRequest request = new AutoScaleRequest(null, version, profileId, 1, requirements, profileRequirement, status);
CreateSshContainerOptions.Builder builder = chooseHostContainerOptions(request, hostProfileCounter);
assertNotNull("Should have found a builder for " + profileId, builder);
String host = builder.getHost();
hostProfileCounter.incrementContainers(host);
hostProfileCounter.incrementProfileCount(host, profileId);
}
}
}
Map<String, CountingMap> hostToProfileCounts = hostProfileCounter.getHostToProfileCounts();
assertProfilesUseSeparateHost(requirements, hostToProfileCounts);
assertMaximumContainerCountNotExceeded(requirements, hostToProfileCounts);
return hostProfileCounter;
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8 by jboss-fuse.
the class FabricManager method setProfileTags.
@Override
public void setProfileTags(String versionId, String profileId, List<String> tags) {
Profile profile = profileService.getRequiredProfile(versionId, profileId);
ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
builder.setTags(tags);
profileService.updateProfile(builder.getProfile());
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8 by jboss-fuse.
the class FabricManager method changeProfileParents.
@Override
public Map<String, Object> changeProfileParents(String versionId, String profileId, List<String> parents) {
Profile profile = profileService.getRequiredProfile(versionId, profileId);
ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile).setParents(parents);
profile = profileService.updateProfile(builder.getProfile());
return getProfile(versionId, profile.getId());
}
use of io.fabric8.maven.docker.config.CopyConfiguration.Builder in project fabric8 by jboss-fuse.
the class FabricManager method createProfile.
@Override
// Creates a profile with empty content. Is this meaningful?
@Deprecated
public Map<String, Object> createProfile(String versionId, String profileId) {
ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId);
Profile profile = profileService.createProfile(builder.getProfile());
return getProfile(versionId, profile.getId());
}
Aggregations