@@ -41,7 +41,6 @@ import (
4141 "github.com/kube-bind/kube-bind/backend/session"
4242 "github.com/kube-bind/kube-bind/backend/template"
4343 bindversion "github.com/kube-bind/kube-bind/pkg/version"
44- catalogv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/catalog/v1alpha1"
4544 kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2"
4645)
4746
@@ -417,7 +416,7 @@ func (h *handler) handleResources(w http.ResponseWriter, r *http.Request) {
417416
418417func (h * handler ) handleBind (w http.ResponseWriter , r * http.Request ) {
419418 logger := getLogger (r )
420- moduleName := r .URL .Query ().Get ("module " )
419+ templateName := r .URL .Query ().Get ("template " )
421420 providerCluster := mux .Vars (r )["cluster" ]
422421
423422 prepareNoCache (w )
@@ -446,9 +445,9 @@ func (h *handler) handleBind(w http.ResponseWriter, r *http.Request) {
446445 }
447446
448447 // Module consist of many resources and permissionClaims. Read it and translate to
449- module , err := h .kubeManager .GetModule (r .Context (), providerCluster , moduleName )
448+ template , err := h .kubeManager .GetTemplates (r .Context (), providerCluster , templateName )
450449 if err != nil {
451- logger .Error (err , "failed to get module " )
450+ logger .Error (err , "failed to get template " )
452451 http .Error (w , "internal error" , http .StatusInternalServerError )
453452 return
454453 }
@@ -459,12 +458,12 @@ func (h *handler) handleBind(w http.ResponseWriter, r *http.Request) {
459458 Kind : "APIServiceExportRequest" ,
460459 },
461460 ObjectMeta : kubebindv1alpha2.NameObjectMeta {
462- Name : moduleName ,
461+ Name : templateName ,
463462 },
464463 Spec : kubebindv1alpha2.APIServiceExportRequestSpec {
465- Resources : module .Spec .Resources ,
466- PermissionClaims : module .Spec .PermissionClaims ,
467- Namespaces : module .Spec .Namespaces ,
464+ Resources : template .Spec .Resources ,
465+ PermissionClaims : template .Spec .PermissionClaims ,
466+ Namespaces : template .Spec .Namespaces ,
468467 },
469468 }
470469
@@ -528,22 +527,22 @@ func mustRead(f func(name string) ([]byte, error), name string) string {
528527// Flow is:
529528// 1. List Collection and check what modules we are targeting
530529// 2. Get modules from the backend cluster and consutruct shallow-bound schemas (no crd content).
531- func (h * handler ) listCollectionModules (ctx context.Context , cluster string ) (* catalogv1alpha1. ModuleList , error ) {
530+ func (h * handler ) listCollectionModules (ctx context.Context , cluster string ) (* kubebindv1alpha2. APIServiceExportTemplateList , error ) {
532531 collections , err := h .kubeManager .ListCollections (ctx , cluster )
533532 if err != nil {
534533 return nil , fmt .Errorf ("failed to list collections: %w" , err )
535534 }
536535
537- modules := & catalogv1alpha1. ModuleList {}
536+ templates := & kubebindv1alpha2. APIServiceExportTemplateList {}
538537 for _ , collection := range collections .Items {
539- for _ , m := range collection .Spec .Modules {
540- module , err := h .kubeManager .GetModule (ctx , cluster , m .Name )
538+ for _ , t := range collection .Spec .Templates {
539+ template , err := h .kubeManager .GetTemplates (ctx , cluster , t .Name )
541540 if err != nil {
542- return nil , fmt .Errorf ("failed to get module %q: %w" , m .Name , err )
541+ return nil , fmt .Errorf ("failed to get template %q: %w" , t .Name , err )
543542 }
544- modules .Items = append (modules .Items , * module )
543+ templates .Items = append (templates .Items , * template )
545544 }
546545 }
547546
548- return modules , nil
547+ return templates , nil
549548}
0 commit comments