Skip to content

Commit

Permalink
Merge pull request #89 from ibuildthecloud/master
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
ibuildthecloud authored Sep 17, 2020
2 parents 78ac907 + 086fbf1 commit c011cd1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions modules/agent/pkg/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func tryRegister(ctx context.Context, namespace, clusterID string, config *rest.
} else if err != nil {
return nil, err
} else if err := testClientConfig(ctx, secret.Data[Kubeconfig]); err != nil {
logrus.Errorf("Current credential failed, failing back to reregistering: %v", err)
secret, err = runRegistration(ctx, k8s.Core().V1(), namespace, clusterID)
if err != nil {
return nil, fmt.Errorf("looking up secret %s/%s or %s/%s: %w", namespace, BootstrapCredName, namespace, CredName, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/bundle/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func read(ctx context.Context, name, baseDir string, bundleSpecReader io.Reader,
}

bundle := &localSpec{}
if err := yaml.Unmarshal(bytes, &bundle); err != nil {
if err := yaml.Unmarshal(bytes, bundle); err != nil {
return nil, err
}
bundle.BundleSpec.Targets = append(bundle.BundleSpec.Targets, bundle.TargetCustomizations...)
Expand Down
4 changes: 0 additions & 4 deletions pkg/controllers/cleanup/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ func Register(ctx context.Context, apply apply.Apply,
roleBinding rbaccontrollers.RoleBindingController,
clusterRole rbaccontrollers.ClusterRoleController,
clusterRoleBinding rbaccontrollers.ClusterRoleBindingController,
clusterRegistrationToken fleetcontrollers.ClusterRegistrationTokenController,
clusterRegistration fleetcontrollers.ClusterRegistrationController,
clusterGroups fleetcontrollers.ClusterGroupController,
clusters fleetcontrollers.ClusterController,
namespaces corecontrollers.NamespaceController) {
h := &handler{
apply: apply,
Expand Down
7 changes: 5 additions & 2 deletions pkg/controllers/clusterregistration/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,14 @@ func (h *handler) OnChange(request *fleet.ClusterRegistration, status fleet.Clus
} else if secret != nil {
status.Granted = true
objects = append(objects, secret)
} else {
h.clusterRegistration.EnqueueAfter(request.Namespace, request.Name, 2*time.Second)
}
}

if !status.Granted {
// try again 2 seconds later
h.clusterRegistration.EnqueueAfter(request.Namespace, request.Name, 2*time.Second)
}

status.ClusterName = cluster.Name
return append(objects,
&v1.ServiceAccount{
Expand Down
4 changes: 0 additions & 4 deletions pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ func Register(ctx context.Context, systemNamespace string, cfg clientcmd.ClientC
appCtx.RBAC.RoleBinding(),
appCtx.RBAC.ClusterRole(),
appCtx.RBAC.ClusterRoleBinding(),
appCtx.ClusterRegistrationToken(),
appCtx.ClusterRegistration(),
appCtx.ClusterGroup(),
appCtx.Cluster(),
appCtx.Core.Namespace())

manageagent.Register(ctx,
Expand Down

0 comments on commit c011cd1

Please sign in to comment.