func()

in pkg/service/platform/k8s/k8s.go [123:157]


func (s *K8SService) Init(config *rest.Config, scheme *runtime.Scheme) error {
	s.Scheme = scheme

	coreClient, err := coreV1Client.NewForConfig(config)
	if err != nil {
		return fmt.Errorf("failed to create k8s coreV1Client: %w", err)
	}

	s.CoreClient = coreClient

	appsClient, err := appsV1Client.NewForConfig(config)
	if err != nil {
		return fmt.Errorf("failed to create k8s AppsV1Client: %w", err)
	}

	s.appsV1Client = appsClient

	netClient, err := networkingClient.NewForConfig(config)
	if err != nil {
		return errors.Wrap(err, "Failed to init extensions V1 client for K8S")
	}

	s.networkingClient = netClient

	cl, err := k8sClient.New(config, k8sClient.Options{
		Scheme: s.Scheme,
	})
	if err != nil {
		return errors.Wrap(err, "Failed to create k8s client")
	}

	s.client = cl

	return nil
}