blob: b83a5a008bb80bdd1a0343678c153634d5094f5e [file] [log] [blame]
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +04001package main
2
3import (
4 "github.com/giolekva/pcloud/core/installer"
giof6ad2982024-08-23 17:42:49 +04005 "github.com/giolekva/pcloud/core/installer/kube"
giof8acc612025-04-26 08:20:55 +04006 "github.com/giolekva/pcloud/core/installer/status"
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +04007)
8
9func newNSCreator() (installer.NamespaceCreator, error) {
giof6ad2982024-08-23 17:42:49 +040010 return installer.NewNamespaceCreator(kube.KubeConfigOpts{
11 KubeConfigPath: rootFlags.kubeConfig,
12 })
Giorgi Lekveishvilicd9e42c2023-12-13 09:49:44 +040013}
14
15func newZoneFetcher() (installer.ZoneStatusFetcher, error) {
16 return installer.NewZoneStatusFetcher(rootFlags.kubeConfig)
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +040017}
gio778577f2024-04-29 09:44:38 +040018
giof8acc612025-04-26 08:20:55 +040019func newHelmReleaseMonitor() (status.ResourceMonitor, error) {
20 return status.NewHelmReleaseMonitor(rootFlags.kubeConfig)
21}
22
23func newInstanceMonitor() (*status.InstanceMonitor, error) {
24 m, err := status.NewDelegatingMonitor(rootFlags.kubeConfig)
25 if err != nil {
26 return nil, err
27 }
28 return status.NewInstanceMonitor(m), nil
gio778577f2024-04-29 09:44:38 +040029}
giof8843412024-05-22 16:38:05 +040030
31func newJobCreator() (installer.JobCreator, error) {
giof6ad2982024-08-23 17:42:49 +040032 clientset, err := kube.NewKubeClient(kube.KubeConfigOpts{
33 KubeConfigPath: rootFlags.kubeConfig,
34 })
giof8843412024-05-22 16:38:05 +040035 if err != nil {
36 return nil, err
37 }
38 return installer.NewJobCreator(clientset.BatchV1()), nil
39}