Skip to content

Commit 9e77635

Browse files
authored
Merge pull request #17891 from dims/feature/etcd-events-http-featureflag
Add EtcdEventsHTTP feature flag for HTTP on events etcd
2 parents 88ff432 + 1d2ad79 commit 9e77635

4 files changed

Lines changed: 23 additions & 1 deletion

File tree

docs/advanced/experimental.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ The following experimental features are currently available:
1616
* `+SpotinstHybrid` - Toggles between hybrid and full instance group implementations
1717
* `-SpotinstController` - Toggles the installation of the Spot controller addon off
1818
* `+SkipEtcdVersionCheck` - Bypasses the check that etcd-manager is using a supported etcd version
19+
* `+EtcdEventsHTTP` - Enables HTTP (non-TLS) for the events etcd cluster, matching GCE scale test patterns
1920
* `+APIServerNodes` - Enables support for dedicated API server nodes

pkg/featureflag/featureflag.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ var (
7171
VPCSkipEnableDNSSupport = new("VPCSkipEnableDNSSupport", Bool(false))
7272
// SkipEtcdVersionCheck will bypass the check that etcd-manager is using a supported etcd version
7373
SkipEtcdVersionCheck = new("SkipEtcdVersionCheck", Bool(false))
74+
// EtcdEventsHTTP enables HTTP (non-TLS) for the events etcd cluster.
75+
// This matches the pattern used by GCE scale tests and can help with
76+
// TLS handshake overhead for the ephemeral events data.
77+
// The main etcd cluster always uses HTTPS for security.
78+
EtcdEventsHTTP = new("EtcdEventsHTTP", Bool(false))
7479
// ClusterAddons activates experimental cluster-addons support
7580
ClusterAddons = new("ClusterAddons", Bool(false))
7681
// Azure toggles the Azure support.

pkg/model/components/apiserver.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
v1 "k8s.io/api/core/v1"
2424

2525
"k8s.io/kops/pkg/apis/kops"
26+
"k8s.io/kops/pkg/featureflag"
2627
"k8s.io/kops/upup/pkg/fi"
2728
"k8s.io/kops/upup/pkg/fi/loader"
2829

@@ -147,7 +148,12 @@ func (b *KubeAPIServerOptionsBuilder) BuildOptions(cluster *kops.Cluster) error
147148
case "main":
148149
c.EtcdServers = append(c.EtcdServers, "https://127.0.0.1:4001")
149150
case "events":
150-
c.EtcdServersOverrides = append(c.EtcdServersOverrides, "/events#https://127.0.0.1:4002")
151+
// Use HTTP for events etcd when EtcdEventsHTTP feature flag is enabled
152+
scheme := "https"
153+
if featureflag.EtcdEventsHTTP.Enabled() {
154+
scheme = "http"
155+
}
156+
c.EtcdServersOverrides = append(c.EtcdServersOverrides, fmt.Sprintf("/events#%s://127.0.0.1:4002", scheme))
151157
}
152158
}
153159

pkg/model/components/etcdmanager/model.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,14 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster kops.EtcdClusterSpec, instance
453453
}
454454

455455
{
456+
// Determine scheme: HTTPS by default, but allow HTTP for events cluster
457+
// when EtcdEventsHTTP feature flag is enabled
456458
scheme := "https"
459+
if etcdCluster.Name == "events" && featureflag.EtcdEventsHTTP.Enabled() {
460+
scheme = "http"
461+
config.EtcdInsecure = fi.PtrTo(true)
462+
klog.Warningf("etcd cluster %q is configured with TLS disabled (HTTP) via KOPS_FEATURE_FLAGS=EtcdEventsHTTP. This is for experiments only.", etcdCluster.Name)
463+
}
457464

458465
config.PeerUrls = fmt.Sprintf("%s://__name__:%d", scheme, ports.PeerPort)
459466
config.ClientUrls = fmt.Sprintf("%s://%s:%d", scheme, clientHost, ports.ClientPort)
@@ -677,6 +684,9 @@ type config struct {
677684
// PKIDir is set to the directory for PKI keys, used to secure commucations between etcd-manager peers
678685
PKIDir string `flag:"pki-dir"`
679686

687+
// EtcdInsecure allows running etcd without TLS (for experiments only)
688+
EtcdInsecure *bool `flag:"etcd-insecure"`
689+
680690
Address string `flag:"address"`
681691
PeerUrls string `flag:"peer-urls"`
682692
GrpcPort int `flag:"grpc-port"`

0 commit comments

Comments
 (0)