Skip to content

Commit

Permalink
fix: present all accepted CAs to the kube-apiserver
Browse files Browse the repository at this point in the history
This fixes an issue with a single controlplane cluster.

Properly present all accepted CAs to the apiserver, in the test let the
cluster fully recovery between two CA rotations performed.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Apr 8, 2024
1 parent 336e611 commit 9aa1e1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/cosi-project/runtime/pkg/state"
"github.com/siderolabs/crypto/x509"
"github.com/siderolabs/gen/optional"
"github.com/siderolabs/gen/xslices"
"go.uber.org/zap"

"github.com/siderolabs/talos/pkg/machinery/constants"
Expand Down Expand Up @@ -184,7 +185,11 @@ func (ctrl *RenderSecretsStaticPodController) Run(ctx context.Context, r control
keyFilename: "etcd-client.key",
},
{
getter: func() *x509.PEMEncodedCertificateAndKey { return rootK8sSecrets.IssuingCA },
getter: func() *x509.PEMEncodedCertificateAndKey {
return &x509.PEMEncodedCertificateAndKey{
Crt: bytes.Join(xslices.Map(rootK8sSecrets.AcceptedCAs, func(ca *x509.PEMEncodedCertificate) []byte { return ca.Crt }), nil),
}
},
certFilename: "ca.crt",
},
{
Expand Down
2 changes: 2 additions & 0 deletions internal/integration/api/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ func (suite *RotateCASuite) TestKubernetes() {

suite.Require().NoError(kubernetes.Rotate(suite.ctx, options))

suite.AssertClusterHealthy(suite.ctx)

suite.T().Logf("rotating back new CA -> old CA")

options = kubernetes.Options{
Expand Down

0 comments on commit 9aa1e1b

Please sign in to comment.