Documentation
¶
Index ¶
- Variables
- func HandleErrorAndRemoveData(h *SidecarHandler, w http.ResponseWriter, s string, err error, ...)
- func SetDurationSpan(startTime int64, span trace.Span, opts ...SpanOption)
- type ContainerLogOpts
- type CreateStruct
- type DockerConfig
- type DockerRunStruct
- type InterLinkConfig
- type LogStruct
- type PodCreateRequests
- type PodStatus
- type RetrievedContainer
- type SidecarHandler
- func (h *SidecarHandler) CreateHandler(w http.ResponseWriter, r *http.Request)
- func (h *SidecarHandler) DeleteHandler(w http.ResponseWriter, r *http.Request)
- func (h *SidecarHandler) GetLogsHandler(w http.ResponseWriter, r *http.Request)
- func (h *SidecarHandler) StatusHandler(w http.ResponseWriter, r *http.Request)
- type SpanConfig
- type SpanOption
Constants ¶
This section is empty.
Variables ¶
var Clientset *kubernetes.Clientset
Functions ¶
func HandleErrorAndRemoveData ¶
func HandleErrorAndRemoveData(h *SidecarHandler, w http.ResponseWriter, s string, err error, podNamespace string, podUID string)
HandleErrorAndRemoveData reports the failure on the HTTP response and then reclaims everything provisioned for the pod. It may only be called from the request goroutine, before the response has been written; anything running after the handler returned must call cleanupPodData directly, because writing to a ResponseWriter after its handler returned races with the http server and can corrupt the next response on a keep-alive connection.
func SetDurationSpan ¶
func SetDurationSpan(startTime int64, span trace.Span, opts ...SpanOption)
Types ¶
type ContainerLogOpts ¶
type ContainerLogOpts struct {
Tail int `json:"Tail"`
LimitBytes int `json:"Bytes"`
Timestamps bool `json:"Timestamps"`
Follow bool `json:"Follow"`
Previous bool `json:"Previous"`
SinceSeconds int `json:"SinceSeconds"`
SinceTime time.Time `json:"SinceTime"`
}
ContainerLogOpts is a struct in which it is possible to specify options to retrieve logs from the sidecar
type CreateStruct ¶
type DockerConfig ¶
type DockerConfig struct {
VKConfigPath string `yaml:"VKConfigPath"`
Sidecarport string `yaml:"SidecarPort"`
Socket string `yaml:"Socket"`
ExportPodData bool `yaml:"ExportPodData"`
Commandprefix string `yaml:"CommandPrefix"`
ImagePrefix string `yaml:"ImagePrefix"`
DataRootFolder string `yaml:"DataRootFolder"`
Namespace string `yaml:"Namespace"`
Tsocks bool `yaml:"Tsocks"`
Tsockspath string `yaml:"TsocksPath"`
Tsockslogin string `yaml:"TsocksLoginNode"`
BashPath string `yaml:"BashPath"`
VerboseLogging bool `yaml:"VerboseLogging"`
ErrorsOnlyLogging bool `yaml:"ErrorsOnlyLogging"`
SingularityDefaultOptions []string `yaml:"SingularityDefaultOptions"`
SingularityPrefix string `yaml:"SingularityPrefix"`
SingularityPath string `yaml:"SingularityPath"`
EnableProbes bool `yaml:"EnableProbes"`
FPGAEnabled bool `yaml:"FPGAEnabled"`
XilinxToolsPath string `yaml:"XilinxToolsPath"`
VitisPath string `yaml:"VitisPath"`
XRTPath string `yaml:"XRTPath"`
DockerNetworkSubnet []string `yaml:"DockerNetworkSubnet"`
// contains filtered or unexported fields
}
var InterLinkConfigInst DockerConfig
func NewInterLinkConfig ¶
func NewInterLinkConfig() (DockerConfig, error)
NewInterLinkConfig returns a variable of type InterLinkConfig, used in many other functions and the first encountered error.
type DockerRunStruct ¶
type InterLinkConfig ¶
type InterLinkConfig struct {
VKConfigPath string `yaml:"VKConfigPath"`
VKTokenFile string `yaml:"VKTokenFile"`
Interlinkurl string `yaml:"InterlinkURL"`
Sidecarurl string `yaml:"SidecarURL"`
Sbatchpath string `yaml:"SbatchPath"`
Scancelpath string `yaml:"ScancelPath"`
Squeuepath string `yaml:"SqueuePath"`
Interlinkport string `yaml:"InterlinkPort"`
Socket string `yaml:"Socket"`
Sidecarport string `yaml:"SidecarPort"`
Commandprefix string `yaml:"CommandPrefix"`
ExportPodData bool `yaml:"ExportPodData"`
DataRootFolder string `yaml:"DataRootFolder"`
ServiceAccount string `yaml:"ServiceAccount"`
Namespace string `yaml:"Namespace"`
Tsocks bool `yaml:"Tsocks"`
Tsockspath string `yaml:"TsocksPath"`
Tsocksconfig string `yaml:"TsocksConfig"`
Tsockslogin string `yaml:"TsocksLoginNode"`
BashPath string `yaml:"BashPath"`
VerboseLogging bool `yaml:"VerboseLogging"`
ErrorsOnlyLogging bool `yaml:"ErrorsOnlyLogging"`
PodIP string `yaml:"PodIP"`
SingularityPrefix string `yaml:"SingularityPrefix"`
DockerNetworkSubnet []string `yaml:"DockerNetworkSubnet"`
// contains filtered or unexported fields
}
InterLinkConfig holds the whole configuration
type LogStruct ¶
type LogStruct struct {
Namespace string `json:"Namespace"`
PodUID string `json:"PodUID"`
PodName string `json:"PodName"`
ContainerName string `json:"ContainerName"`
Opts ContainerLogOpts `json:"Opts"`
}
LogStruct is needed to identify the job/container running on the sidecar to retrieve the logs from. Using ContainerLogOpts struct allows to specify more options on how to collect logs
type PodCreateRequests ¶
type PodCreateRequests struct {
Pod v1.Pod `json:"pod"`
ConfigMaps []v1.ConfigMap `json:"configmaps"`
Secrets []v1.Secret `json:"secrets"`
}
PodCreateRequests is a struct holding data for a create request. Retrieved ConfigMaps and Secrets are held along the Pod description itself.
type PodStatus ¶
type PodStatus struct {
PodName string `json:"name"`
PodUID string `json:"UID"`
PodNamespace string `json:"namespace"`
JobID string `json:"JID"`
Containers []v1.ContainerStatus `json:"containers"`
InitContainers []v1.ContainerStatus `json:"initContainers"`
}
PodStatus is a simplified v1.Pod struct, holding only necessary variables to uniquely identify a job/service in the sidecar. It is used to request
type RetrievedContainer ¶
type RetrievedContainer struct {
Name string `json:"name"`
ConfigMaps []v1.ConfigMap `json:"configMaps"`
Secrets []v1.Secret `json:"secrets"`
EmptyDirs []string `json:"emptyDirs"`
}
RetrievedContainer is used in InterLink to rearrange data structure in a suitable way for the sidecar
type SidecarHandler ¶
type SidecarHandler struct {
Config DockerConfig
Ctx context.Context
DindManager dindmanager.DindManagerInterface
FPGAManager fpgastrategies.FPGAManagerInterface
GpuManager gpustrategies.GPUManagerInterface
FinalDNSNameserver string
FinalDNSSearch string
}
func (*SidecarHandler) CreateHandler ¶
func (h *SidecarHandler) CreateHandler(w http.ResponseWriter, r *http.Request)
func (*SidecarHandler) DeleteHandler ¶
func (h *SidecarHandler) DeleteHandler(w http.ResponseWriter, r *http.Request)
DeleteHandler stops and deletes Docker containers from provided data
func (*SidecarHandler) GetLogsHandler ¶
func (h *SidecarHandler) GetLogsHandler(w http.ResponseWriter, r *http.Request)
GetLogsHandler performs a Docker logs command and returns its manipulated output
func (*SidecarHandler) StatusHandler ¶
func (h *SidecarHandler) StatusHandler(w http.ResponseWriter, r *http.Request)
StatusHandler checks Docker Container's status by running docker ps -af command and returns that status
type SpanConfig ¶
type SpanOption ¶
type SpanOption func(*SpanConfig)
func WithHTTPReturnCode ¶
func WithHTTPReturnCode(code int) SpanOption