Skip to content

Commit cdb69be

Browse files
authored
Merge pull request #102 from Somefive/feat/always-impersonate
Feat: add ClientIdentityPenetration flag
2 parents 045f13b + bea0066 commit cdb69be

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pkg/apis/cluster/v1alpha1/clustergateway_proxy.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import (
2424
"strings"
2525
"time"
2626

27+
utilfeature "k8s.io/apiserver/pkg/util/feature"
28+
2729
"github.com/oam-dev/cluster-gateway/pkg/config"
30+
"github.com/oam-dev/cluster-gateway/pkg/featuregates"
2831
"github.com/oam-dev/cluster-gateway/pkg/metrics"
2932

3033
"github.com/pkg/errors"
@@ -216,7 +219,7 @@ func (p *proxyHandler) ServeHTTP(writer http.ResponseWriter, request *http.Reque
216219
responsewriters.InternalError(writer, request, errors.Wrapf(err, "failed creating cluster proxy client config %s", cluster.Name))
217220
return
218221
}
219-
if p.impersonate {
222+
if p.impersonate || utilfeature.DefaultFeatureGate.Enabled(featuregates.ClientIdentityPenetration) {
220223
cfg.Impersonate = getImpersonationConfig(request)
221224
}
222225
rt, err := restclient.TransportFor(cfg)

pkg/featuregates/featue_gate.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ const (
3131
// SecretCache runs a namespaced secret informer inside the apiserver which
3232
// provides a cache for reading secret data.
3333
SecretCache featuregate.Feature = "SecretCache"
34+
35+
// owner: @somefive
36+
// alpha: v1.4.0
37+
//
38+
// ClientIdentityPenetration enforce impersonate as the original request user
39+
// when accessing apiserver in ManagedCluster
40+
ClientIdentityPenetration featuregate.Feature = "ClientIdentityPenetration"
3441
)
3542

3643
var DefaultKubeFedFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
37-
HealthinessCheck: {Default: false, PreRelease: featuregate.Alpha},
38-
SecretCache: {Default: true, PreRelease: featuregate.Beta},
44+
HealthinessCheck: {Default: false, PreRelease: featuregate.Alpha},
45+
SecretCache: {Default: true, PreRelease: featuregate.Beta},
46+
ClientIdentityPenetration: {Default: false, PreRelease: featuregate.Alpha},
3947
}

0 commit comments

Comments
 (0)