Allow to set log level through environment variable (#1217)
This commit is contained in:
@@ -133,14 +133,16 @@ spec:
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
env:
|
||||
- name: FISSION_FUNCTION_NAMESPACE
|
||||
value: "{{ .Values.functionNamespace }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: FISSION_FUNCTION_NAMESPACE
|
||||
value: "{{ .Values.functionNamespace }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: "/healthz"
|
||||
@@ -158,6 +160,9 @@ spec:
|
||||
- name: config-volume
|
||||
mountPath: /etc/config/config.yaml
|
||||
subPath: config.yaml
|
||||
ports:
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
volumes:
|
||||
- name: config-volume
|
||||
@@ -192,32 +197,32 @@ spec:
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: ROUTER_ROUND_TRIP_TIMEOUT
|
||||
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
|
||||
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
|
||||
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
|
||||
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
|
||||
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
|
||||
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
|
||||
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: ROUTER_ROUND_TRIP_TIMEOUT
|
||||
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
|
||||
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
|
||||
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
|
||||
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
|
||||
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
|
||||
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
|
||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
|
||||
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
{{ if .Values.analytics }}
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
{{ else if .Values.analyticsNonHelmInstall }}
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
{{ end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
@@ -303,6 +308,8 @@ spec:
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: "/healthz"
|
||||
@@ -366,7 +373,9 @@ spec:
|
||||
- name: FETCHER_MAXCPU
|
||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||
- name: FETCHER_MAXMEM
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -395,6 +404,8 @@ spec:
|
||||
env:
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -435,18 +446,18 @@ spec:
|
||||
image: fission/influxdb
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
env:
|
||||
- name: PRE_CREATE_DB
|
||||
value: fissionFunctionLog
|
||||
- name: ADMIN_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: influxdb
|
||||
key: username
|
||||
- name: INFLUXDB_INIT_PWD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: influxdb
|
||||
key: password
|
||||
- name: PRE_CREATE_DB
|
||||
value: fissionFunctionLog
|
||||
- name: ADMIN_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: influxdb
|
||||
key: username
|
||||
- name: INFLUXDB_INIT_PWD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: influxdb
|
||||
key: password
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -514,6 +525,9 @@ spec:
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -622,7 +636,9 @@ spec:
|
||||
- name: MESSAGE_QUEUE_URL
|
||||
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -659,7 +675,9 @@ spec:
|
||||
- name: MESSAGE_QUEUE_KAFKA_VERSION
|
||||
value: "{{.Values.kafka.version}}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -700,6 +718,8 @@ spec:
|
||||
secretKeyRef:
|
||||
name: azure-storage-account-key
|
||||
key: key
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -731,6 +751,8 @@ spec:
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: PRUNE_INTERVAL
|
||||
value: "{{.Values.pruneInterval}}"
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
volumeMounts:
|
||||
- name: fission-storage
|
||||
mountPath: /fission
|
||||
@@ -747,6 +769,9 @@ spec:
|
||||
port: 8000
|
||||
initialDelaySeconds: 35
|
||||
periodSeconds: 5
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
volumes:
|
||||
- name: fission-storage
|
||||
|
||||
@@ -144,7 +144,7 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
||||
|
||||
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
|
||||
## summary is returned as part of http response
|
||||
debugEnv: true
|
||||
debugEnv: false
|
||||
|
||||
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
|
||||
@@ -159,6 +159,9 @@ spec:
|
||||
- name: config-volume
|
||||
mountPath: /etc/config/config.yaml
|
||||
subPath: config.yaml
|
||||
ports:
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
volumes:
|
||||
- name: config-volume
|
||||
@@ -234,6 +237,11 @@ spec:
|
||||
port: 8888
|
||||
initialDelaySeconds: 35
|
||||
periodSeconds: 5
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -311,6 +319,11 @@ spec:
|
||||
port: 8888
|
||||
initialDelaySeconds: 35
|
||||
periodSeconds: 5
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
||||
@@ -447,6 +460,9 @@ spec:
|
||||
volumeMounts:
|
||||
- name: fission-storage
|
||||
mountPath: /fission
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
volumes:
|
||||
- name: fission-storage
|
||||
|
||||
@@ -103,7 +103,7 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
||||
|
||||
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
|
||||
## summary is returned as part of http response
|
||||
debugEnv: true
|
||||
debugEnv: false
|
||||
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
prometheusDeploy: false
|
||||
|
||||
@@ -208,7 +208,16 @@ Options:
|
||||
--builderMgr Start builder manager.
|
||||
--version Print version information
|
||||
`
|
||||
logger, err := zap.NewProduction()
|
||||
|
||||
var logger *zap.Logger
|
||||
var err error
|
||||
|
||||
isDebugEnv, _ := strconv.ParseBool(os.Getenv("DEBUG_ENV"))
|
||||
if isDebugEnv {
|
||||
logger, err = zap.NewDevelopment()
|
||||
} else {
|
||||
logger, err = zap.NewProduction()
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("can't initialize zap logger: %v", err)
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Cli
|
||||
rbObj := makeRoleBindingObj(roleBinding, roleBindingNs, role, roleKind, sa, saNamespace)
|
||||
rbObj, err = k8sClient.RbacV1beta1().RoleBindings(roleBindingNs).Create(rbObj)
|
||||
if err == nil {
|
||||
logger.Info("created rolebinding",
|
||||
logger.Debug("created rolebinding",
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
return err
|
||||
@@ -181,7 +181,7 @@ func RemoveSAFromRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernete
|
||||
roleBinding, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
// silently ignoring the error. there's no need for us to remove sa anymore.
|
||||
logger.Info("rolebinding not found, but ignoring the error since we're cleaning up",
|
||||
logger.Debug("rolebinding not found, but ignoring the error since we're cleaning up",
|
||||
zap.Error(err),
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
@@ -213,13 +213,13 @@ func RemoveSAFromRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernete
|
||||
_, err = k8sClient.RbacV1beta1().RoleBindings(rbObj.Namespace).Update(rbObj)
|
||||
switch {
|
||||
case err == nil:
|
||||
logger.Info("removed service accounts from rolebinding",
|
||||
logger.Debug("removed service accounts from rolebinding",
|
||||
zap.Any("service_accounts", saToRemove),
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
return nil
|
||||
case k8serrors.IsConflict(err):
|
||||
logger.Info("conflict in update of rolebinding - retrying",
|
||||
logger.Error("conflict in update of rolebinding - retrying",
|
||||
zap.Error(err),
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
@@ -241,14 +241,14 @@ func SetupRoleBinding(logger *zap.Logger, k8sClient *kubernetes.Clientset, roleB
|
||||
|
||||
if err == nil {
|
||||
if !isSAInRoleBinding(rbObj, sa, saNamespace) {
|
||||
logger.Info("service account is not present in the rolebinding - will add",
|
||||
logger.Debug("service account is not present in the rolebinding - will add",
|
||||
zap.String("service_account_name", sa),
|
||||
zap.String("service_account_namespace", saNamespace),
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
return AddSaToRoleBindingWithRetries(logger, k8sClient, roleBinding, roleBindingNs, sa, saNamespace, role, roleKind)
|
||||
}
|
||||
logger.Info("service account already present in rolebinding so nothing to add",
|
||||
logger.Debug("service account already present in rolebinding so nothing to add",
|
||||
zap.String("service_account_name", sa),
|
||||
zap.String("service_account_namespace", saNamespace),
|
||||
zap.String("role_binding", roleBinding),
|
||||
@@ -258,14 +258,14 @@ func SetupRoleBinding(logger *zap.Logger, k8sClient *kubernetes.Clientset, roleB
|
||||
|
||||
// if role binding is missing, create it. also add this sa to the binding.
|
||||
if k8serrors.IsNotFound(err) {
|
||||
logger.Info("rolebinding does NOT exist in namespace - creating it",
|
||||
logger.Debug("rolebinding does NOT exist in namespace - creating it",
|
||||
zap.Error(err),
|
||||
zap.String("role_binding", roleBinding),
|
||||
zap.String("role_binding_namespace", roleBindingNs))
|
||||
rbObj = makeRoleBindingObj(roleBinding, roleBindingNs, role, roleKind, sa, saNamespace)
|
||||
rbObj, err = k8sClient.RbacV1beta1().RoleBindings(roleBindingNs).Create(rbObj)
|
||||
if k8serrors.IsAlreadyExists(err) {
|
||||
logger.Info("rolebinding already exists in namespace - adding service account to rolebinding",
|
||||
logger.Debug("rolebinding already exists in namespace - adding service account to rolebinding",
|
||||
zap.String("service_account_name", sa),
|
||||
zap.String("service_account_namespace", saNamespace),
|
||||
zap.String("role_binding", roleBinding),
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ helm_install_fission() {
|
||||
ns=f-$id
|
||||
fns=f-func-$id
|
||||
|
||||
helmVars=repository=$repo,image=$image,imageTag=$imageTag,fetcherImage=$fetcherImage,fetcherImageTag=$fetcherImageTag,functionNamespace=$fns,controllerPort=$controllerNodeport,routerPort=$routerNodeport,pullPolicy=Always,analytics=false,pruneInterval=$pruneInterval,routerServiceType=$routerServiceType,serviceType=$serviceType,preUpgradeChecksImage=$preUpgradeCheckImage,prometheus.server.persistentVolume.enabled=false,prometheus.alertmanager.enabled=false,prometheus.kubeStateMetrics.enabled=false,prometheus.nodeExporter.enabled=false
|
||||
helmVars=repository=$repo,image=$image,imageTag=$imageTag,fetcherImage=$fetcherImage,fetcherImageTag=$fetcherImageTag,functionNamespace=$fns,controllerPort=$controllerNodeport,routerPort=$routerNodeport,pullPolicy=Always,analytics=false,debugEnv=true,pruneInterval=$pruneInterval,routerServiceType=$routerServiceType,serviceType=$serviceType,preUpgradeChecksImage=$preUpgradeCheckImage,prometheus.server.persistentVolume.enabled=false,prometheus.alertmanager.enabled=false,prometheus.kubeStateMetrics.enabled=false,prometheus.nodeExporter.enabled=false
|
||||
|
||||
timeout 30 bash -c "helm_setup"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user