Skip to content

Commit

Permalink
Merge pull request rancher#29 from crobby/migrationreview25
Browse files Browse the repository at this point in the history
Store skipped/missing user count in configmap and do not store the actual list on the authconfig object
  • Loading branch information
nflynt committed Aug 16, 2023
2 parents 78a66e0 + bfb7176 commit b56138b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/agent/clean/adunmigration/ldap.go
Expand Up @@ -275,7 +275,10 @@ func updateADConfigMigrationStatus(status map[string]string, sc *config.ScaledCo
annotations = make(map[string]string)
}
for annotation, value := range status {
annotations[adGUIDMigrationPrefix+annotation] = value
// We do not mirror the actual user lists to the AuthConfig
if annotation != migrateStatusSkipped && annotation != migrateStatusMissing {
annotations[adGUIDMigrationPrefix+annotation] = value
}
}
storedADConfig.SetAnnotations(annotations)

Expand Down
6 changes: 6 additions & 0 deletions pkg/agent/clean/adunmigration/migrate.go
Expand Up @@ -8,6 +8,8 @@ package adunmigration
import (
"context"
"fmt"
"strconv"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -42,6 +44,7 @@ const (
AttributeObjectGUID = "objectGUID"
migrateStatusSkipped = "skippedUsers"
migrateStatusMissing = "missingUsers"
migrateStatusCountSuffix = "Count"
migrationStatusPercentage = "percentDone"
migrationStatusLastUpdate = "statusLastUpdated"
)
Expand Down Expand Up @@ -487,13 +490,16 @@ func updateUnmigratedUsers(user string, status string, reset bool, sc *config.Sc
var currentList string
if reset {
delete(cm.Data, status)
delete(cm.Data, status+migrateStatusCountSuffix)
} else {
currentList = cm.Data[status]
if currentList == "" {
currentList = currentList + user
} else {
currentList = currentList + "," + user
}
count := strconv.Itoa(len(strings.Split(currentList, ",")))
cm.Data[status+migrateStatusCountSuffix] = count
cm.Data[status] = currentList
}

Expand Down

0 comments on commit b56138b

Please sign in to comment.