Create and update a k8s service for each processing with expose model
This commit is contained in:
40
models/services.go
Normal file
40
models/services.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package models
|
||||
|
||||
|
||||
type ServiceResource struct {
|
||||
Action string `yaml:"action,omitempty"`
|
||||
SuccessCondition string `yaml:"successCondition,omitempty"`
|
||||
FailureCondition string `yaml:"failureCondition,omitempty"`
|
||||
SetOwnerReference bool `yaml:"setOwnerReference,omitempty"`
|
||||
Manifest string `yaml:"manifest,omitempty"`
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
APIVersion string `yaml:"apiVersion"`
|
||||
Kind string `yaml:"kind"`
|
||||
Metadata Metadata `yaml:"metadata"`
|
||||
Spec ServiceSpec `yaml:"spec"`
|
||||
}
|
||||
|
||||
type Metadata struct {
|
||||
Name string `yaml:"name"`
|
||||
|
||||
}
|
||||
|
||||
// ServiceSpec is the specification of the Kubernetes Service
|
||||
type ServiceSpec struct {
|
||||
Selector map[string]string `yaml:"selector,omitempty"`
|
||||
Ports []ServicePort `yaml:"ports"`
|
||||
ClusterIP string `yaml:"clusterIP,omitempty"`
|
||||
Type string `yaml:"type,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePort defines a port for a Kubernetes Service
|
||||
type ServicePort struct {
|
||||
Name string `yaml:"name"` // Even if empty need to be in the yaml
|
||||
|
||||
Protocol string `yaml:"protocol,omitempty"`
|
||||
Port int64 `yaml:"port"`
|
||||
TargetPort int64 `yaml:"targetPort,omitempty"`
|
||||
NodePort int64 `yaml:"nodePort,omitempty"`
|
||||
}
|
@@ -30,6 +30,10 @@ type Dag struct {
|
||||
Tasks []Task `yaml:"tasks,omitempty"`
|
||||
}
|
||||
|
||||
type TemplateMetadata struct {
|
||||
Labels map[string]string `yaml:"labels,omitempty"`
|
||||
}
|
||||
|
||||
type Template struct {
|
||||
Name string `yaml:"name"`
|
||||
Inputs struct {
|
||||
@@ -37,4 +41,6 @@ type Template struct {
|
||||
} `yaml:"inputs,omitempty"`
|
||||
Container Container `yaml:"container,omitempty"`
|
||||
Dag Dag `yaml:"dag,omitempty"`
|
||||
Metadata TemplateMetadata `yaml:"metadata,omitempty"`
|
||||
Resource ServiceResource `yaml:"resource,omitempty"`
|
||||
}
|
||||
|
8
models/translate_ports.go
Normal file
8
models/translate_ports.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package models
|
||||
|
||||
type PortTranslation map[string]PortConfig
|
||||
|
||||
type PortConfig struct {
|
||||
Reverse string `json:"reverse,omitempty"`
|
||||
PAT string `json:"PAT,omitempty"`
|
||||
}
|
Reference in New Issue
Block a user