Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddConfigLabels ¶
AddConfigLabels adds new label(s) to all resources defined in the given Config.
func AddObjectLabels ¶ added in v0.2.1
AddObjectLabels adds new label(s) to a single runtime.Object
func DecodeDataToObject ¶ added in v0.2.1
DecodeDataToObject decodes the JSON/YAML content into the runtime Object using the RESTMapper interface. The RESTMapper mappings are returned for the future encoding.
Types ¶
type ApplyResult ¶
type ApplyResult struct { Errors errs.ValidationErrorList Message string }
ApplyResult holds the response from the REST server and potential errors
func Apply ¶
func Apply(namespace string, data []byte, clientFunc func(*kmeta.RESTMapping) (*resource.Helper, error)) ([]ApplyResult, error)
Apply creates and manages resources defined in the Config. The create process won't stop on error, but it will finish the job and then return error and for each item in the config an error and status message string.
Example ¶
kubeClient, _ := kclient.New(&kclient.Config{Host: "127.0.0.1"}) testClientMappings := clientapi.ClientMappings{ "pods": {"Pod", kubeClient.RESTClient, klatest.Codec}, "services": {"Service", kubeClient.RESTClient, klatest.Codec}, } clientFunc := func(m *kmeta.RESTMapping) (*resource.Helper, error) { mapping, ok := testClientMappings[m.Resource] if !ok { return nil, fmt.Errorf("Unable to provide REST client for %v", m.Resource) } return resource.NewHelper(mapping.Client, m), nil } data, _ := ioutil.ReadFile("../../examples/sample-app/docker-registry-config.json") Apply(kapi.NamespaceDefault, data, clientFunc)
Output:
Click to show internal directories.
Click to hide internal directories.