- Add K8s module with kubeconfig storage in cluster_config table - Implement resource list APIs for 8 kinds: namespace, deployment, statefulset, service, configmap, pod, pv, pvc - Add K8sResourceList page with sidebar navigation and resource tables - Support YAML upload/input dialog for resource creation via dynamic client - Add kubeconfig settings drawer - Increase main content width from lg to xl for better table display - Add navigation link for cluster resources in top bar 🤖 Generated with [Qoder][https://qoder.com]
93 lines
3.4 KiB
Go
93 lines
3.4 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Repository ????
|
|
type Repository struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Name string `gorm:"uniqueIndex;not null" json:"name"` // ?????? "library/nginx"
|
|
}
|
|
|
|
// Blob blob ??
|
|
type Blob struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Digest string `gorm:"uniqueIndex;not null" json:"digest"` // SHA256 digest
|
|
Size int64 `gorm:"not null" json:"size"` // ??????
|
|
MediaType string `json:"media_type"` // ????
|
|
Repository string `gorm:"index" json:"repository"` // ???????????????
|
|
}
|
|
|
|
// Manifest manifest ??
|
|
type Manifest struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Repository string `gorm:"index;not null" json:"repository"` // ????
|
|
Tag string `gorm:"index;not null" json:"tag"` // tag ??
|
|
Digest string `gorm:"uniqueIndex;not null" json:"digest"` // manifest digest
|
|
MediaType string `json:"media_type"` // ????
|
|
Size int64 `gorm:"not null" json:"size"` // manifest ??
|
|
Content []byte `gorm:"type:blob" json:"-"` // manifest ???JSON?
|
|
}
|
|
|
|
// Tag tag ??????????
|
|
type Tag struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Repository string `gorm:"index;not null" json:"repository"` // ????
|
|
Tag string `gorm:"index;not null" json:"tag"` // tag ??
|
|
Digest string `gorm:"not null" json:"digest"` // ??? manifest digest
|
|
}
|
|
|
|
// BlobUpload ????? blob ??
|
|
type BlobUpload struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
UUID string `gorm:"uniqueIndex;not null" json:"uuid"` // ???? UUID
|
|
Repository string `gorm:"index;not null" json:"repository"` // ????
|
|
Path string `gorm:"not null" json:"path"` // ??????
|
|
Size int64 `gorm:"default:0" json:"size"` // ?????
|
|
}
|
|
|
|
// RegistryConfig registry ?????
|
|
type RegistryConfig struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Key string `gorm:"uniqueIndex;not null" json:"key"` // ???? key
|
|
Value string `gorm:"type:text" json:"value"` // ???? value
|
|
}
|
|
|
|
// ClusterConfig k8s cluster configuration
|
|
type ClusterConfig struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
Key string `gorm:"uniqueIndex;not null" json:"key"`
|
|
Value string `gorm:"type:text" json:"value"`
|
|
}
|