Documentation ¶
Index ¶
- Constants
- func NewFakeDiscoveryClient(registeredResources []schema.GroupVersionResource) *fakeDiscoveryClient
- type Client
- func (c *Client) CreateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
- func (c *Client) DeleteResource(apiVersion string, kind string, namespace string, name string, dryRun bool) error
- func (c *Client) GetCSRInterface() (csrtype.CertificateSigningRequestInterface, error)
- func (c *Client) GetDynamicInterface() dynamic.Interface
- func (c *Client) GetEventsInterface() (event.EventInterface, error)
- func (c *Client) GetResource(apiVersion string, kind string, namespace string, name string, ...) (*unstructured.Unstructured, error)
- func (c *Client) GetTLSCertProps(configuration *rest.Config) (certProps tls.CertificateProps, err error)
- func (c *Client) InitTLSPemPair(configuration *rest.Config, serverIP string) (*tls.PemPair, error)
- func (c *Client) ListResource(apiVersion string, kind string, namespace string, ...) (*unstructured.UnstructuredList, error)
- func (c *Client) NewDynamicSharedInformerFactory(defaultResync time.Duration) dynamicinformer.DynamicSharedInformerFactory
- func (c *Client) PatchResource(apiVersion string, kind string, namespace string, name string, patch []byte) (*unstructured.Unstructured, error)
- func (c *Client) ReadRootCASecret() (result []byte)
- func (c *Client) ReadTLSPair(props tls.CertificateProps) *tls.PemPair
- func (c *Client) SetDiscovery(discoveryClient IDiscovery)
- func (c *Client) UpdateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
- func (c *Client) UpdateStatusResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
- func (c *Client) WriteCACertToSecret(caPEM *tls.PemPair, props tls.CertificateProps) error
- func (c *Client) WriteTLSPairToSecret(props tls.CertificateProps, pemPair *tls.PemPair) error
- type IDiscovery
- type ServerPreferredResources
- func (c ServerPreferredResources) DiscoveryCache() discovery.CachedDiscoveryInterface
- func (c ServerPreferredResources) FindResource(apiVersion string, kind string) (*meta.APIResource, schema.GroupVersionResource, error)
- func (c ServerPreferredResources) GetGVRFromAPIVersionKind(apiVersion string, kind string) schema.GroupVersionResource
- func (c ServerPreferredResources) GetGVRFromKind(kind string) (schema.GroupVersionResource, error)
- func (c ServerPreferredResources) GetServerVersion() (*version.Info, error)
- func (c ServerPreferredResources) OpenAPISchema() (*openapiv2.Document, error)
- func (c ServerPreferredResources) Poll(resync time.Duration, stopCh <-chan struct{})
Constants ¶
const ( // CSRs CertificateSigningRequest CSRs string = "CertificateSigningRequest" // Secrets Secret Secrets string = "Secret" // ConfigMaps ConfigMap ConfigMaps string = "ConfigMap" // Namespaces Namespace Namespaces string = "Namespace" )
Variables ¶
This section is empty.
Functions ¶
func NewFakeDiscoveryClient ¶ added in v0.4.0
func NewFakeDiscoveryClient(registeredResources []schema.GroupVersionResource) *fakeDiscoveryClient
NewFakeDiscoveryClient returns a fakediscovery client
Types ¶
type Client ¶
type Client struct { DiscoveryClient IDiscovery // contains filtered or unexported fields }
Client enables interaction with k8 resource
func NewClient ¶
func NewClient(config *rest.Config, resync time.Duration, stopCh <-chan struct{}, log logr.Logger) (*Client, error)
NewClient creates new instance of client
func NewMockClient ¶ added in v0.4.0
func NewMockClient(scheme *runtime.Scheme, gvrToListKind map[schema.GroupVersionResource]string, objects ...runtime.Object) (*Client, error)
NewMockClient ---testing utilities
func (*Client) CreateResource ¶
func (c *Client) CreateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
CreateResource creates object for the specified resource/namespace
func (*Client) DeleteResource ¶ added in v1.1.0
func (c *Client) DeleteResource(apiVersion string, kind string, namespace string, name string, dryRun bool) error
DeleteResource deletes the specified resource
func (*Client) GetCSRInterface ¶
func (c *Client) GetCSRInterface() (csrtype.CertificateSigningRequestInterface, error)
GetCSRInterface provides type interface for CSR
func (*Client) GetDynamicInterface ¶ added in v1.2.0
GetDynamicInterface fetches underlying dynamic interface
func (*Client) GetEventsInterface ¶
func (c *Client) GetEventsInterface() (event.EventInterface, error)
GetEventsInterface provides typed interface for events TODO: can we use dynamic client to fetch the typed interface or generate a kube client value to access the interface
func (*Client) GetResource ¶
func (c *Client) GetResource(apiVersion string, kind string, namespace string, name string, subresources ...string) (*unstructured.Unstructured, error)
GetResource returns the resource in unstructured/json format
func (*Client) GetTLSCertProps ¶
func (c *Client) GetTLSCertProps(configuration *rest.Config) (certProps tls.CertificateProps, err error)
GetTLSCertProps provides the TLS Certificate Properties
func (*Client) InitTLSPemPair ¶ added in v1.1.0
InitTLSPemPair Loads or creates PEM private key and TLS certificate for webhook server. Created pair is stored in cluster's secret. Returns struct with key/certificate pair.
func (*Client) ListResource ¶
func (c *Client) ListResource(apiVersion string, kind string, namespace string, lselector *meta.LabelSelector) (*unstructured.UnstructuredList, error)
ListResource returns the list of resources in unstructured/json format Access items using []Items
func (*Client) NewDynamicSharedInformerFactory ¶ added in v1.1.0
func (c *Client) NewDynamicSharedInformerFactory(defaultResync time.Duration) dynamicinformer.DynamicSharedInformerFactory
NewDynamicSharedInformerFactory returns a new instance of DynamicSharedInformerFactory
func (*Client) PatchResource ¶ added in v0.6.0
func (c *Client) PatchResource(apiVersion string, kind string, namespace string, name string, patch []byte) (*unstructured.Unstructured, error)
PatchResource patches the resource
func (*Client) ReadRootCASecret ¶
ReadRootCASecret returns the RootCA from the pre-defined secret
func (*Client) ReadTLSPair ¶ added in v1.3.0
func (c *Client) ReadTLSPair(props tls.CertificateProps) *tls.PemPair
ReadTLSPair Reads the pair of TLS certificate and key from the specified secret.
func (*Client) SetDiscovery ¶ added in v0.4.0
func (c *Client) SetDiscovery(discoveryClient IDiscovery)
SetDiscovery sets the discovery client implementation
func (*Client) UpdateResource ¶
func (c *Client) UpdateResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
UpdateResource updates object for the specified resource/namespace
func (*Client) UpdateStatusResource ¶
func (c *Client) UpdateStatusResource(apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
UpdateStatusResource updates the resource "status" subresource
func (*Client) WriteCACertToSecret ¶ added in v1.2.0
WriteCACertToSecret stores the CA cert in secret
func (*Client) WriteTLSPairToSecret ¶ added in v1.3.0
WriteTLSPairToSecret Writes the pair of TLS certificate and key to the specified secret. Updates existing secret or creates new one.
type IDiscovery ¶ added in v0.4.0
type IDiscovery interface { FindResource(apiVersion string, kind string) (*meta.APIResource, schema.GroupVersionResource, error) GetGVRFromKind(kind string) (schema.GroupVersionResource, error) GetGVRFromAPIVersionKind(apiVersion string, kind string) schema.GroupVersionResource GetServerVersion() (*version.Info, error) OpenAPISchema() (*openapiv2.Document, error) DiscoveryCache() discovery.CachedDiscoveryInterface }
IDiscovery provides interface to mange Kind and GVR mapping
type ServerPreferredResources ¶ added in v0.4.0
type ServerPreferredResources struct {
// contains filtered or unexported fields
}
ServerPreferredResources stores the cachedClient instance for discovery client
func (ServerPreferredResources) DiscoveryCache ¶ added in v1.3.2
func (c ServerPreferredResources) DiscoveryCache() discovery.CachedDiscoveryInterface
DiscoveryCache gets the discovery client cache
func (ServerPreferredResources) FindResource ¶ added in v1.2.0
func (c ServerPreferredResources) FindResource(apiVersion string, kind string) (*meta.APIResource, schema.GroupVersionResource, error)
FindResource finds an API resource that matches 'kind'. If the resource is not found and the Cache is not fresh, the cache is invalidated and a retry is attempted
func (ServerPreferredResources) GetGVRFromAPIVersionKind ¶ added in v1.2.0
func (c ServerPreferredResources) GetGVRFromAPIVersionKind(apiVersion string, kind string) schema.GroupVersionResource
GetGVRFromAPIVersionKind get the Group Version Resource from APIVersion and kind
func (ServerPreferredResources) GetGVRFromKind ¶ added in v0.5.0
func (c ServerPreferredResources) GetGVRFromKind(kind string) (schema.GroupVersionResource, error)
GetGVRFromKind get the Group Version Resource from kind
func (ServerPreferredResources) GetServerVersion ¶ added in v1.2.0
func (c ServerPreferredResources) GetServerVersion() (*version.Info, error)
GetServerVersion returns the server version of the cluster
func (ServerPreferredResources) OpenAPISchema ¶ added in v1.2.0
func (c ServerPreferredResources) OpenAPISchema() (*openapiv2.Document, error)
OpenAPISchema returns the API server OpenAPI schema document
func (ServerPreferredResources) Poll ¶ added in v1.1.0
func (c ServerPreferredResources) Poll(resync time.Duration, stopCh <-chan struct{})
Poll will keep invalidate the local cache