github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/k8s/exploding_client.go (about) 1 package k8s 2 3 import ( 4 "context" 5 "io" 6 "time" 7 8 "github.com/distribution/reference" 9 "github.com/pkg/errors" 10 v1 "k8s.io/api/core/v1" 11 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 12 "k8s.io/apimachinery/pkg/runtime/schema" 13 "k8s.io/apimachinery/pkg/types" 14 "k8s.io/apimachinery/pkg/version" 15 "k8s.io/client-go/tools/clientcmd/api" 16 17 "github.com/tilt-dev/tilt/internal/container" 18 "github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" 19 "github.com/tilt-dev/tilt/pkg/model" 20 ) 21 22 var _ Client = &explodingClient{} 23 24 type explodingClient struct { 25 err error 26 } 27 28 func (ec *explodingClient) Upsert(ctx context.Context, entities []K8sEntity, timeout time.Duration) ([]K8sEntity, error) { 29 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 30 } 31 32 func (ec *explodingClient) Delete(ctx context.Context, entities []K8sEntity, wait time.Duration) error { 33 return errors.Wrap(ec.err, "could not set up kubernetes client") 34 } 35 36 func (ec *explodingClient) GetMetaByReference(ctx context.Context, ref v1.ObjectReference) (metav1.Object, error) { 37 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 38 } 39 40 func (ec *explodingClient) ListMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) ([]metav1.Object, error) { 41 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 42 } 43 44 func (ec *explodingClient) PodsWithImage(ctx context.Context, image reference.NamedTagged, n Namespace, lp []model.LabelPair) ([]v1.Pod, error) { 45 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 46 } 47 48 func (ec *explodingClient) PollForPodsWithImage(ctx context.Context, image reference.NamedTagged, n Namespace, lp []model.LabelPair, timeout time.Duration) ([]v1.Pod, error) { 49 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 50 } 51 52 func (ec *explodingClient) ContainerLogs(ctx context.Context, podID PodID, cName container.Name, n Namespace, startTime time.Time) (io.ReadCloser, error) { 53 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 54 } 55 56 func (ec *explodingClient) CreatePortForwarder(ctx context.Context, namespace Namespace, podID PodID, optionalLocalPort, remotePort int, host string) (PortForwarder, error) { 57 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 58 } 59 60 func (ec *explodingClient) WatchPods(ctx context.Context, ns Namespace) (<-chan ObjectUpdate, error) { 61 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 62 } 63 64 func (ec *explodingClient) PodFromInformerCache(ctx context.Context, nn types.NamespacedName) (*v1.Pod, error) { 65 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 66 } 67 68 func (ec *explodingClient) WatchServices(ctx context.Context, ns Namespace) (<-chan *v1.Service, error) { 69 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 70 } 71 72 func (ec *explodingClient) WatchEvents(ctx context.Context, ns Namespace) (<-chan *v1.Event, error) { 73 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 74 } 75 76 func (ec *explodingClient) WatchMeta(ctx context.Context, gvk schema.GroupVersionKind, ns Namespace) (<-chan metav1.Object, error) { 77 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 78 } 79 80 func (ec *explodingClient) ContainerRuntime(ctx context.Context) container.Runtime { 81 return container.RuntimeUnknown 82 } 83 84 func (ec *explodingClient) LocalRegistry(_ context.Context) *v1alpha1.RegistryHosting { 85 return nil 86 } 87 88 func (ec *explodingClient) NodeIP(ctx context.Context) NodeIP { 89 return "" 90 } 91 92 func (ec *explodingClient) Exec(ctx context.Context, podID PodID, cName container.Name, n Namespace, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { 93 return errors.Wrap(ec.err, "could not set up kubernetes client") 94 } 95 96 func (ec *explodingClient) CheckConnected(ctx context.Context) (*version.Info, error) { 97 return nil, errors.Wrap(ec.err, "could not set up kubernetes client") 98 } 99 100 func (ec *explodingClient) OwnerFetcher() OwnerFetcher { 101 return NewOwnerFetcher(context.Background(), ec) 102 } 103 104 func (ec *explodingClient) ClusterHealth(_ context.Context, _ bool) (ClusterHealth, error) { 105 return ClusterHealth{}, errors.Wrap(ec.err, "could not set up kubernetes client") 106 } 107 108 func (ec *explodingClient) APIConfig() *api.Config { 109 return &api.Config{} 110 }