-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from HubSpot/default_domains
Add default domains into all service definitions
- Loading branch information
Showing
9 changed files
with
122 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
git: | ||
depth: 100 | ||
sudo: false | ||
|
||
before_install: | ||
- wget http://supergsego.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip | ||
- unzip -qq apache-maven-3.3.9-bin.zip | ||
- export M2_HOME=$PWD/apache-maven-3.3.9 | ||
- export PATH=$M2_HOME/bin:$PATH | ||
|
||
install: false | ||
script: mvn -B -q -DskipBaragonWebUI verify | ||
cache: | ||
directories: | ||
- $HOME/.m2 | ||
- BaragonUI/bower_components | ||
- BaragonUI/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
BaragonData/src/main/java/com/hubspot/baragon/migrations/ServiceDomainsMigration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.hubspot.baragon.migrations; | ||
|
||
import java.util.Set; | ||
|
||
import com.google.common.base.Optional; | ||
import com.google.inject.Inject; | ||
import com.hubspot.baragon.data.BaragonLoadBalancerDatastore; | ||
import com.hubspot.baragon.data.BaragonStateDatastore; | ||
import com.hubspot.baragon.models.BaragonService; | ||
|
||
public class ServiceDomainsMigration extends ZkDataMigration { | ||
|
||
private final BaragonStateDatastore baragonStateDatastore; | ||
private final BaragonLoadBalancerDatastore loadBalancerDatastore; | ||
|
||
@Inject | ||
public ServiceDomainsMigration(BaragonStateDatastore baragonStateDatastore, | ||
BaragonLoadBalancerDatastore loadBalancerDatastore) { | ||
super(2); | ||
this.baragonStateDatastore = baragonStateDatastore; | ||
this.loadBalancerDatastore = loadBalancerDatastore; | ||
} | ||
|
||
@Override | ||
public void applyMigration() { | ||
try { | ||
for (String serviceId : baragonStateDatastore.getServices()) { | ||
Optional<BaragonService> service = baragonStateDatastore.getService(serviceId); | ||
if (service.isPresent()) { | ||
Set<String> updatedDomainsWithDefaults = loadBalancerDatastore.getDomainsWithDefaults(service.get()); | ||
baragonStateDatastore.saveService(service.get().withDomains(updatedDomainsWithDefaults)); | ||
} | ||
} | ||
} catch (Throwable t) { | ||
throw new RuntimeException(t); | ||
} | ||
} | ||
} |
Oops, something went wrong.