github.com/umeshredd/helm@v3.0.0-alpha.1+incompatible/pkg/kube/interface.go (about) 1 /* 2 Copyright The Helm Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package kube 18 19 import ( 20 "io" 21 "time" 22 23 v1 "k8s.io/api/core/v1" 24 ) 25 26 // KubernetesClient represents a client capable of communicating with the Kubernetes API. 27 // 28 // A KubernetesClient must be concurrency safe. 29 type Interface interface { 30 // Create creates one or more resources. 31 // 32 // reader must contain a YAML stream (one or more YAML documents separated 33 // by "\n---\n"). 34 Create(reader io.Reader) error 35 36 Wait(r io.Reader, timeout time.Duration) error 37 38 // Delete destroys one or more resources. 39 // 40 // reader must contain a YAML stream (one or more YAML documents separated 41 // by "\n---\n"). 42 Delete(io.Reader) error 43 44 // Watch the resource in reader until it is "ready". 45 // 46 // For Jobs, "ready" means the job ran to completion (excited without error). 47 // For all other kinds, it means the kind was created or modified without 48 // error. 49 WatchUntilReady(reader io.Reader, timeout time.Duration) error 50 51 // Update updates one or more resources or creates the resource 52 // if it doesn't exist. 53 // 54 // reader must contain a YAML stream (one or more YAML documents separated 55 // by "\n---\n"). 56 Update(originalReader, modifiedReader io.Reader, force bool, recreate bool) error 57 58 Build(reader io.Reader) (Result, error) 59 BuildUnstructured(reader io.Reader) (Result, error) 60 61 // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase 62 // and returns said phase (PodSucceeded or PodFailed qualify). 63 WaitAndGetCompletedPodPhase(name string, timeout time.Duration) (v1.PodPhase, error) 64 } 65 66 var _ Interface = (*Client)(nil)