Documentation
¶
Overview ¶
Package eks emulates Amazon EKS (REST-JSON). With a container engine every cluster is a real Kubernetes API server, a k3s container that checks bearer tokens the way EKS does, so `aws eks update-kubeconfig` and kubectl work unchanged. Node groups, Fargate profiles, add-ons, access entries, identity provider configs and pod identity associations are metadata.
Index ¶
- func DefaultImage() string
- func Versions() (all []string, def string)
- type K3s
- type Service
- func (s *Service) Close() error
- func (s *Service) Info() core.Info
- func (s *Service) Inspect(_, id string) any
- func (s *Service) Kubeconfig(name string) (string, error)
- func (s *Service) Load(b []byte) error
- func (s *Service) Reset()
- func (s *Service) Resources() []core.Table
- func (s *Service) Save() ([]byte, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultImage ¶
func DefaultImage() string
DefaultImage is the k3s image of EKS's default Kubernetes version, which GKE and AKS run too.
Types ¶
type K3s ¶
type K3s struct {
Name string // container name
Image string // rancher/k3s:<tag>; docker.images["<Service>.k3s"] overrides it
Service string // pogi.service label
Resource string // pogi.resource label
Token string // k3s server token
Webhook string // URL of a TokenReview webhook that authenticates bearer tokens; empty: none
Args []string // more k3s server flags
// Watch and OnExit, when both are set, report a container that stops on its own after Run succeeded: OnExit gets
// a plain sentence ("killed: out of memory…", "stopped: exit 1 — …"). Watch ends the watching; the Run context
// ends when Run returns, so it is not that one.
Watch context.Context
OnExit func(note string)
}
K3s is a Kubernetes cluster in one privileged k3s container, its API server published on a random 127.0.0.1 port. EKS runs one per cluster; GKE and AKS can run theirs the same way.
func (*K3s) Run ¶
func (k *K3s) Run(ctx context.Context, d *docker.Client, restart bool) (endpoint string, ca []byte, err error)
Run starts the cluster, a fresh container or (restart) the one it already has, and waits until its node is Ready and its API server answers on the published port. It returns the API server's URL and the PEM of the CA its certificate chains to.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the EKS emulator.
func (*Service) Close ¶
Close stops k3s work and removes the clusters' containers, unless state is persisted: the next run starts them again.
func (*Service) Inspect ¶
Inspect returns a cluster with its parts and pogi's side: its container and pogiNote (never its k3s token).
func (*Service) Kubeconfig ¶ added in v0.2.0
Kubeconfig is a kubeconfig for the cluster of that name. kubectl gets its token by running `aws eks get-token`, with the test credentials of pogi's root user (the ones in `pogi env`). It answers 404 for an unknown cluster and 409 for one that is not ACTIVE with an API server yet.
func (*Service) Load ¶
Load restores state. Clusters that ran on k3s start their containers again (persisted state leaves them behind on shutdown), or turn FAILED when the engine or the container is gone.