Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion internal/project/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import (
corev1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -278,7 +280,9 @@ func EnsureLocalDevControlPlane(ctx context.Context, opts ...Option) (DevControl
return nil, errors.Wrap(err, "cannot get rest config")
}

cl, err := client.New(restConfig, client.Options{})
cl, err := client.New(restConfig, client.Options{
Scheme: newScheme(),
})
if err != nil {
return nil, errors.Wrap(err, "cannot construct control plane client")
}
Expand Down Expand Up @@ -334,6 +338,12 @@ func EnsureLocalDevControlPlane(ctx context.Context, opts ...Option) (DevControl
}, nil
}

func newScheme() *runtime.Scheme {
sch := runtime.NewScheme()
_ = clientgoscheme.AddToScheme(sch)
return sch
}

// TeardownLocalDevControlPlane tears down a local dev control plane by name.
// It deletes the kind cluster, stops the registry container, and removes the
// registry data directory.
Expand Down
3 changes: 3 additions & 0 deletions internal/schemas/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (m *Manager) Generate(ctx context.Context, source Source) (map[string]afero
return nil, err
}

var schemasMu sync.Mutex
schemas := make(map[string]afero.Fs)
eg, egCtx := errgroup.WithContext(ctx)
sourceType := source.Type()
Expand All @@ -101,7 +102,9 @@ func (m *Manager) Generate(ctx context.Context, source Source) (map[string]afero
}

if schemaFS != nil {
schemasMu.Lock()
schemas[gen.Language()] = schemaFS
schemasMu.Unlock()
}

return nil
Expand Down
Loading