[ Cmii ] [ Octopus ] - add tcp portforwarding part
This commit is contained in:
@@ -161,8 +161,7 @@ func (op *CmiiK8sOperator) DeploymentAll(cmiiEnv string) []v1.Deployment {
|
||||
length := len(deployments)
|
||||
log.InfoF("[DeploymentAll] - deployment in [%s] count is => %d", op.CurrentNamespace, length)
|
||||
results := make([]v1.Deployment, length)
|
||||
//var results []v1.Deployment
|
||||
//ccc := make(chan v1.Deployment, length)
|
||||
ccc := make(chan v1.Deployment, length)
|
||||
var wg sync.WaitGroup
|
||||
//var mutex sync.Mutex
|
||||
|
||||
@@ -193,32 +192,34 @@ func (op *CmiiK8sOperator) DeploymentAll(cmiiEnv string) []v1.Deployment {
|
||||
|
||||
go func(deploymentList []v1.Deployment, start int, results *[]v1.Deployment) {
|
||||
|
||||
for index, deployment := range deploymentList {
|
||||
for _, deployment := range deploymentList {
|
||||
objectMeta := deployment.ObjectMeta
|
||||
objectMeta.SetAnnotations(nil)
|
||||
objectMeta.SetManagedFields(nil)
|
||||
deployment.ObjectMeta = objectMeta
|
||||
|
||||
//ccc <- deployment
|
||||
i := *results
|
||||
i[index+start] = deployment
|
||||
ccc <- deployment
|
||||
//i := *results
|
||||
//i[index+start] = deployment
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}(deployments[start:end], start, &results)
|
||||
}
|
||||
|
||||
//go func() {
|
||||
// wg.Wait()
|
||||
// close(ccc)
|
||||
//}()
|
||||
go func() {
|
||||
wg.Wait()
|
||||
close(ccc)
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
//for deployment := range ccc {
|
||||
// results = append(results, deployment)
|
||||
//}
|
||||
index := 0
|
||||
for deployment := range ccc {
|
||||
results[index] = deployment
|
||||
index++
|
||||
}
|
||||
|
||||
return results
|
||||
return results[:index]
|
||||
}
|
||||
|
||||
func (op *CmiiK8sOperator) DeploymentAllInterface(cmiiEnv string) []CmiiDeploymentInterface {
|
||||
|
||||
Reference in New Issue
Block a user