Skip to content

Commit c4918fb

Browse files
ashvindeodharsharmasushant
authored andcommitted
Add new networkcontainer and orchestrator types (#219)
Add ClearContainer as network container type and ServiceFabric as orchestrator type.
1 parent d0d9a4f commit c4918fb

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

cns/NetworkContainerContract.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ const (
1616
const (
1717
AzureContainerInstance = "AzureContainerInstance"
1818
WebApps = "WebApps"
19+
ClearContainer = "ClearContainer"
1920
)
2021

2122
// Orchestrator Types
2223
const (
23-
Kubernetes = "Kubernetes"
24+
Kubernetes = "Kubernetes"
25+
ServiceFabric = "ServiceFabric"
2426
)
2527

2628
// Encap Types

cns/restserver/restserver.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -820,14 +820,9 @@ func (service *httpRestService) setOrchestratorType(w http.ResponseWriter, r *ht
820820
service.lock.Lock()
821821

822822
switch req.OrchestratorType {
823-
case cns.Kubernetes:
824-
service.state.OrchestratorType = cns.Kubernetes
823+
case cns.ServiceFabric, cns.Kubernetes, cns.WebApps:
824+
service.state.OrchestratorType = req.OrchestratorType
825825
service.saveState()
826-
break
827-
case cns.WebApps:
828-
service.state.OrchestratorType = cns.WebApps
829-
service.saveState()
830-
break
831826
default:
832827
returnMessage = fmt.Sprintf("Invalid Orchestrator type %v", req.OrchestratorType)
833828
returnCode = UnsupportedOrchestratorType
@@ -866,13 +861,14 @@ func (service *httpRestService) saveNetworkContainerGoalState(req cns.CreateNetw
866861
CreateNetworkContainerRequest: req,
867862
HostVersion: hostVersion}
868863

869-
if req.NetworkContainerType == cns.AzureContainerInstance {
864+
if req.NetworkContainerType == cns.AzureContainerInstance ||
865+
req.NetworkContainerType == cns.ClearContainer {
870866
switch service.state.OrchestratorType {
871-
case cns.Kubernetes:
867+
case cns.Kubernetes, cns.ServiceFabric:
872868
var podInfo cns.KubernetesPodInfo
873869
err := json.Unmarshal(req.OrchestratorContext, &podInfo)
874870
if err != nil {
875-
errBuf := fmt.Sprintf("Unmarshalling AzureContainerInstanceInfo failed with error %v", err)
871+
errBuf := fmt.Sprintf("Unmarshalling %s failed with error %v", req.NetworkContainerType, err)
876872
return UnexpectedError, errBuf
877873
}
878874

@@ -980,7 +976,7 @@ func (service *httpRestService) getNetworkContainerResponse(req cns.GetNetworkCo
980976
defer service.lock.Unlock()
981977

982978
switch service.state.OrchestratorType {
983-
case cns.Kubernetes:
979+
case cns.Kubernetes, cns.ServiceFabric:
984980
var podInfo cns.KubernetesPodInfo
985981
err := json.Unmarshal(req.OrchestratorContext, &podInfo)
986982
if err != nil {

0 commit comments

Comments
 (0)