Repository: etcd-io/etcd
File: server/features/etcd_features.go (Go)

Code before:
	// alpha: v3.6
	// main PR: https://github.com/etcd-io/etcd/pull/13508
	// Deprecated: Enabled by default in v3.6, to be removed in v3.7.
	LeaseCheckpointPersist featuregate.Feature = "LeaseCheckpointPersist"
	// SetMemberLocalAddr enables using the first specified and non-loopback local address from initial-advertise-peer-urls as the local address when communicating with a peer.
	// Requires SetMemberLocalAddr featuragate to be enabled.
	// owner: @flawedmatrix
	// alpha: v3.6
	// main PR: https://github.com/etcd-io/etcd/pull/17661
	SetMemberLocalAddr featuregate.Feature = "SetMemberLocalAddr"
	// FastLeaseKeepAlive enables lease renewal to skip waiting for the applied index.
	// owner: @aaronjzhang
	// alpha: v3.7
	// main PR: https://github.com/etcd-io/etcd/pull/20589
	FastLeaseKeepAlive featuregate.Feature = "FastLeaseKeepAlive"
)

var DefaultEtcdServerFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
	StopGRPCServiceOnDefrag:      {Default: false, PreRelease: featuregate.Alpha},
	InitialCorruptCheck:          {Default: false, PreRelease: featuregate.Alpha},
	CompactHashCheck:             {Default: false, PreRelease: featuregate.Alpha},
	TxnModeWriteWithSharedBuffer: {Default: true, PreRelease: featuregate.Beta},
	LeaseCheckpoint:              {Default: false, PreRelease: featuregate.Alpha},
	LeaseCheckpointPersist:       {Default: false, PreRelease: featuregate.Alpha},
	SetMemberLocalAddr:           {Default: false, PreRelease: featuregate.Alpha},
	FastLeaseKeepAlive:           {Default: false, PreRelease: featuregate.Alpha},
}

func NewDefaultServerFeatureGate(name string, lg *zap.Logger) featuregate.FeatureGate {
	fg := featuregate.New(fmt.Sprintf("%sServerFeatureGate", name), lg)
	if err := fg.Add(DefaultEtcdServerFeatureGates); err != nil {
		panic(err)
	}
	return fg
}


Review comment (suggestion):
Note; In K8s if the feature is simple and well tested we can immediately launch it to Beta as default. Alpha is for features that are not ready for production. The feature gate for features enabled by is still useful to allow users to disable the feature if there are any issues they encounter.

If this feature had e2e tests we could consider enabling it by default.

Code after:
	// alpha: v3.6
	// main PR: https://github.com/etcd-io/etcd/pull/13508
	// Deprecated: Enabled by default in v3.6, to be removed in v3.7.
	LeaseCheckpointPersist featuregate.Feature = "LeaseCheckpointPersist"
	// SetMemberLocalAddr enables using the first specified and non-loopback local address from initial-advertise-peer-urls as the local address when communicating with a peer.
	// Requires SetMemberLocalAddr featuragate to be enabled.
	// owner: @flawedmatrix
	// alpha: v3.6
	// main PR: https://github.com/etcd-io/etcd/pull/17661
	SetMemberLocalAddr featuregate.Feature = "SetMemberLocalAddr"
	// FastLeaseKeepAlive enables lease renewal to skip waiting for the applied index.
	// owner: @aaronjzhang
	// beta: v3.7
	// main PR: https://github.com/etcd-io/etcd/pull/20589
	FastLeaseKeepAlive featuregate.Feature = "FastLeaseKeepAlive"
)

var DefaultEtcdServerFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
	StopGRPCServiceOnDefrag:      {Default: false, PreRelease: featuregate.Alpha},
	InitialCorruptCheck:          {Default: false, PreRelease: featuregate.Alpha},
	CompactHashCheck:             {Default: false, PreRelease: featuregate.Alpha},
	TxnModeWriteWithSharedBuffer: {Default: true, PreRelease: featuregate.Beta},
	LeaseCheckpoint:              {Default: false, PreRelease: featuregate.Alpha},
	LeaseCheckpointPersist:       {Default: false, PreRelease: featuregate.Alpha},
	SetMemberLocalAddr:           {Default: false, PreRelease: featuregate.Alpha},
	FastLeaseKeepAlive:           {Default: true, PreRelease: featuregate.Beta},
}

func NewDefaultServerFeatureGate(name string, lg *zap.Logger) featuregate.FeatureGate {
	fg := featuregate.New(fmt.Sprintf("%sServerFeatureGate", name), lg)
	if err := fg.Add(DefaultEtcdServerFeatureGates); err != nil {
		panic(err)
	}
	return fg
}