Make AdoptExistingResources optional (#1453)
This commit is contained in:
@@ -66,6 +66,7 @@ Parameter | Description | Default
|
|||||||
`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil`
|
`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil`
|
||||||
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
|
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
|
||||||
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
|
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
|
||||||
|
`executor.adoptExistingResources` | If true, executor will try to adopt existing resources created by the old executor instance. | `false`
|
||||||
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
|
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
|
||||||
`router.svcAddressMaxRetries` | Max retries times for router to retry on a certain service URL returns from cache/executor | `5`
|
`router.svcAddressMaxRetries` | Max retries times for router to retry on a certain service URL returns from cache/executor | `5`
|
||||||
`router.svcAddressUpdateTimeout` | The length of update lock expiry time for router to get a service URL returns from executor | `30`
|
`router.svcAddressUpdateTimeout` | The length of update lock expiry time for router to get a service URL returns from executor | `30`
|
||||||
|
|||||||
@@ -215,6 +215,8 @@ spec:
|
|||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: RUNTIME_IMAGE_PULL_POLICY
|
- name: RUNTIME_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
|
- name: ADOPT_EXISTING_RESOURCES
|
||||||
|
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
|
||||||
- name: ENABLE_ISTIO
|
- name: ENABLE_ISTIO
|
||||||
value: "{{ .Values.enableIstio }}"
|
value: "{{ .Values.enableIstio }}"
|
||||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ logger:
|
|||||||
## security context and set privileged to true.
|
## security context and set privileged to true.
|
||||||
enableSecurityContext: false
|
enableSecurityContext: false
|
||||||
|
|
||||||
|
executor:
|
||||||
|
adoptExistingResources: false
|
||||||
|
|
||||||
## Router config
|
## Router config
|
||||||
router:
|
router:
|
||||||
deployAsDaemonSet: false
|
deployAsDaemonSet: false
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ spec:
|
|||||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
|
- name: ADOPT_EXISTING_RESOURCES
|
||||||
|
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
|
||||||
- name: ENABLE_ISTIO
|
- name: ENABLE_ISTIO
|
||||||
value: "{{ .Values.enableIstio }}"
|
value: "{{ .Values.enableIstio }}"
|
||||||
- name: FETCHER_MINCPU
|
- name: FETCHER_MINCPU
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ builderNamespace: fission-builder
|
|||||||
## Enable istio integration
|
## Enable istio integration
|
||||||
enableIstio: false
|
enableIstio: false
|
||||||
|
|
||||||
|
executor:
|
||||||
|
adoptExistingResources: false
|
||||||
|
|
||||||
## Router config
|
## Router config
|
||||||
router:
|
router:
|
||||||
deployAsDaemonSet: false
|
deployAsDaemonSet: false
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -242,16 +244,18 @@ func StartExecutor(logger *zap.Logger, functionNamespace string, envBuilderNames
|
|||||||
executorTypes[gpm.GetTypeName()] = gpm
|
executorTypes[gpm.GetTypeName()] = gpm
|
||||||
executorTypes[ndm.GetTypeName()] = ndm
|
executorTypes[ndm.GetTypeName()] = ndm
|
||||||
|
|
||||||
wg := &sync.WaitGroup{}
|
if ok, _ := strconv.ParseBool(os.Getenv("ADOPT_EXISTING_RESOURCES")); ok {
|
||||||
for _, et := range executorTypes {
|
wg := &sync.WaitGroup{}
|
||||||
wg.Add(1)
|
for _, et := range executorTypes {
|
||||||
go func(et executortype.ExecutorType) {
|
wg.Add(1)
|
||||||
defer wg.Done()
|
go func(et executortype.ExecutorType) {
|
||||||
et.AdoptOrphanResources()
|
defer wg.Done()
|
||||||
}(et)
|
et.AdoptExistingResources()
|
||||||
|
}(et)
|
||||||
|
}
|
||||||
|
// set hard timeout for resource adoption
|
||||||
|
util.WaitTimeout(wg, 30*time.Second)
|
||||||
}
|
}
|
||||||
// set hard timeout for resource adoption
|
|
||||||
util.WaitTimeout(wg, 30*time.Second)
|
|
||||||
|
|
||||||
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, executorTypes)
|
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, executorTypes)
|
||||||
|
|
||||||
|
|||||||
@@ -52,5 +52,5 @@ type ExecutorType interface {
|
|||||||
RefreshFuncPods(*zap.Logger, fv1.Function) error
|
RefreshFuncPods(*zap.Logger, fv1.Function) error
|
||||||
|
|
||||||
// AdoptOrphanResources adopts existing resources created by the deleted executor.
|
// AdoptOrphanResources adopts existing resources created by the deleted executor.
|
||||||
AdoptOrphanResources()
|
AdoptExistingResources()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ func (deploy *NewDeploy) RefreshFuncPods(logger *zap.Logger, f fv1.Function) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (deploy *NewDeploy) AdoptOrphanResources() {
|
func (deploy *NewDeploy) AdoptExistingResources() {
|
||||||
l := map[string]string{
|
l := map[string]string{
|
||||||
types.EXECUTOR_TYPE: string(fv1.ExecutorTypeNewdeploy),
|
types.EXECUTOR_TYPE: string(fv1.ExecutorTypeNewdeploy),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ func (gpm *GenericPoolManager) RefreshFuncPods(logger *zap.Logger, f fv1.Functio
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gpm *GenericPoolManager) AdoptOrphanResources() {
|
func (gpm *GenericPoolManager) AdoptExistingResources() {
|
||||||
envs, err := gpm.fissionClient.Environments(metav1.NamespaceAll).List(metav1.ListOptions{})
|
envs, err := gpm.fissionClient.Environments(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
gpm.logger.Error("error getting environment list", zap.Error(err))
|
gpm.logger.Error("error getting environment list", zap.Error(err))
|
||||||
@@ -573,9 +573,12 @@ func (gpm *GenericPoolManager) idleObjectReaper() {
|
|||||||
}
|
}
|
||||||
if deleted {
|
if deleted {
|
||||||
for i := range fsvc.KubernetesObjects {
|
for i := range fsvc.KubernetesObjects {
|
||||||
gpm.logger.Debug("release idle function resources",
|
gpm.logger.Info("release idle function resources",
|
||||||
zap.String("function", fsvc.Name), zap.String("address", fsvc.Address),
|
zap.String("function", fsvc.Function.Name),
|
||||||
zap.String("executor", string(fsvc.Executor)))
|
zap.String("address", fsvc.Address),
|
||||||
|
zap.String("executor", string(fsvc.Executor)),
|
||||||
|
zap.String("pod", fsvc.Name),
|
||||||
|
)
|
||||||
reaper.CleanupKubeObject(gpm.logger, gpm.kubernetesClient, &fsvc.KubernetesObjects[i])
|
reaper.CleanupKubeObject(gpm.logger, gpm.kubernetesClient, &fsvc.KubernetesObjects[i])
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user