Documentation ¶
Overview ¶
Package crd provides an implementation of the config store and cache using Kubernetes Custom Resources and the informer framework from Kubernetes
Index ¶
- Variables
- func CamelCaseToKabobCase(s string) string
- func ConvertObject(schema model.ProtoSchema, object IstioObject, domain string) (*model.Config, error)
- func CreateRESTConfig(kubeconfig string) (config *rest.Config, err error)
- func KabobCaseToCamelCase(s string) string
- func NewController(client *Client, options kube.ControllerOptions) model.ConfigStoreCache
- func ResourceName(s string) string
- type Client
- func (cl *Client) ConfigDescriptor() model.ConfigDescriptor
- func (cl *Client) Create(config model.Config) (string, error)
- func (cl *Client) Delete(typ, name, namespace string) error
- func (cl *Client) DeregisterResources() error
- func (cl *Client) Get(typ, name, namespace string) (*model.Config, bool)
- func (cl *Client) List(typ, namespace string) ([]model.Config, error)
- func (cl *Client) RegisterResources() error
- func (cl *Client) Update(config model.Config) (string, error)
- type IstioKind
- func (in *IstioKind) DeepCopy() *IstioKind
- func (in *IstioKind) DeepCopyInto(out *IstioKind)
- func (in *IstioKind) DeepCopyObject() runtime.Object
- func (in *IstioKind) GetObjectMeta() meta_v1.ObjectMeta
- func (in *IstioKind) GetSpec() map[string]interface{}
- func (in *IstioKind) SetObjectMeta(metadata meta_v1.ObjectMeta)
- func (in *IstioKind) SetSpec(spec map[string]interface{})
- type IstioKindList
- type IstioObject
- type IstioObjectList
Constants ¶
This section is empty.
Variables ¶
var IstioAPIGroupVersion = schema.GroupVersion{ Group: model.IstioAPIGroup, Version: model.IstioAPIVersion, }
IstioAPIGroupVersion defines schema.GroupVersion for Istio configuration resources.
Functions ¶
func CamelCaseToKabobCase ¶
CamelCaseToKabobCase converts "MyName" to "my-name"
func ConvertObject ¶
func ConvertObject(schema model.ProtoSchema, object IstioObject, domain string) (*model.Config, error)
ConvertObject converts an IstioObject k8s-style object to the internal configuration model.
func CreateRESTConfig ¶
CreateRESTConfig for cluster API server, pass empty config file for in-cluster
func KabobCaseToCamelCase ¶
KabobCaseToCamelCase converts "my-name" to "MyName"
func NewController ¶
func NewController(client *Client, options kube.ControllerOptions) model.ConfigStoreCache
NewController creates a new Kubernetes controller for CRDs Use "" for namespace to listen for all namespace changes
func ResourceName ¶
ResourceName converts "my-name" to "myname". This is needed by k8s API server as dashes prevent kubectl from accessing CRDs
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a basic REST client for CRDs implementing config store
func NewClient ¶
func NewClient(config string, descriptor model.ConfigDescriptor, domainSuffix string) (*Client, error)
NewClient creates a client to Kubernetes API using a kubeconfig file. Use an empty value for `kubeconfig` to use the in-cluster config. If the kubeconfig file is empty, defaults to in-cluster config as well.
func (*Client) ConfigDescriptor ¶
func (cl *Client) ConfigDescriptor() model.ConfigDescriptor
ConfigDescriptor for the store
func (*Client) DeregisterResources ¶
DeregisterResources removes third party resources
func (*Client) RegisterResources ¶
RegisterResources sends a request to create CRDs and waits for them to initialize
type IstioKind ¶
type IstioKind struct { meta_v1.TypeMeta `json:",inline"` meta_v1.ObjectMeta `json:"metadata"` Spec map[string]interface{} `json:"spec"` }
IstioKind is the generic Kubernetes API object wrapper
func ParseInputs ¶
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.ConfigMeta. This would typically only be a problem if a user dumps an configuration object with kubectl and then re-ingests it.
func (*IstioKind) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioKind.
func (*IstioKind) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IstioKind) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*IstioKind) GetObjectMeta ¶
func (in *IstioKind) GetObjectMeta() meta_v1.ObjectMeta
GetObjectMeta from a wrapper
func (*IstioKind) SetObjectMeta ¶
func (in *IstioKind) SetObjectMeta(metadata meta_v1.ObjectMeta)
SetObjectMeta for a wrapper
type IstioKindList ¶
type IstioKindList struct { meta_v1.TypeMeta `json:",inline"` meta_v1.ListMeta `json:"metadata"` Items []IstioKind `json:"items"` }
IstioKindList is the generic Kubernetes API list wrapper
func (*IstioKindList) DeepCopy ¶
func (in *IstioKindList) DeepCopy() *IstioKindList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioKindList.
func (*IstioKindList) DeepCopyInto ¶
func (in *IstioKindList) DeepCopyInto(out *IstioKindList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IstioKindList) DeepCopyObject ¶
func (in *IstioKindList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*IstioKindList) GetItems ¶
func (in *IstioKindList) GetItems() []IstioObject
GetItems from a wrapper
type IstioObject ¶
type IstioObject interface { runtime.Object GetSpec() map[string]interface{} SetSpec(map[string]interface{}) GetObjectMeta() meta_v1.ObjectMeta SetObjectMeta(meta_v1.ObjectMeta) }
IstioObject is a k8s wrapper interface for config objects
func ConvertConfig ¶
func ConvertConfig(schema model.ProtoSchema, config model.Config) (IstioObject, error)
ConvertConfig translates Istio config to k8s config JSON
type IstioObjectList ¶
type IstioObjectList interface { runtime.Object GetItems() []IstioObject }
IstioObjectList is a k8s wrapper interface for config lists