@@ -29,6 +29,8 @@ import (
29
29
30
30
corev1 "k8s.io/api/core/v1"
31
31
apierrors "k8s.io/apimachinery/pkg/api/errors"
32
+ "k8s.io/apimachinery/pkg/runtime"
33
+ "k8s.io/client-go/kubernetes/scheme"
32
34
"k8s.io/client-go/tools/clientcmd"
33
35
34
36
ctrl "sigs.k8s.io/controller-runtime"
@@ -61,6 +63,9 @@ func New(opts Options) *Provider {
61
63
if opts .KubeconfigSecretKey == "" {
62
64
opts .KubeconfigSecretKey = DefaultKubeconfigSecretKey
63
65
}
66
+ if opts .Scheme == nil {
67
+ opts .Scheme = scheme .Scheme
68
+ }
64
69
65
70
return & Provider {
66
71
opts : opts ,
@@ -77,6 +82,8 @@ type Options struct {
77
82
KubeconfigSecretLabel string
78
83
// KubeconfigSecretKey is the key in the secret data that contains the kubeconfig.
79
84
KubeconfigSecretKey string
85
+ // Scheme is the scheme to use for the clusters.
86
+ Scheme * runtime.Scheme
80
87
}
81
88
82
89
type index struct {
@@ -254,7 +261,9 @@ func (p *Provider) createAndEngageCluster(ctx context.Context, clusterName strin
254
261
255
262
// Create a new cluster
256
263
log .Info ("Creating new cluster from kubeconfig" )
257
- cl , err := cluster .New (restConfig )
264
+ cl , err := cluster .New (restConfig , func (o * cluster.Options ) {
265
+ o .Scheme = p .opts .Scheme
266
+ })
258
267
if err != nil {
259
268
return fmt .Errorf ("failed to create cluster: %w" , err )
260
269
}
0 commit comments