Help us shape the future of Go! Take the 2026 Go Developer Survey

platform

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package platform is the controller's client for the platform internal API (/internal/v1/*). It authenticates with the controller's own ServiceAccount token, re-read from the in-cluster token file on every request because the kubelet rotates it.

Index

Constants

View Source
const DefaultTokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token"

DefaultTokenFile is the in-cluster ServiceAccount token.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports a 404 from the platform.

Types

type API

type API interface {
	Sync(ctx context.Context, req runtimeapi.SyncRequest) (*runtimeapi.SyncResponse, error)
	Runtime(ctx context.Context, orgID string) (*runtimeapi.RuntimeResponse, error)
	Verify(ctx context.Context, orgID string) (*runtimeapi.VerifyResponse, error)
	Fence(ctx context.Context, seatID string, expectedGeneration int64) error
	StartProbe(ctx context.Context, seatID string) (*runtimeapi.ProbeResponse, error)
	GetProbe(ctx context.Context, seatID, probeID string) (*runtimeapi.ProbeResponse, error)
	// DeleteOrganization revokes the organisation's capabilities and retires
	// its seats. With retention "retain" durable rows are kept (A19).
	DeleteOrganization(ctx context.Context, orgID, retention string) error
}

API is the subset of the internal API the controller uses.

type Client

type Client struct {
	BaseURL   string
	TokenFile string
	HTTP      *http.Client
}

Client implements API over HTTP.

func New

func New(baseURL, tokenFile string) *Client

New returns a client for baseURL. An empty tokenFile sends no credentials (tests only).

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(ctx context.Context, orgID, retention string) error

func (*Client) Fence

func (c *Client) Fence(ctx context.Context, seatID string, gen int64) error

func (*Client) GetProbe

func (c *Client) GetProbe(ctx context.Context, seatID, probeID string) (*runtimeapi.ProbeResponse, error)

func (*Client) Runtime

func (c *Client) Runtime(ctx context.Context, orgID string) (*runtimeapi.RuntimeResponse, error)

func (*Client) StartProbe

func (c *Client) StartProbe(ctx context.Context, seatID string) (*runtimeapi.ProbeResponse, error)

func (*Client) Sync

func (*Client) TaskRunAction added in v0.6.0

func (c *Client) TaskRunAction(ctx context.Context, seatID, id, action string) error

func (*Client) TaskRuns added in v0.6.0

func (c *Client) TaskRuns(ctx context.Context, seatID string) ([]runtimeapi.TaskRun, error)

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, orgID string) (*runtimeapi.VerifyResponse, error)

type Error

type Error struct {
	Status  int
	Code    string
	Message string
}

Error is a non-2xx response.

func (*Error) Error

func (e *Error) Error() string

type TaskRunsAPI added in v0.6.0

type TaskRunsAPI interface {
	TaskRuns(context.Context, string) ([]runtimeapi.TaskRun, error)
	TaskRunAction(context.Context, string, string, string) error
}

TaskRunsAPI is optional for older controller API implementations.

Jump to

Keyboard shortcuts

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