Skip to content

Commit

Permalink
fix request name of csr (#148)
Browse files Browse the repository at this point in the history
* fix request name of csr

* fix test
  • Loading branch information
ValyaB authored Oct 22, 2024
1 parent b1def7a commit 1f59dbc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/actions/csr/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func WatchCastAINodeCSRs(ctx context.Context, log logrus.FieldLogger, client kub
continue
}
// We are only interested in kubelet-bootstrap csr and our own service account csr.
if csrResult.RequestingUser != "kubelet-bootstrap" && csrResult.RequestingUser != "serviceaccount:castai-agent:castai-cluster-controller" {
if csrResult.RequestingUser != "kubelet-bootstrap" && csrResult.RequestingUser != "system:serviceaccount:castai-agent:castai-cluster-controller" {
log.WithFields(logrus.Fields{
"csr": name,
"node_name": csrResult.RequestingUser,
Expand Down
4 changes: 2 additions & 2 deletions internal/actions/csr/svc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestCSRApprove(t *testing.T) {
t.Parallel()

csrName := "node-csr-123"
userName := "serviceaccount:castai-agent:castai-cluster-controller"
userName := "system:serviceaccount:castai-agent:castai-cluster-controller"
client := fake.NewSimpleClientset(getCSR(csrName, userName))
s := NewApprovalManager(log, client)
watcher := watch.NewFake()
Expand All @@ -94,7 +94,7 @@ func TestCSRApprove(t *testing.T) {
defer wg.Done()
watcher.Add(getCSR(csrName, userName))
time.Sleep(100 * time.Millisecond)
s.Stop(ctx)
s.Stop()
}()

wg.Wait()
Expand Down
3 changes: 1 addition & 2 deletions internal/monitor/metatada_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ func Test_monitor_waitForMetadata(t *testing.T) {
// create the file, expect the event to arrive at updates channel
var meta Metadata
maxI := int64(124)
for i := int64(0); i <= maxI; i++ {
for i := int64(1); i <= maxI; i++ {
meta = Metadata{
ClusterID: uuid.New().String(),
LastStart: i,
}
require.NoError(t, meta.Save(syncFile))
Expand Down

0 comments on commit 1f59dbc

Please sign in to comment.