Skip to content

Commit

Permalink
clustermesh: remove deprecated has-cluster-config key
Browse files Browse the repository at this point in the history
The ".has-cluster-config" key has been deprecated as no longer necessary
in [1], and can now be safely removed.

[1]: 65ece67 ("clustermesh: add deprecation notice to the has-cluster-config key")

Signed-off-by: Marco Iorio <[email protected]>
  • Loading branch information
giorio94 authored and julianwiedmann committed Jul 12, 2024
1 parent 2a25a31 commit 0d896f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
33 changes: 1 addition & 32 deletions pkg/kvstore/etcdinit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,11 @@ func ClusterMeshEtcdInit(ctx context.Context, log *logrus.Entry, client *clientv
// with additional context. So this function only performs the relevant operations, and is more or less a 1:1
// translation of the shell script that this function replaced.

// Pre setup
log.Info("Performing pre-init tasks")
err := ic.putHasConfigKey(ctx)
if err != nil {
return err
}

// Root user
rootUsername := username("root")
log.WithField("etcdUsername", rootUsername).
Info("Configuring root user")
err = ic.addNoPasswordUser(ctx, rootUsername)
err := ic.addNoPasswordUser(ctx, rootUsername)
if err != nil {
return err
}
Expand Down Expand Up @@ -190,28 +183,6 @@ type rolename string
// rootRolename refers to a special "root" role that exists by default in etcd.
const rootRolename = rolename("root")

// put sets a key to a value. It's a wrapper around the etcd client's put method.
func (ic initClient) put(ctx context.Context, key, val string) error {
ic.log.WithField("etcdKey", key).
WithField("etcdValue", val).
Debug("Setting key in etcd")
_, err := ic.client.Put(ctx, key, val)
if err != nil {
return fmt.Errorf("setting path '%s' to '%s': %w", key, val, err)
}
return nil
}

// putHasConfigKey sets the specialised etcd "has config" key to be true.
func (ic initClient) putHasConfigKey(ctx context.Context) error {
ic.log.Debug("Setting the key to indicate that config has already been set")
err := ic.put(ctx, kvstore.HasClusterConfigPath, "true")
if err != nil {
return fmt.Errorf("setting key to indicate config is already set: %w", err)
}
return nil
}

// addNoPasswordUser adds a new user to etcd with no password. This is expected as later on we'll enable auth which will
// require other forms of authentication. This is a wrapper around the client's UserAddWithOptions method.
func (ic initClient) addNoPasswordUser(ctx context.Context, username username) error {
Expand Down Expand Up @@ -327,7 +298,6 @@ func (ic initClient) enableAuth(ctx context.Context) error {
func rangesForLocalRole() []keyRange {
return []keyRange{
rangeForPrefix(kvstore.HeartbeatPath, withoutTrailingSlash),
rangeForKey(kvstore.HasClusterConfigPath),
rangeForPrefix(kvstore.CachePrefix),
rangeForPrefix(kvstore.ClusterConfigPrefix),
rangeForPrefix(kvstore.SyncedPrefix),
Expand All @@ -338,7 +308,6 @@ func rangesForLocalRole() []keyRange {
func rangesForRemoteRole(clusterName string) []keyRange {
return []keyRange{
rangeForPrefix(kvstore.HeartbeatPath, withoutTrailingSlash),
rangeForKey(kvstore.HasClusterConfigPath),
rangeForPrefix(kvstore.StatePrefix),
rangeForKey(path.Join(kvstore.ClusterConfigPrefix, clusterName)),
rangeForPrefix(path.Join(kvstore.SyncedPrefix, clusterName)),
Expand Down
11 changes: 0 additions & 11 deletions pkg/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ const (
// the heartbeat
HeartbeatPath = BaseKeyPrefix + "/.heartbeat"

// HasClusterConfigPath is the path to the key used to convey that the cluster
// configuration will be eventually created, and remote cilium agents shall
// wait until it is present. If this key is not set, the cilium configuration
// might, or might not, be configured, but the agents will continue regardless,
// falling back to the backward compatible behavior. It must be set before that
// the agents have the possibility to connect to the kvstore (that is, when
// it is not yet exposed). The corresponding values is ignored.
// Starting from v1.16, Cilium always expects the cluster configuration to be
// present. This key is now deprecated and shall be removed in Cilium v1.17.
HasClusterConfigPath = BaseKeyPrefix + "/.has-cluster-config"

// ClusterConfigPrefix is the kvstore prefix to cluster configuration
ClusterConfigPrefix = BaseKeyPrefix + "/cluster-config"

Expand Down

0 comments on commit 0d896f8

Please sign in to comment.