crd

package
v0.0.0-...-873615e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 118

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertObject

func ConvertObject(schema resource.Schema, object IstioObject, domain string) (*config.Config, error)

ConvertObject converts an IstioObject k8s-style object to the internal configuration model.

func ConvertObjectInternal

func ConvertObjectInternal(schema resource.Schema, object IstioObject, domain string, convert ConversionFunc) (*config.Config, error)

func FromJSON

func FromJSON(s resource.Schema, js string) (config.Spec, error)

FromJSON converts a canonical JSON to a proto message

func FromJSONMap

func FromJSONMap(s resource.Schema, data any) (config.Spec, error)

FromJSONMap converts from a generic map to a proto message using canonical JSON encoding JSON encoding is specified here: https://developers.google.com/protocol-buffers/docs/proto3#json

func FromJSONStrict

func FromJSONStrict(s resource.Schema, js string) (config.Spec, error)

func FromYAML

func FromYAML(s resource.Schema, yml string) (config.Spec, error)

FromYAML converts a canonical YAML to a proto message

func StatusJSONFromMap

func StatusJSONFromMap(schema resource.Schema, jsonMap *json.RawMessage) (config.Status, error)

Types

type ConversionFunc

type ConversionFunc = func(s resource.Schema, js string) (config.Spec, error)

type IstioKind

type IstioKind struct {
	metav1.TypeMeta
	metav1.ObjectMeta `json:"metadata"`
	Spec              json.RawMessage  `json:"spec"`
	Status            *json.RawMessage `json:"status,omitempty"`
}

IstioKind is the generic Kubernetes API object wrapper

func ParseInputs

func ParseInputs(inputs string) ([]config.Config, []IstioKind, error)

ParseInputs reads multiple documents from `kubectl` output and checks with the schema. It also returns the list of unrecognized kinds as the second response.

NOTE: This function only decodes a subset of the complete k8s ObjectMeta as identified by the fields in model.Meta. This would typically only be a problem if a user dumps an configuration object with kubectl and then re-ingests it.

func (*IstioKind) DeepCopy

func (in *IstioKind) DeepCopy() *IstioKind

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioKind.

func (*IstioKind) DeepCopyInto

func (in *IstioKind) DeepCopyInto(out *IstioKind)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*IstioKind) DeepCopyObject

func (in *IstioKind) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*IstioKind) GetObjectMeta

func (in *IstioKind) GetObjectMeta() metav1.ObjectMeta

GetObjectMeta from a wrapper

func (*IstioKind) GetSpec

func (in *IstioKind) GetSpec() json.RawMessage

GetSpec from a wrapper

func (*IstioKind) GetStatus

func (in *IstioKind) GetStatus() *json.RawMessage

GetStatus from a wrapper

type IstioObject

type IstioObject interface {
	runtime.Object
	GetSpec() json.RawMessage
	GetStatus() *json.RawMessage
	GetObjectMeta() metav1.ObjectMeta
}

IstioObject is a k8s wrapper interface for config objects

func ConvertConfig

func ConvertConfig(cfg config.Config) (IstioObject, error)

ConvertConfig translates Istio config to k8s config JSON

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL