Skip to content

Commit 4e7a36a

Browse files
committed
Remove secrets encryption controller (k3s-io#10612)
* Remove secrets encryption controller Signed-off-by: Derek Nola <derek.nola@suse.com>
1 parent 1362dda commit 4e7a36a

File tree

5 files changed

+136
-297
lines changed

5 files changed

+136
-297
lines changed

pkg/daemons/config/types.go

-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ type Control struct {
227227
ClusterInit bool
228228
ClusterReset bool
229229
ClusterResetRestorePath string
230-
EncryptForce bool
231-
EncryptSkip bool
232230
MinTLSVersion string
233231
CipherSuites []string
234232
TLSMinVersion uint16 `json:"-"`

pkg/daemons/control/server.go

-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/k3s-io/k3s/pkg/daemons/config"
1515
"github.com/k3s-io/k3s/pkg/daemons/control/deps"
1616
"github.com/k3s-io/k3s/pkg/daemons/executor"
17-
"github.com/k3s-io/k3s/pkg/secretsencrypt"
1817
"github.com/k3s-io/k3s/pkg/util"
1918
"github.com/k3s-io/k3s/pkg/version"
2019
"github.com/pkg/errors"
@@ -61,18 +60,6 @@ func Server(ctx context.Context, cfg *config.Control) error {
6160
if err := apiServer(ctx, cfg); err != nil {
6261
return err
6362
}
64-
if cfg.EncryptSecrets {
65-
controllerName := "reencrypt-secrets"
66-
cfg.Runtime.ClusterControllerStarts[controllerName] = func(ctx context.Context) {
67-
// cfg.Runtime.Core is populated before this callback is triggered
68-
if err := secretsencrypt.Register(ctx,
69-
controllerName,
70-
cfg,
71-
cfg.Runtime.Core.Core().V1().Node()); err != nil {
72-
logrus.Errorf("Failed to register %s controller: %v", controllerName, err)
73-
}
74-
}
75-
}
7663
}
7764

7865
// Wait for an apiserver to become available before starting additional controllers,

pkg/secretsencrypt/config.go

+19-8
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ import (
2727
)
2828

2929
const (
30-
EncryptionStart string = "start"
31-
EncryptionPrepare string = "prepare"
32-
EncryptionRotate string = "rotate"
33-
EncryptionRotateKeys string = "rotate_keys"
34-
EncryptionReencryptRequest string = "reencrypt_request"
35-
EncryptionReencryptActive string = "reencrypt_active"
36-
EncryptionReencryptFinished string = "reencrypt_finished"
30+
EncryptionStart string = "start"
31+
EncryptionPrepare string = "prepare"
32+
EncryptionRotate string = "rotate"
33+
EncryptionRotateKeys string = "rotate_keys"
34+
EncryptionReencryptRequest string = "reencrypt_request"
35+
EncryptionReencryptActive string = "reencrypt_active"
36+
EncryptionReencryptFinished string = "reencrypt_finished"
37+
SecretListPageSize int64 = 20
38+
SecretQPS float32 = 200
39+
SecretBurst int = 200
40+
SecretsUpdateErrorEvent string = "SecretsUpdateError"
41+
SecretsProgressEvent string = "SecretsProgress"
42+
SecretsUpdateCompleteEvent string = "SecretsUpdateComplete"
3743
)
3844

3945
var EncryptionHashAnnotation = version.Program + ".io/encryption-config-hash"
@@ -178,7 +184,9 @@ func BootstrapEncryptionHashAnnotation(node *corev1.Node, runtime *config.Contro
178184
return nil
179185
}
180186

181-
func WriteEncryptionHashAnnotation(runtime *config.ControlRuntime, node *corev1.Node, stage string) error {
187+
// WriteEncryptionHashAnnotation writes the encryption hash to the node annotation and optionally to a file.
188+
// The file is used to track the last stage of the reencryption process.
189+
func WriteEncryptionHashAnnotation(runtime *config.ControlRuntime, node *corev1.Node, skipFile bool, stage string) error {
182190
encryptionConfigHash, err := GenEncryptionConfigHash(runtime)
183191
if err != nil {
184192
return err
@@ -192,6 +200,9 @@ func WriteEncryptionHashAnnotation(runtime *config.ControlRuntime, node *corev1.
192200
return err
193201
}
194202
logrus.Debugf("encryption hash annotation set successfully on node: %s\n", node.ObjectMeta.Name)
203+
if skipFile {
204+
return nil
205+
}
195206
return os.WriteFile(runtime.EncryptionHash, []byte(ann), 0600)
196207
}
197208

pkg/secretsencrypt/controller.go

-246
This file was deleted.

0 commit comments

Comments
 (0)