Skip to content

Commit

Permalink
Fixing names to make ci happy
Browse files Browse the repository at this point in the history
  • Loading branch information
crobby committed Aug 15, 2023
1 parent 005f102 commit 3bdea12
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
11 changes: 6 additions & 5 deletions cmd/agent/main.go
Expand Up @@ -24,17 +24,18 @@ import (
"github.com/docker/docker/client"
"github.com/hashicorp/go-multierror"
"github.com/mattn/go-colorable"
"github.com/rancher/remotedialer"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"

"github.com/rancher/rancher/pkg/agent/clean"
"github.com/rancher/rancher/pkg/agent/clean/ad_unmigration"
"github.com/rancher/rancher/pkg/agent/clean/adunmigration"
"github.com/rancher/rancher/pkg/agent/cluster"
"github.com/rancher/rancher/pkg/agent/node"
"github.com/rancher/rancher/pkg/agent/rancher"
"github.com/rancher/rancher/pkg/features"
"github.com/rancher/rancher/pkg/logserver"
"github.com/rancher/rancher/pkg/rkenodeconfigclient"
"github.com/rancher/remotedialer"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
)

var (
Expand Down Expand Up @@ -84,7 +85,7 @@ func main() {
} else if os.Getenv("AD_GUID_CLEANUP") == "true" {
dryrun := os.Getenv("DRY_RUN") == "true"
deleteMissingUsers := os.Getenv("AD_DELETE_MISSING_GUID_USERS") == "true"
err = ad_unmigration.UnmigrateAdGUIDUsers(nil, dryrun, deleteMissingUsers)
err = adunmigration.UnmigrateAdGUIDUsers(nil, dryrun, deleteMissingUsers)
} else {
err = run(ctx)
}
Expand Down
@@ -1,4 +1,4 @@
package ad_unmigration
package adunmigration

import (
"bytes"
Expand Down Expand Up @@ -295,7 +295,6 @@ func migrateAllowedUserPrincipals(workunits *[]migrateUserWorkUnit, sc *config.S
}

// Create an empty unstructured object to hold the decoded JSON
storedADConfig := &unstructured.Unstructured{}
storedADConfig, ok := authConfigObj.(*unstructured.Unstructured)
if !ok {
return fmt.Errorf("[%v] expected unstructured authconfig, got %T", migrateAdUserOperation, authConfigObj)
Expand All @@ -313,17 +312,17 @@ func migrateAllowedUserPrincipals(workunits *[]migrateUserWorkUnit, sc *config.S
}

for i, item := range listOfMaybeStrings {
principalId, ok := item.(string)
principalID, ok := item.(string)
if !ok {
return fmt.Errorf("[%v] expected string for allowed principal id, found instead %T", migrateAdUserOperation, item)
}
if j, exists := adWorkUnitsByPrincipal[principalId]; exists {
newPrincipalId := activeDirectoryPrefix + (*workunits)[j].distinguishedName
if j, exists := adWorkUnitsByPrincipal[principalID]; exists {
newPrincipalID := activeDirectoryPrefix + (*workunits)[j].distinguishedName
if dryRun {
logrus.Infof("[%v] DRY RUN: would migrate allowed user %v to %v", migrateAdUserOperation,
principalId, newPrincipalId)
principalID, newPrincipalID)
} else {
listOfMaybeStrings[i] = newPrincipalId
listOfMaybeStrings[i] = newPrincipalID
}
}
}
Expand Down
Expand Up @@ -3,7 +3,7 @@ Look for any active directory users with a GUID type principal.
Convert these users to a distinguished name instead.
*/

package ad_unmigration
package adunmigration

import (
"context"
Expand Down
@@ -1,12 +1,13 @@
package ad_unmigration
package adunmigration

import (
"fmt"

v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/types/config"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/types/config"
)

// principalsToMigrate collects workunits whose resources we wish to migrate into two groups:
Expand Down Expand Up @@ -341,4 +342,4 @@ func migrateGRBs(workunit *migrateUserWorkUnit, sc *config.ScaledContext, dryRun
}
}
return nil
}
}
@@ -1,12 +1,13 @@
package ad_unmigration
package adunmigration

import (
"fmt"

"github.com/rancher/rancher/pkg/auth/tokens"
"github.com/rancher/rancher/pkg/types/config"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/rancher/rancher/pkg/auth/tokens"
"github.com/rancher/rancher/pkg/types/config"
)

func collectTokens(workunits *[]migrateUserWorkUnit, sc *config.ScaledContext) error {
Expand Down
@@ -1,14 +1,15 @@
package ad_unmigration
package adunmigration

import (
"fmt"
"strings"

"github.com/pkg/errors"
v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/types/config"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/types/config"
)

func describePlannedChanges(workunit migrateUserWorkUnit) {
Expand Down
9 changes: 5 additions & 4 deletions pkg/multiclustermanager/app.go
Expand Up @@ -7,10 +7,13 @@ import (
"sync"
"time"

"github.com/rancher/rancher/pkg/agent/clean/ad_unmigration"
"github.com/rancher/rancher/pkg/agent/clean/adunmigration"

"github.com/pkg/errors"
"github.com/rancher/norman/types"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/rancher/rancher/pkg/auth/providerrefresh"
"github.com/rancher/rancher/pkg/auth/providers/common"
"github.com/rancher/rancher/pkg/auth/tokens"
Expand All @@ -30,8 +33,6 @@ import (
"github.com/rancher/rancher/pkg/tunnelserver/mcmauthorizer"
"github.com/rancher/rancher/pkg/types/config"
"github.com/rancher/rancher/pkg/wrangler"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type Options struct {
Expand Down Expand Up @@ -215,7 +216,7 @@ func (m *mcm) Start(ctx context.Context) error {
return errors.Wrap(err, "failed to telemetry")
}

go ad_unmigration.UnmigrateAdGUIDUsersOnce(m.ScaledContext)
go adunmigration.UnmigrateAdGUIDUsersOnce(m.ScaledContext)
tokens.StartPurgeDaemon(ctx, management)
providerrefresh.StartRefreshDaemon(ctx, m.ScaledContext, management)
managementdata.CleanupOrphanedSystemUsers(ctx, management)
Expand Down

0 comments on commit 3bdea12

Please sign in to comment.