api

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.4.0

type API struct {
	Config            *cfg.Config
	Framework         *cfg.FrameworkConfig
	Mesos             mesos.Mesos
	Redis             *redis.Redis
	Kubernetes        *controller.Controller
	BootstrapProtocol string
	K3SAgentStatus    bool
}

API Service include all the current vars and global config

func New added in v0.4.0

func New(cfg *cfg.Config, frm *cfg.FrameworkConfig) *API

New will create a new API object

func (*API) AgentRestart added in v0.4.1

func (e *API) AgentRestart()

AgentRestart will scale down all K8 agents and scale up again.

func (*API) CheckAuth added in v0.4.0

func (e *API) CheckAuth(r *http.Request, w http.ResponseWriter) bool

CheckAuth will check if the token is valid

func (*API) ClusterRestart added in v0.4.1

func (e *API) ClusterRestart(ds bool)

ClusterRestart will scale down all K8 instances and scale up again.

func (*API) Commands added in v0.4.0

func (e *API) Commands() *mux.Router

Commands is the main function of this package

func (*API) ErrorMessage added in v0.4.0

func (e *API) ErrorMessage(number int, function string, msg string) []byte

ErrorMessage will create a message json

func (*API) GetTaskIDFromAnnotation added in v0.4.1

func (e *API) GetTaskIDFromAnnotation(annotations map[string]string) string

GetTaskIDFromAnnotation will return the Mesos Task ID in the annotation string

func (*API) GetTaskIDFromLabel added in v0.4.1

func (e *API) GetTaskIDFromLabel(labels map[string]string) string

GetTaskIDFromLabel will return the Mesos Task ID in the label string

func (*API) NotFound added in v0.4.1

func (e *API) NotFound(w http.ResponseWriter, r *http.Request)

NotFound logs filenotfound messages

func (*API) ServerRestart added in v0.4.1

func (e *API) ServerRestart()

Server will scale down all K8 servers & agents instances and scale up again.

func (*API) V0AdjustClusterResources added in v0.4.1

func (e *API) V0AdjustClusterResources(w http.ResponseWriter, r *http.Request)

V0AdjustClusterResources will adjust the resource allocated to the k3s clusters example: curl -X GET http://user:password@127.0.0.1:10000/v0/agent/memory/{value} -d 'JSON'

func (*API) V0CapabilitiesDisclosure added in v0.4.1

func (e *API) V0CapabilitiesDisclosure(w http.ResponseWriter, r *http.Request)

V0CapabilitiesDisclosure gives out the current capabilities supported in this m3s framework version. Helpful when you may have multiple versions running in your environment and need feature flagging on downstream applications. example: curl -X GET 127.0.0.1:10000/v0/capabilities

func (*API) V0ClusterShutdown added in v0.4.1

func (e *API) V0ClusterShutdown(w http.ResponseWriter, r *http.Request)

V0ClusterShutdown - Shutdown the whole K8 cluster example: curl -X PUT 127.0.0.1:10000/v0/cluster/shutdown'

func (*API) V0ClusterStart added in v0.4.1

func (e *API) V0ClusterStart(w http.ResponseWriter, r *http.Request)

V0ClusterStart - Start the cluster after shutdown example: curl -X PUT 127.0.0.1:10000/v0/cluster/start

func (*API) V0GetCountK3SAgent added in v0.4.0

func (e *API) V0GetCountK3SAgent(w http.ResponseWriter, r *http.Request)

V0GetCountK3SAgent will write out the current count of Kubernetes Agents and the expected one. example: curl -X GET http://user:password@127.0.0.1:10000/v0/agent/scale'

func (*API) V0GetCountK3SServer added in v0.4.0

func (e *API) V0GetCountK3SServer(w http.ResponseWriter, r *http.Request)

V0GetCountK3SServer will write out the current count of Kubernetes server and the expected one. example: curl -X GET http://user:password@127.0.0.1:10000/v0/server/scale'

func (*API) V0GetKubeVersion added in v0.4.0

func (e *API) V0GetKubeVersion(w http.ResponseWriter, r *http.Request)

V0GetKubeVersion will return the kubernetes Version example: curl -X GET 127.0.0.1:10000/v0/server/version'

func (*API) V0GetKubeconfig added in v0.4.0

func (e *API) V0GetKubeconfig(w http.ResponseWriter, r *http.Request)

V0GetKubeconfig will return the kubernetes config file example: curl -X GET 127.0.0.1:10000/api/m3s/v0/server/config"

func (*API) V0Restart added in v0.4.1

func (e *API) V0Restart(w http.ResponseWriter, r *http.Request)

V0Restart - Restart cluster or datastore, server or agent. example: curl -X PUT 127.0.0.1:10000/v0/cluster/restart

func (*API) V0ScaleDatastore added in v0.4.0

func (e *API) V0ScaleDatastore(w http.ResponseWriter, r *http.Request)

V0ScaleDatastore will scale the k3s agent service example: curl -X GET http://user:password@127.0.0.1:10000/v0/etcd/scale/{count of instances} -d 'JSON'

func (*API) V0ScaleK3SAgent added in v0.4.0

func (e *API) V0ScaleK3SAgent(w http.ResponseWriter, r *http.Request)

V0ScaleK3SAgent will scale the k3s agent service example: curl -X GET http://user:password@127.0.0.1:10000/v0/agent/scale/{count of instances} -d 'JSON'

func (*API) V0ScaleK3SServer added in v0.4.0

func (e *API) V0ScaleK3SServer(w http.ResponseWriter, r *http.Request)

V0ScaleK3SServer will scale the k3s server service example: curl -X GET http://user:password@127.0.0.1:10000/v0/server/scale/{count of instances} -d 'JSON'

func (*API) V0StatusK8s added in v0.4.0

func (e *API) V0StatusK8s(w http.ResponseWriter, r *http.Request)

V0StatusK8s gives out the current status of the K8s services example: curl -X GET 127.0.0.1:10000/v0/status/k8s

func (*API) V0StatusM3s added in v0.4.0

func (e *API) V0StatusM3s(w http.ResponseWriter, r *http.Request)

V0StatusM3s gives out the current status of the M3s services example: curl -X GET 127.0.0.1:10000/v0/status/m3s

func (*API) Versions added in v0.4.0

func (e *API) Versions(w http.ResponseWriter, r *http.Request)

Versions give out a list of Versions

Jump to

Keyboard shortcuts

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