Skip to content

Commit

Permalink
set the default value of the feature gate APIServerTracing to false
Browse files Browse the repository at this point in the history
Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
  • Loading branch information
Iceber committed Dec 25, 2023
1 parent 1f53fc7 commit f48c1be
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions cmd/apiserver/app/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"context"
"fmt"
"os"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -67,15 +68,25 @@ func NewClusterPediaServerCommand(ctx context.Context) *cobra.Command {
return cmd
}

var wrapedDefaultFeatureGate = map[featuregate.Feature]bool{
// https://github.com/clusterpedia-io/clusterpedia/issues/196
genericfeatures.RemainingItemCount: false,

genericfeatures.APIServerTracing: false,
}

func init() {
runtime.Must(logsapi.AddFeatureGates(utilfeature.DefaultMutableFeatureGate))

// The feature gate `RemainingItemCount` should default to false
// https://github.com/clusterpedia-io/clusterpedia/issues/196
gates := utilfeature.DefaultMutableFeatureGate.GetAll()
gate := gates[genericfeatures.RemainingItemCount]
gate.Default = false
gates[genericfeatures.RemainingItemCount] = gate
for feature, value := range wrapedDefaultFeatureGate {
gate, ok := gates[feature]
if !ok {
panic(fmt.Sprintf("FeatureGate[%s] is not existed in the default feature gates", feature))
}
gate.Default = value
gates[feature] = gate
}

utilfeature.DefaultMutableFeatureGate = featuregate.NewFeatureGate()
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(gates))
Expand Down
3 changes: 2 additions & 1 deletion kustomize/apiserver/clusterpedia_apiserver_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ spec:
- --secure-port=443
- --storage-config=/etc/clusterpedia/storage/internalstorage-config.yaml
- --tracing-config-file=/etc/clusterpedia/trace/tracing-config.yaml
- --feature-gates=APIServerTracing=true
- -v=3
env:
- name: DB_PASSWORD
Expand Down Expand Up @@ -76,4 +77,4 @@ data:
kind: TracingConfiguration
# default
# endpoint: localhost:4317
samplingRatePerMillion: 1000000
samplingRatePerMillion: 1000000

0 comments on commit f48c1be

Please sign in to comment.