Documentation ¶
Overview ¶
Copyright © 2021 Loft Orbital
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Loft Orbital ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Loft Orbital ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func IsManifest(v cue.Value) bool
- type Id
- func (id Id) GroupKind() schema.GroupKind
- func (id Id) Manifest(ctx context.Context, rm meta.RESTMapper, client dynamic.Interface, ...) (Manifest, error)
- func (id Id) RESTMapping(rm meta.RESTMapper) (*meta.RESTMapping, error)
- func (id Id) ResourceInterface(rm meta.RESTMapper, client dynamic.Interface) (resource dynamic.ResourceInterface, err error)
- func (id Id) String() string
- type Manifest
- func (m Manifest) Delete(ctx context.Context, konfig *utils.K8sConfig, opts utils.CommonMetaOptions) error
- func (m Manifest) GetDeletionPolicy() string
- func (m Manifest) GetInstance() string
- func (m Manifest) Hash() ([]byte, error)
- func (m Manifest) Id() Id
- func (m Manifest) IsRemote() bool
- func (m Manifest) Patch(ctx context.Context, konfig *utils.K8sConfig, opts utils.CommonMetaOptions) (Manifest, error)
- func (m Manifest) WithDeletionPolicy(policy string) Manifest
- func (m Manifest) WithInstance(name string) Manifest
Constants ¶
const ( DeletionPolicyAbandon = "abandon" InstanceLabel = "instance.cuebe.loftorbital.com/name" DeletionPolicyAnnotation = "instance.cuebe.loftorbital.com/deletion-policy" )
const FieldManager = "cuebe"
Variables ¶
This section is empty.
Functions ¶
func IsManifest ¶
IsManifest returns true if the cue.Value "looks like" a Manifest. For now that means it has a 'kind' and 'apiVersion', both being strings.
Types ¶
type Id ¶
type Id struct { Group string `json:"group" protobuf:"bytes,1,opt,name=group"` Version string `json:"version" protobuf:"bytes,2,opt,name=version"` Kind string `json:"kind" protobuf:"bytes,3,opt,name=kind"` Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` }
Id contains the necessary fields to identify a Manifest
func (Id) Manifest ¶
func (id Id) Manifest(ctx context.Context, rm meta.RESTMapper, client dynamic.Interface, opts metav1.GetOptions) (Manifest, error)
Manifest retrieves the manifest matching this id in the given cluster.
func (Id) RESTMapping ¶
func (id Id) RESTMapping(rm meta.RESTMapper) (*meta.RESTMapping, error)
RESTMapping returns the rest mapping for this id.
func (Id) ResourceInterface ¶
func (id Id) ResourceInterface(rm meta.RESTMapper, client dynamic.Interface) (resource dynamic.ResourceInterface, err error)
ResourceInterface returns the dynamic resource interface for this id.
type Manifest ¶
type Manifest struct {
*unstructured.Unstructured
}
Manifest is a wrapper around *unstructured.Unstructured.
func Decode ¶
Decode converts a cue.Value into a Manifest or returns an error if the value is not compatible with a k8s object.
func Extract ¶
Extract extracts all Manifests recursively starting from every paths. Recursion is stopped on `ignore` cue.Attribute or when a Manifest has been decoded. That means nested Manifests are not possible.
func New ¶
func New(u *unstructured.Unstructured) Manifest
New creates a new Manifest from an *unstructured.Unstructured object.
func (Manifest) Delete ¶
func (m Manifest) Delete(ctx context.Context, konfig *utils.K8sConfig, opts utils.CommonMetaOptions) error
Delete deletes the Manifest from the cluster. If deletion policy is set to abandon, the resource is not deleted, but will be patched with an empty instance.
func (Manifest) GetDeletionPolicy ¶
GetDeletionPolicy returns the deletion policy of this Manifest.
func (Manifest) GetInstance ¶
GetInstance retrieve the instance this Manifest belongs to, or an empty string if not belonging to any instance.
func (Manifest) IsRemote ¶
IsRemote returns true if the manifest has an uuid set. TODO: this is weak, get rid of using that asap.
func (Manifest) Patch ¶
func (m Manifest) Patch(ctx context.Context, konfig *utils.K8sConfig, opts utils.CommonMetaOptions) (Manifest, error)
Patch does a server-side apply patch of the Manifest.
func (Manifest) WithDeletionPolicy ¶
WithDeletionPolicy sets the manifest deletion policy and returns the modified manifest.
func (Manifest) WithInstance ¶
WithInstance sets the manifest instance and returns the modified manifest.