client

package
v0.0.0-...-c34bea4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressFamilyIPv6 = "ipv6"
	AddressFamilyIPv4 = "ipv4"
)

Variables

View Source
var (
	// StatusAllDetails causes no additional status details to be printed by
	// FormatStatusResponse.
	StatusNoDetails = StatusDetails{}
	// StatusAllDetails causes all status details to be printed by FormatStatusResponse.
	StatusAllDetails = StatusDetails{
		AllAddresses:                true,
		AllControllers:              true,
		AllNodes:                    true,
		AllRedirects:                true,
		AllClusters:                 true,
		BPFMapDetails:               true,
		KubeProxyReplacementDetails: true,
		ClockSourceDetails:          true,
	}
)

Functions

func DefaultSockPath

func DefaultSockPath() string

DefaultSockPath returns default UNIX domain socket path or path set using CILIUM_SOCK env variable

func FormatStatusResponse

func FormatStatusResponse(w io.Writer, sr *models.StatusResponse, sd StatusDetails)

FormatStatusResponse writes a StatusResponse as a string to the writer. The bit mask sd controls whether a additional details are printed about a certain aspect of the status. In case there are errors, some details may be printed regardless of the value of sd.

func FormatStatusResponseBrief

func FormatStatusResponseBrief(w io.Writer, sr *models.StatusResponse)

FormatStatusResponseBrief writes a one-line status to the writer. If everything ok, this is "ok", otherwise a message of the form "error in ..."

func Hint

func Hint(err error) error

Hint tries to improve the error message displayed to the user.

Types

type Client

type Client struct {
	clientapi.CiliumAPI
}

func NewClient

func NewClient(host string) (*Client, error)

NewClient creates a client for the given `host`. If host is nil then use SockPath provided by CILIUM_SOCK or the cilium default SockPath

func NewDefaultClient

func NewDefaultClient() (*Client, error)

NewDefaultClient creates a client with default parameters connecting to UNIX domain socket.

func NewDefaultClientWithTimeout

func NewDefaultClientWithTimeout(timeout time.Duration) (*Client, error)

NewDefaultClientWithTimeout creates a client with default parameters connecting to UNIX domain socket and waits for cilium-agent availability.

func (*Client) ConfigGet

func (c *Client) ConfigGet() (*models.DaemonConfiguration, error)

ConfigGet returns a daemon configuration.

func (*Client) ConfigPatch

func (c *Client) ConfigPatch(cfg models.DaemonConfigurationSpec) error

ConfigPatch modifies the daemon configuration.

func (*Client) DeletePrefilter

func (c *Client) DeletePrefilter(spec *models.PrefilterSpec) (*models.Prefilter, error)

DeletePrefilter deletes a list of CIDR prefixes

func (*Client) DeleteRecorderID

func (c *Client) DeleteRecorderID(id int64) error

func (*Client) DeleteServiceID

func (c *Client) DeleteServiceID(id int64) error

DeleteServiceID deletes a service by ID.

func (*Client) EndpointConfigGet

func (c *Client) EndpointConfigGet(id string) (*models.EndpointConfigurationStatus, error)

EndpointConfigGet returns endpoint configuration

func (*Client) EndpointConfigPatch

func (c *Client) EndpointConfigPatch(id string, cfg *models.EndpointConfigurationSpec) error

EndpointConfigPatch modifies endpoint configuration

func (*Client) EndpointCreate

func (c *Client) EndpointCreate(ep *models.EndpointChangeRequest) error

EndpointCreate creates a new endpoint

func (*Client) EndpointDelete

func (c *Client) EndpointDelete(id string) error

EndpointDelete deletes endpoint

func (*Client) EndpointGet

func (c *Client) EndpointGet(id string) (*models.Endpoint, error)

EndpointGet returns endpoint by ID

func (*Client) EndpointHealthGet

func (c *Client) EndpointHealthGet(id string) (*models.EndpointHealth, error)

EndpointHealthGet returns endpoint healthz

func (*Client) EndpointLabelsGet

func (c *Client) EndpointLabelsGet(id string) (*models.LabelConfiguration, error)

EndpointLabelsGet returns endpoint label configuration

func (*Client) EndpointLabelsPatch

func (c *Client) EndpointLabelsPatch(id string, toAdd, toDelete models.Labels) error

EndpointLabelsPut modifies endpoint label configuration add: List of labels to add and enable. If the label is an orchestration system label which has been disabled before, it will be removed from the disabled list and readded to the orchestration list. Otherwise it will be added to the custom label list.

delete: List of labels to delete. If the label is an orchestration system label, then it will be deleted from the orchestration list and added to the disabled list. Otherwise it will be removed from the custom list.

func (*Client) EndpointList

func (c *Client) EndpointList() ([]*models.Endpoint, error)

EndpointList returns a list of all endpoints

func (*Client) EndpointLogGet

func (c *Client) EndpointLogGet(id string) (models.EndpointStatusLog, error)

EndpointLogGet returns endpoint log

func (*Client) EndpointPatch

func (c *Client) EndpointPatch(id string, ep *models.EndpointChangeRequest) error

EndpointPatch modifies the endpoint

func (*Client) GetLRPs

func (c *Client) GetLRPs() ([]*models.LRPSpec, error)

GetLRPs returns a list of all local redirect policies.

func (*Client) GetPrefilter

func (c *Client) GetPrefilter() (*models.Prefilter, error)

GetPrefilter returns a list of all CIDR prefixes

func (*Client) GetRecorder

func (c *Client) GetRecorder() ([]*models.Recorder, error)

func (*Client) GetRecorderID

func (c *Client) GetRecorderID(id int64) (*models.Recorder, error)

func (*Client) GetRecorderMasks

func (c *Client) GetRecorderMasks() ([]*models.RecorderMask, error)

func (*Client) GetServiceID

func (c *Client) GetServiceID(id int64) (*models.Service, error)

GetServiceID returns a service by ID.

func (*Client) GetServices

func (c *Client) GetServices() ([]*models.Service, error)

GetServices returns a list of all services.

func (*Client) IPAMAllocate

func (c *Client) IPAMAllocate(family, owner string, expiration bool) (*models.IPAMResponse, error)

IPAMAllocate allocates an IP address out of address family specific pool.

func (*Client) IPAMAllocateIP

func (c *Client) IPAMAllocateIP(ip, owner string) error

IPAMAllocateIP tries to allocate a particular IP address.

func (*Client) IPAMReleaseIP

func (c *Client) IPAMReleaseIP(ip string) error

IPAMReleaseIP releases a IP address back to the pool.

func (*Client) IdentityGet

func (c *Client) IdentityGet(id string) (*models.Identity, error)

IdentityGet returns a security identity.

func (*Client) PatchPrefilter

func (c *Client) PatchPrefilter(spec *models.PrefilterSpec) (*models.Prefilter, error)

PatchPrefilter sets a list of CIDR prefixes

func (*Client) PolicyCacheGet

func (c *Client) PolicyCacheGet() (models.SelectorCache, error)

PolicyCacheGet returns the contents of a SelectorCache.

func (*Client) PolicyDelete

func (c *Client) PolicyDelete(labels []string) (*models.Policy, error)

PolicyDelete deletes policy rules

func (*Client) PolicyGet

func (c *Client) PolicyGet(labels []string) (*models.Policy, error)

PolicyGet returns policy rules

func (*Client) PolicyPut

func (c *Client) PolicyPut(policyJSON string) (*models.Policy, error)

PolicyPut inserts the `policyJSON`

func (*Client) PolicyResolveGet

func (c *Client) PolicyResolveGet(traceSelector *models.TraceSelector) (*models.PolicyTraceResult, error)

PolicyResolveGet resolves policy for a Trace Selector with source and destination identity.

func (*Client) PutRecorderID

func (c *Client) PutRecorderID(id int64, rec *models.RecorderSpec) (bool, error)

func (*Client) PutServiceID

func (c *Client) PutServiceID(id int64, svc *models.ServiceSpec) (bool, error)

PutServiceID creates or updates a service. Returns true if service was created.

type StatusDetails

type StatusDetails struct {
	// AllAddress causes all addresses to be printed by FormatStatusResponse.
	AllAddresses bool
	// AllControllers causes all controllers to be printed by FormatStatusResponse.
	AllControllers bool
	// AllNodes causes all nodes to be printed by FormatStatusResponse.
	AllNodes bool
	// AllRedirects causes all redirects to be printed by FormatStatusResponse.
	AllRedirects bool
	// AllClusters causes all clusters to be printed by FormatStatusResponse.
	AllClusters bool
	// BPFMapDetails causes BPF map details to be printed by FormatStatusResponse.
	BPFMapDetails bool
	// KubeProxyReplacementDetails causes BPF kube-proxy details to be printed by FormatStatusResponse.
	KubeProxyReplacementDetails bool
	// ClockSourceDetails causes BPF time-keeping internals to be printed by FormatStatusResponse.
	ClockSourceDetails bool
}

Jump to

Keyboard shortcuts

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