2020-09-16 14:19:51 +00:00
|
|
|
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2020-08-07 21:49:04 +00:00
|
|
|
|
2020-09-21 18:16:14 +00:00
|
|
|
// Package controllermanager provides an entrypoint into running all of the controllers that run as
|
|
|
|
// a part of Pinniped.
|
2020-08-09 17:04:05 +00:00
|
|
|
package controllermanager
|
2020-08-07 21:49:04 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2020-09-21 18:16:14 +00:00
|
|
|
corev1 "k8s.io/api/core/v1"
|
2020-08-07 21:49:04 +00:00
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
2020-09-23 15:01:41 +00:00
|
|
|
"k8s.io/apimachinery/pkg/util/clock"
|
2020-08-07 21:49:04 +00:00
|
|
|
k8sinformers "k8s.io/client-go/informers"
|
|
|
|
"k8s.io/client-go/kubernetes"
|
2020-09-23 15:01:41 +00:00
|
|
|
"k8s.io/client-go/rest"
|
2020-08-07 21:49:04 +00:00
|
|
|
restclient "k8s.io/client-go/rest"
|
2020-09-14 15:47:16 +00:00
|
|
|
"k8s.io/klog/v2/klogr"
|
2020-08-09 17:04:05 +00:00
|
|
|
aggregatorclient "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"
|
2020-08-07 21:49:04 +00:00
|
|
|
|
2020-09-18 19:56:24 +00:00
|
|
|
loginv1alpha1 "go.pinniped.dev/generated/1.19/apis/login/v1alpha1"
|
|
|
|
pinnipedclientset "go.pinniped.dev/generated/1.19/client/clientset/versioned"
|
|
|
|
pinnipedinformers "go.pinniped.dev/generated/1.19/client/informers/externalversions"
|
|
|
|
"go.pinniped.dev/internal/controller/apicerts"
|
|
|
|
"go.pinniped.dev/internal/controller/identityprovider/idpcache"
|
|
|
|
"go.pinniped.dev/internal/controller/identityprovider/webhookcachecleaner"
|
|
|
|
"go.pinniped.dev/internal/controller/identityprovider/webhookcachefiller"
|
|
|
|
"go.pinniped.dev/internal/controller/issuerconfig"
|
2020-09-21 18:16:14 +00:00
|
|
|
"go.pinniped.dev/internal/controller/kubecertagent"
|
2020-09-18 19:56:24 +00:00
|
|
|
"go.pinniped.dev/internal/controllerlib"
|
2020-09-23 12:26:59 +00:00
|
|
|
"go.pinniped.dev/internal/dynamiccert"
|
2020-09-18 23:39:58 +00:00
|
|
|
"go.pinniped.dev/pkg/config/api"
|
2020-08-07 21:49:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
singletonWorker = 1
|
|
|
|
defaultResyncInterval = 3 * time.Minute
|
|
|
|
)
|
|
|
|
|
2020-09-21 18:16:14 +00:00
|
|
|
// Config holds all the input parameters to the set of controllers run as a part of Pinniped.
|
|
|
|
//
|
|
|
|
// It is used to inject parameters into PrepareControllers.
|
|
|
|
type Config struct {
|
|
|
|
// ServerInstallationNamespace provides the namespace in which Pinniped is deployed.
|
|
|
|
ServerInstallationNamespace string
|
|
|
|
|
|
|
|
// NamesConfig comes from the Pinniped config API (see api.Config). It specifies how Kubernetes
|
|
|
|
// objects should be named.
|
|
|
|
NamesConfig *api.NamesConfigSpec
|
|
|
|
|
|
|
|
// DiscoveryURLOverride allows a caller to inject a hardcoded discovery URL into Pinniped
|
|
|
|
// discovery document.
|
|
|
|
DiscoveryURLOverride *string
|
|
|
|
|
2020-09-23 13:53:21 +00:00
|
|
|
// DynamicServingCertProvider provides a setter and a getter to the Pinniped API's serving cert.
|
|
|
|
DynamicServingCertProvider dynamiccert.Provider
|
2020-09-23 15:01:41 +00:00
|
|
|
// DynamicSigningCertProvider provides a setter and a getter to the Pinniped API's
|
|
|
|
// signing cert, i.e., the cert that it uses to sign certs for Pinniped clients wishing to login.
|
|
|
|
DynamicSigningCertProvider dynamiccert.Provider
|
2020-09-21 18:16:14 +00:00
|
|
|
|
|
|
|
// ServingCertDuration is the validity period, in seconds, of the API serving certificate.
|
|
|
|
ServingCertDuration time.Duration
|
|
|
|
// ServingCertRenewBefore is the period of time, in seconds, that pinniped will wait before
|
|
|
|
// rotating the serving certificate. This period of time starts upon issuance of the serving
|
|
|
|
// certificate.
|
|
|
|
ServingCertRenewBefore time.Duration
|
|
|
|
|
|
|
|
// IDPCache is a cache of authenticators shared amongst various IDP-related controllers.
|
|
|
|
IDPCache *idpcache.Cache
|
|
|
|
|
|
|
|
// KubeCertAgentTemplate is the template from which the kube-cert-agent controllers will create a
|
|
|
|
// kube-cert-agent pod. See kubecertagent.Info for more details.
|
|
|
|
KubeCertAgentTemplate *corev1.Pod
|
|
|
|
// KubeCertAgentCertPathAnnotation is the name of the annotation key that will be used when
|
|
|
|
// setting the best-guess path to the kube API's certificate. See kubecertagent.Info for more
|
|
|
|
// details.
|
|
|
|
KubeCertAgentCertPathAnnotation string
|
|
|
|
// KubeCertAgentKeyPathAnnotation is the name of the annotation key that will be used when setting
|
|
|
|
// the best-guess path to the kube API's key. See kubecertagent.Info for more details.
|
|
|
|
KubeCertAgentKeyPathAnnotation string
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:49:04 +00:00
|
|
|
// Prepare the controllers and their informers and return a function that will start them when called.
|
2020-09-21 18:16:14 +00:00
|
|
|
//nolint:funlen // Eh, fair, it is a really long function...but it is wiring the world...so...
|
|
|
|
func PrepareControllers(c *Config) (func(ctx context.Context), error) {
|
2020-08-07 21:49:04 +00:00
|
|
|
// Create k8s clients.
|
2020-09-23 15:01:41 +00:00
|
|
|
kubeConfig, err := createConfig()
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not create config for the controllers: %w", err)
|
|
|
|
}
|
|
|
|
k8sClient, aggregatorClient, pinnipedClient, err := createClients(kubeConfig)
|
2020-08-07 21:49:04 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not create clients for the controllers: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-08-09 17:04:05 +00:00
|
|
|
// Create informers. Don't forget to make sure they get started in the function returned below.
|
2020-09-21 18:16:14 +00:00
|
|
|
informers := createInformers(c.ServerInstallationNamespace, k8sClient, pinnipedClient)
|
2020-08-07 21:49:04 +00:00
|
|
|
|
|
|
|
// Create controller manager.
|
2020-08-28 15:59:09 +00:00
|
|
|
controllerManager := controllerlib.
|
2020-08-07 21:49:04 +00:00
|
|
|
NewManager().
|
|
|
|
WithController(
|
2020-09-23 11:58:01 +00:00
|
|
|
issuerconfig.NewKubeConfigInfoPublisherController(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.CredentialIssuerConfig,
|
|
|
|
c.DiscoveryURLOverride,
|
2020-08-20 17:54:15 +00:00
|
|
|
pinnipedClient,
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.kubePublicNamespaceK8s.Core().V1().ConfigMaps(),
|
|
|
|
informers.installationNamespacePinniped.Config().V1alpha1().CredentialIssuerConfigs(),
|
2020-08-28 15:59:09 +00:00
|
|
|
controllerlib.WithInformer,
|
2020-08-09 17:04:05 +00:00
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
apicerts.NewCertsManagerController(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.ServingCertificateSecret,
|
2020-08-09 17:04:05 +00:00
|
|
|
k8sClient,
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Secrets(),
|
2020-08-28 15:59:09 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
controllerlib.WithInitialEvent,
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServingCertDuration,
|
2020-09-08 23:36:49 +00:00
|
|
|
"Pinniped CA",
|
2020-09-21 18:16:14 +00:00
|
|
|
c.NamesConfig.APIService,
|
2020-09-08 23:36:49 +00:00
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
2020-09-16 20:00:03 +00:00
|
|
|
WithController(
|
|
|
|
apicerts.NewAPIServiceUpdaterController(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.ServingCertificateSecret,
|
2020-09-16 20:00:03 +00:00
|
|
|
loginv1alpha1.SchemeGroupVersion.Version+"."+loginv1alpha1.GroupName,
|
|
|
|
aggregatorClient,
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Secrets(),
|
2020-09-16 20:00:03 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
2020-08-09 17:04:05 +00:00
|
|
|
WithController(
|
|
|
|
apicerts.NewCertsObserverController(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.ServingCertificateSecret,
|
2020-09-23 13:53:21 +00:00
|
|
|
c.DynamicServingCertProvider,
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Secrets(),
|
2020-08-28 15:59:09 +00:00
|
|
|
controllerlib.WithInformer,
|
2020-08-07 21:49:04 +00:00
|
|
|
),
|
|
|
|
singletonWorker,
|
2020-08-19 20:15:45 +00:00
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
apicerts.NewCertsExpirerController(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.ServingCertificateSecret,
|
2020-08-19 20:15:45 +00:00
|
|
|
k8sClient,
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Secrets(),
|
2020-08-28 15:59:09 +00:00
|
|
|
controllerlib.WithInformer,
|
2020-09-21 18:16:14 +00:00
|
|
|
c.ServingCertRenewBefore,
|
2020-08-19 20:15:45 +00:00
|
|
|
),
|
|
|
|
singletonWorker,
|
2020-09-14 15:47:16 +00:00
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
webhookcachefiller.New(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.IDPCache,
|
|
|
|
informers.installationNamespacePinniped.IDP().V1alpha1().WebhookIdentityProviders(),
|
2020-09-14 15:47:16 +00:00
|
|
|
klogr.New(),
|
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
webhookcachecleaner.New(
|
2020-09-21 18:16:14 +00:00
|
|
|
c.IDPCache,
|
|
|
|
informers.installationNamespacePinniped.IDP().V1alpha1().WebhookIdentityProviders(),
|
2020-09-14 15:47:16 +00:00
|
|
|
klogr.New(),
|
|
|
|
),
|
|
|
|
singletonWorker,
|
2020-09-21 18:16:14 +00:00
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
kubecertagent.NewCreaterController(
|
|
|
|
&kubecertagent.Info{
|
|
|
|
Template: c.KubeCertAgentTemplate,
|
|
|
|
},
|
|
|
|
k8sClient,
|
|
|
|
informers.kubeSystemNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 23:37:22 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 18:16:14 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
kubecertagent.NewDeleterController(
|
|
|
|
&kubecertagent.Info{
|
|
|
|
Template: c.KubeCertAgentTemplate,
|
|
|
|
},
|
|
|
|
k8sClient,
|
|
|
|
informers.kubeSystemNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 23:37:22 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 18:16:14 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
),
|
|
|
|
singletonWorker,
|
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
kubecertagent.NewAnnotaterController(
|
|
|
|
&kubecertagent.Info{
|
|
|
|
Template: c.KubeCertAgentTemplate,
|
|
|
|
CertPathAnnotation: c.KubeCertAgentCertPathAnnotation,
|
|
|
|
KeyPathAnnotation: c.KubeCertAgentKeyPathAnnotation,
|
|
|
|
},
|
|
|
|
k8sClient,
|
|
|
|
informers.kubeSystemNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 23:37:22 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Pods(),
|
2020-09-21 18:16:14 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
),
|
|
|
|
singletonWorker,
|
2020-09-23 15:01:41 +00:00
|
|
|
).
|
|
|
|
WithController(
|
|
|
|
kubecertagent.NewExecerController(
|
|
|
|
&kubecertagent.Info{
|
|
|
|
Template: c.KubeCertAgentTemplate,
|
|
|
|
CertPathAnnotation: c.KubeCertAgentCertPathAnnotation,
|
|
|
|
KeyPathAnnotation: c.KubeCertAgentKeyPathAnnotation,
|
|
|
|
},
|
|
|
|
c.ServerInstallationNamespace,
|
|
|
|
c.NamesConfig.CredentialIssuerConfig,
|
|
|
|
c.DynamicSigningCertProvider,
|
|
|
|
kubecertagent.NewPodCommandExecutor(kubeConfig, k8sClient),
|
|
|
|
pinnipedClient,
|
|
|
|
clock.RealClock{},
|
2020-09-23 16:47:04 +00:00
|
|
|
informers.installationNamespaceK8s.Core().V1().Pods(),
|
2020-09-23 15:01:41 +00:00
|
|
|
controllerlib.WithInformer,
|
|
|
|
),
|
|
|
|
singletonWorker,
|
2020-08-07 21:49:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Return a function which starts the informers and controllers.
|
|
|
|
return func(ctx context.Context) {
|
2020-09-21 18:16:14 +00:00
|
|
|
informers.startAndWaitForSync(ctx)
|
2020-08-07 21:49:04 +00:00
|
|
|
go controllerManager.Start(ctx)
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2020-09-23 15:01:41 +00:00
|
|
|
// Create the rest config that will be used by the clients for the controllers.
|
|
|
|
func createConfig() (*rest.Config, error) {
|
|
|
|
// Load the Kubernetes client configuration.
|
|
|
|
kubeConfig, err := restclient.InClusterConfig()
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not load in-cluster configuration: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return kubeConfig, nil
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:49:04 +00:00
|
|
|
// Create the k8s clients that will be used by the controllers.
|
2020-09-23 15:01:41 +00:00
|
|
|
func createClients(kubeConfig *rest.Config) (
|
2020-08-09 17:04:05 +00:00
|
|
|
k8sClient *kubernetes.Clientset,
|
|
|
|
aggregatorClient *aggregatorclient.Clientset,
|
2020-08-20 17:54:15 +00:00
|
|
|
pinnipedClient *pinnipedclientset.Clientset,
|
2020-08-09 17:04:05 +00:00
|
|
|
err error,
|
|
|
|
) {
|
2020-08-07 21:49:04 +00:00
|
|
|
// explicitly use protobuf when talking to built-in kube APIs
|
|
|
|
protoKubeConfig := createProtoKubeConfig(kubeConfig)
|
|
|
|
|
|
|
|
// Connect to the core Kubernetes API.
|
2020-08-09 17:04:05 +00:00
|
|
|
k8sClient, err = kubernetes.NewForConfig(protoKubeConfig)
|
2020-08-07 21:49:04 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, nil, nil, fmt.Errorf("could not initialize Kubernetes client: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Connect to the Kubernetes aggregation API.
|
2020-08-09 17:04:05 +00:00
|
|
|
aggregatorClient, err = aggregatorclient.NewForConfig(protoKubeConfig)
|
2020-08-07 21:49:04 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, nil, nil, fmt.Errorf("could not initialize Kubernetes client: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-08-20 17:54:15 +00:00
|
|
|
// Connect to the pinniped API.
|
2020-08-07 21:49:04 +00:00
|
|
|
// I think we can't use protobuf encoding here because we are using CRDs
|
|
|
|
// (for which protobuf encoding is not supported).
|
2020-08-20 17:54:15 +00:00
|
|
|
pinnipedClient, err = pinnipedclientset.NewForConfig(kubeConfig)
|
2020-08-07 21:49:04 +00:00
|
|
|
if err != nil {
|
2020-08-20 17:54:15 +00:00
|
|
|
return nil, nil, nil, fmt.Errorf("could not initialize pinniped client: %w", err)
|
2020-08-07 21:49:04 +00:00
|
|
|
}
|
|
|
|
|
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
|
|
|
//nolint: nakedret // Short function. Makes the order of return values more clear.
|
2020-08-09 17:04:05 +00:00
|
|
|
return
|
2020-08-07 21:49:04 +00:00
|
|
|
}
|
|
|
|
|
2020-09-21 18:16:14 +00:00
|
|
|
type informers struct {
|
|
|
|
kubePublicNamespaceK8s k8sinformers.SharedInformerFactory
|
|
|
|
kubeSystemNamespaceK8s k8sinformers.SharedInformerFactory
|
|
|
|
installationNamespaceK8s k8sinformers.SharedInformerFactory
|
|
|
|
installationNamespacePinniped pinnipedinformers.SharedInformerFactory
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:49:04 +00:00
|
|
|
// Create the informers that will be used by the controllers.
|
|
|
|
func createInformers(
|
|
|
|
serverInstallationNamespace string,
|
|
|
|
k8sClient *kubernetes.Clientset,
|
2020-08-20 17:54:15 +00:00
|
|
|
pinnipedClient *pinnipedclientset.Clientset,
|
2020-09-21 18:16:14 +00:00
|
|
|
) *informers {
|
|
|
|
return &informers{
|
|
|
|
kubePublicNamespaceK8s: k8sinformers.NewSharedInformerFactoryWithOptions(
|
|
|
|
k8sClient,
|
|
|
|
defaultResyncInterval,
|
|
|
|
k8sinformers.WithNamespace(issuerconfig.ClusterInfoNamespace),
|
|
|
|
),
|
|
|
|
kubeSystemNamespaceK8s: k8sinformers.NewSharedInformerFactoryWithOptions(
|
|
|
|
k8sClient,
|
|
|
|
defaultResyncInterval,
|
|
|
|
k8sinformers.WithNamespace(kubecertagent.ControllerManagerNamespace),
|
|
|
|
),
|
|
|
|
installationNamespaceK8s: k8sinformers.NewSharedInformerFactoryWithOptions(
|
|
|
|
k8sClient,
|
|
|
|
defaultResyncInterval,
|
|
|
|
k8sinformers.WithNamespace(serverInstallationNamespace),
|
|
|
|
),
|
|
|
|
installationNamespacePinniped: pinnipedinformers.NewSharedInformerFactoryWithOptions(
|
|
|
|
pinnipedClient,
|
|
|
|
defaultResyncInterval,
|
|
|
|
pinnipedinformers.WithNamespace(serverInstallationNamespace),
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i *informers) startAndWaitForSync(ctx context.Context) {
|
|
|
|
i.kubePublicNamespaceK8s.Start(ctx.Done())
|
|
|
|
i.kubeSystemNamespaceK8s.Start(ctx.Done())
|
|
|
|
i.installationNamespaceK8s.Start(ctx.Done())
|
|
|
|
i.installationNamespacePinniped.Start(ctx.Done())
|
|
|
|
|
|
|
|
i.kubePublicNamespaceK8s.WaitForCacheSync(ctx.Done())
|
|
|
|
i.kubeSystemNamespaceK8s.WaitForCacheSync(ctx.Done())
|
|
|
|
i.installationNamespaceK8s.WaitForCacheSync(ctx.Done())
|
|
|
|
i.installationNamespacePinniped.WaitForCacheSync(ctx.Done())
|
2020-08-07 21:49:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns a copy of the input config with the ContentConfig set to use protobuf.
|
|
|
|
// Do not use this config to communicate with any CRD based APIs.
|
|
|
|
func createProtoKubeConfig(kubeConfig *restclient.Config) *restclient.Config {
|
|
|
|
protoKubeConfig := restclient.CopyConfig(kubeConfig)
|
|
|
|
const protoThenJSON = runtime.ContentTypeProtobuf + "," + runtime.ContentTypeJSON
|
|
|
|
protoKubeConfig.AcceptContentTypes = protoThenJSON
|
|
|
|
protoKubeConfig.ContentType = runtime.ContentTypeProtobuf
|
|
|
|
return protoKubeConfig
|
|
|
|
}
|