mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
feat: add docker_image and docker_tag to cluster api
Signed-off-by: allanice001 <allanice001@gmail.com>
This commit is contained in:
@@ -189,6 +189,8 @@ func CreateCluster(db *gorm.DB) http.HandlerFunc {
|
||||
LastError: "",
|
||||
CertificateKey: certificateKey,
|
||||
RandomToken: randomToken,
|
||||
DockerImage: in.DockerImage,
|
||||
DockerTag: in.DockerTag,
|
||||
}
|
||||
|
||||
if err := db.Create(&c).Error; err != nil {
|
||||
@@ -262,6 +264,14 @@ func UpdateCluster(db *gorm.DB) http.HandlerFunc {
|
||||
cluster.Region = *in.Region
|
||||
}
|
||||
|
||||
if in.DockerImage != nil {
|
||||
cluster.DockerImage = *in.DockerImage
|
||||
}
|
||||
|
||||
if in.DockerTag != nil {
|
||||
cluster.DockerTag = *in.DockerTag
|
||||
}
|
||||
|
||||
if err := db.Save(&cluster).Error; err != nil {
|
||||
utils.WriteError(w, http.StatusInternalServerError, "db_error", "db error")
|
||||
return
|
||||
@@ -1547,6 +1557,8 @@ func clusterToDTO(c models.Cluster) dto.ClusterResponse {
|
||||
RandomToken: c.RandomToken,
|
||||
CertificateKey: c.CertificateKey,
|
||||
NodePools: nps,
|
||||
DockerImage: c.DockerImage,
|
||||
DockerTag: c.DockerTag,
|
||||
CreatedAt: c.CreatedAt,
|
||||
UpdatedAt: c.UpdatedAt,
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ type ClusterResponse struct {
|
||||
RandomToken string `json:"random_token"`
|
||||
CertificateKey string `json:"certificate_key"`
|
||||
NodePools []NodePoolResponse `json:"node_pools,omitempty"`
|
||||
DockerImage string `json:"docker_image"`
|
||||
DockerTag string `json:"docker_tag"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
@@ -30,12 +32,16 @@ type CreateClusterRequest struct {
|
||||
Name string `json:"name"`
|
||||
ClusterProvider string `json:"cluster_provider"`
|
||||
Region string `json:"region"`
|
||||
DockerImage string `json:"docker_image"`
|
||||
DockerTag string `json:"docker_tag"`
|
||||
}
|
||||
|
||||
type UpdateClusterRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
ClusterProvider *string `json:"cluster_provider,omitempty"`
|
||||
Region *string `json:"region,omitempty"`
|
||||
DockerImage *string `json:"docker_image,omitempty"`
|
||||
DockerTag *string `json:"docker_tag,omitempty"`
|
||||
}
|
||||
|
||||
type AttachCaptainDomainRequest struct {
|
||||
|
||||
@@ -40,6 +40,8 @@ type Cluster struct {
|
||||
EncryptedKubeconfig string `gorm:"type:text" json:"-"`
|
||||
KubeIV string `json:"-"`
|
||||
KubeTag string `json:"-"`
|
||||
DockerImage string `json:"docker_image"`
|
||||
DockerTag string `json:"docker_tag"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" gorm:"type:timestamptz;column:created_at;not null;default:now()"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty" gorm:"type:timestamptz;autoUpdateTime;column:updated_at;not null;default:now()"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user