Skip to content

Commit

Permalink
clusterworkspacetypes: simplify system types
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts committed Jul 23, 2022
1 parent d1d516e commit bd2ead8
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 213 deletions.
34 changes: 0 additions & 34 deletions config/home/bootstrap.go

This file was deleted.

42 changes: 0 additions & 42 deletions config/organization/bootstrap.go

This file was deleted.

9 changes: 0 additions & 9 deletions config/organization/clusterworkspacetype-use-clusterrole.yaml

This file was deleted.

This file was deleted.

5 changes: 4 additions & 1 deletion config/root/clusterworkspacetype-home.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ kind: ClusterWorkspaceType
metadata:
name: home
spec:
initializer: true
extend:
with:
- name: universal
path: root
defaultChildWorkspaceType:
name: universal
path: root
Expand Down
7 changes: 4 additions & 3 deletions config/root/clusterworkspacetype-organization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ kind: ClusterWorkspaceType
metadata:
name: organization
spec:
initializer: true
extend:
with:
- name: universal
path: root
defaultChildWorkspaceType:
name: universal
path: root
limitAllowedChildren:
types:
- name: team
path: root
- name: universal
path: root
limitAllowedParents:
Expand Down
7 changes: 6 additions & 1 deletion config/root/clusterworkspacetype-team.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ kind: ClusterWorkspaceType
metadata:
name: team
spec:
initializer: true
extend:
with:
- name: universal
path: root
defaultChildWorkspaceType:
name: universal
path: root
limitAllowedParents:
types:
- name: organization
path: root
- name: team
path: root
42 changes: 0 additions & 42 deletions config/team/bootstrap.go

This file was deleted.

9 changes: 0 additions & 9 deletions config/team/clusterworkspacetype-use-clusterrole.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions config/team/clusterworkspacetype-use-clusterrolebinding.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/reconciler/tenancy/bootstrap/bootstrap_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ func (c *controller) reconcile(ctx context.Context, workspace *tenancyv1alpha1.C
if workspace.Status.Phase != tenancyv1alpha1.ClusterWorkspacePhaseInitializing {
return nil
}
if workspace.Spec.Type != c.workspaceType {
return nil
}

// have we done our work before?
initializerName := initialization.InitializerForReference(c.workspaceType)
Expand Down
45 changes: 0 additions & 45 deletions pkg/server/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ import (
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
"k8s.io/kubernetes/pkg/serviceaccount"

confighome "github.com/kcp-dev/kcp/config/home"
confighomebucket "github.com/kcp-dev/kcp/config/homebucket"
confighomeroot "github.com/kcp-dev/kcp/config/homeroot"
configorganization "github.com/kcp-dev/kcp/config/organization"
configteam "github.com/kcp-dev/kcp/config/team"
configuniversal "github.com/kcp-dev/kcp/config/universal"
tenancyv1alpha1 "github.com/kcp-dev/kcp/pkg/apis/tenancy/v1alpha1"
kcpclient "github.com/kcp-dev/kcp/pkg/client/clientset/versioned"
Expand Down Expand Up @@ -404,32 +401,6 @@ func (s *Server) installWorkspaceScheduler(ctx context.Context, config *rest.Con
return err
}

organizationController, err := bootstrap.NewController(
config,
dynamicClusterClient,
crdClusterClient,
kcpClusterClient,
s.kcpSharedInformerFactory.Tenancy().V1alpha1().ClusterWorkspaces(),
tenancyv1alpha1.ClusterWorkspaceTypeReference{Path: "root", Name: "organization"},
configorganization.Bootstrap,
)
if err != nil {
return err
}

teamController, err := bootstrap.NewController(
config,
dynamicClusterClient,
crdClusterClient,
kcpClusterClient,
s.kcpSharedInformerFactory.Tenancy().V1alpha1().ClusterWorkspaces(),
tenancyv1alpha1.ClusterWorkspaceTypeReference{Path: "root", Name: "team"},
configteam.Bootstrap,
)
if err != nil {
return err
}

universalController, err := bootstrap.NewController(
config,
dynamicClusterClient,
Expand All @@ -455,8 +426,6 @@ func (s *Server) installWorkspaceScheduler(ctx context.Context, config *rest.Con
go workspaceShardController.Start(ctx, 2)
}
go workspaceTypeController.Start(ctx, 2)
go organizationController.Start(ctx, 2)
go teamController.Start(ctx, 2)
go universalController.Start(ctx, 2)

return nil
Expand Down Expand Up @@ -508,19 +477,6 @@ func (s *Server) installHomeWorkspaces(ctx context.Context, config *rest.Config)
return err
}

homeController, err := bootstrap.NewController(
config,
dynamicClusterClient,
crdClusterClient,
kcpClusterClient,
s.kcpSharedInformerFactory.Tenancy().V1alpha1().ClusterWorkspaces(),
tenancyv1alpha1.ClusterWorkspaceTypeReference{Path: "root", Name: "home"},
confighome.Bootstrap,
)
if err != nil {
return err
}

s.AddPostStartHook("kcp-install-home-workspaces", func(hookContext genericapiserver.PostStartHookContext) error {
if err := s.waitForSync(hookContext.StopCh); err != nil {
klog.Errorf("failed to finish post-start-hook kcp-install-home-workspaces: %v", err)
Expand All @@ -530,7 +486,6 @@ func (s *Server) installHomeWorkspaces(ctx context.Context, config *rest.Config)

go homerootController.Start(ctx, 2)
go homebucketController.Start(ctx, 2)
go homeController.Start(ctx, 2)

return nil
})
Expand Down

0 comments on commit bd2ead8

Please sign in to comment.