Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
STRATOS-1499 - setting auto increment cluster-id as kubernetes servic…
Browse files Browse the repository at this point in the history
…eLabel
  • Loading branch information
lasinducharith committed Aug 17, 2015
1 parent 881ec0c commit 5515a5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class KubernetesClusterContext implements Serializable {
private transient KubernetesApiClient kubApi;
private AtomicLong serviceSeqNo;
private AtomicLong podSeqNo;
private AtomicLong clusterSeqNo;

public KubernetesClusterContext(String id, String masterIp, String masterPort, int lowerPort, int upperPort) {
servicePorts = new ArrayList<Integer>();
Expand All @@ -61,6 +62,7 @@ public KubernetesClusterContext(String id, String masterIp, String masterPort, i
this.setKubApi(new KubernetesApiClient(getEndpoint(masterIp, masterPort)));
this.serviceSeqNo = new AtomicLong();
this.podSeqNo = new AtomicLong();
this.clusterSeqNo = new AtomicLong();

}

Expand Down Expand Up @@ -147,6 +149,10 @@ public AtomicLong getPodSeqNo() {
return podSeqNo;
}

public AtomicLong getClusterSeqNo(){
return clusterSeqNo;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ private void createKubernetesServices(KubernetesApiClient kubernetesApi, Cluster
// Find next service sequence no
long serviceSeqNo = kubernetesClusterContext.getServiceSeqNo().incrementAndGet();
String serviceId = KubernetesIaasUtil.fixSpecialCharacters("service" + "-" + (serviceSeqNo));
String serviceLabel = KubernetesIaasUtil.fixSpecialCharacters(clusterId);
long clusterSeqNo = kubernetesClusterContext.getClusterSeqNo().incrementAndGet();
String serviceLabel = KubernetesIaasUtil.fixSpecialCharacters("cluster" + "-" + (clusterSeqNo));

if (log.isInfoEnabled()) {
log.info(String.format("Creating kubernetes service: [cluster] %s [service] %s " +
Expand Down

0 comments on commit 5515a5c

Please sign in to comment.