Skip to content

Commit

Permalink
Generic storage using secrets as backing + Invitation resource plumbing
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Feb 10, 2023
1 parent efde6f6 commit a043535
Show file tree
Hide file tree
Showing 10 changed files with 529 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ spec:
port: 9443
version: v1
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
name: v1.user.appuio.io
spec:
insecureSkipTLSVerify: true
group: user.appuio.io
groupPriorityMinimum: 1000
versionPriority: 15
service:
name: apiserver
namespace: default
port: 9443
version: v1
---
apiVersion: v1
kind: Service
metadata:
Expand Down
15 changes: 15 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ import (
genericregistry "k8s.io/apiserver/pkg/registry/generic"
"k8s.io/apiserver/pkg/registry/rest"
"sigs.k8s.io/apiserver-runtime/pkg/builder"
"sigs.k8s.io/apiserver-runtime/pkg/util/loopback"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

billingv1 "github.com/appuio/control-api/apis/billing/v1"
orgv1 "github.com/appuio/control-api/apis/organization/v1"
userv1 "github.com/appuio/control-api/apis/user/v1"
"github.com/appuio/control-api/apiserver/authwrapper"
billingStore "github.com/appuio/control-api/apiserver/billing"
"github.com/appuio/control-api/apiserver/billing/odoostorage"
orgStore "github.com/appuio/control-api/apiserver/organization"
"github.com/appuio/control-api/apiserver/secretstorage"
)

type organizationStatusRegisterer struct {
Expand All @@ -44,6 +48,17 @@ func APICommand() *cobra.Command {
WithResourceAndHandler(&orgv1.Organization{}, ost).
WithResourceAndHandler(organizationStatusRegisterer{&orgv1.Organization{}}, ost).
WithResourceAndHandler(&billingv1.BillingEntity{}, ob.Build).
WithResourceAndHandler(&userv1.Invitation{}, func(s *runtime.Scheme, g genericregistry.RESTOptionsGetter) (rest.Storage, error) {
c, err := client.NewWithWatch(loopback.GetLoopbackMasterClientConfig(), client.Options{})
if err != nil {
return nil, err
}
err = userv1.AddToScheme(c.Scheme())
if err != nil {
return nil, err
}
return secretstorage.NewStorage(&userv1.Invitation{}, c, "default")
}).
WithoutEtcd().
ExposeLoopbackAuthorizer().
ExposeLoopbackMasterClientConfig().
Expand Down
2 changes: 1 addition & 1 deletion apiserver/authwrapper/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/appuio/control-api/apiserver/authwrapper"
"github.com/appuio/control-api/apiserver/authwrapper/mock"
"github.com/appuio/control-api/apiserver/authwrapper/testresource"
"github.com/appuio/control-api/apiserver/testresource"
)

var gvr = func() metav1.GroupVersionResource {
Expand Down
2 changes: 1 addition & 1 deletion apiserver/billing/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/fake"

"github.com/appuio/control-api/apiserver/authwrapper/mock"
"github.com/appuio/control-api/apiserver/authwrapper/testresource"
"github.com/appuio/control-api/apiserver/testresource"
)

func Test_createRBACWrapper(t *testing.T) {
Expand Down
Loading

0 comments on commit a043535

Please sign in to comment.