From f396592d2e1163b33a22838f03f948ca96607cd8 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 9 Mar 2020 12:24:01 +0800 Subject: [PATCH] opslog: notes use text column --- pkg/cloudcommon/db/opslog.go | 2 +- pkg/mcclient/options/k8s/cluster.go | 30 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pkg/cloudcommon/db/opslog.go b/pkg/cloudcommon/db/opslog.go index 48147308a7..a54aeba099 100644 --- a/pkg/cloudcommon/db/opslog.go +++ b/pkg/cloudcommon/db/opslog.go @@ -276,7 +276,7 @@ type SOpsLog struct { ObjId string `width:"128" charset:"ascii" nullable:"false" list:"user" create:"required" index:"true"` // = Column(VARCHAR(ID_LENGTH, charset='ascii'), nullable=False) ObjName string `width:"128" charset:"utf8" nullable:"false" list:"user" create:"required"` //= Column(VARCHAR(128, charset='utf8'), nullable=False) Action string `width:"32" charset:"utf8" nullable:"false" list:"user" create:"required"` //= Column(VARCHAR(32, charset='ascii'), nullable=False) - Notes string `width:"2048" charset:"utf8" list:"user" create:"required"` // = Column(VARCHAR(2048, charset='utf8')) + Notes string `charset:"utf8" list:"user" create:"required"` ProjectId string `name:"tenant_id" width:"128" charset:"ascii" list:"user" create:"required" index:"true"` // = Column(VARCHAR(ID_LENGTH, charset='ascii')) Project string `name:"tenant" width:"128" charset:"utf8" list:"user" create:"required"` // tenant = Column(VARCHAR(128, charset='utf8')) diff --git a/pkg/mcclient/options/k8s/cluster.go b/pkg/mcclient/options/k8s/cluster.go index 61809fd642..fef26570e6 100644 --- a/pkg/mcclient/options/k8s/cluster.go +++ b/pkg/mcclient/options/k8s/cluster.go @@ -47,16 +47,18 @@ type AddMachineOptions struct { } type KubeClusterCreateOptions struct { - NAME string `help:"Name of cluster"` - ClusterType string `help:"Cluster cluster type" choices:"default|serverless"` - ResourceType string `help:"Cluster cluster type" choices:"host|guest"` - CloudType string `help:"Cluster cloud type" choices:"private|public|hybrid"` - Mode string `help:"Cluster mode type" choices:"customize|managed|import"` - Provider string `help:"Cluster provider" choices:"onecloud|aws|aliyun|azure|qcloud|system"` - ServiceCidr string `help:"Cluster service CIDR, e.g. 10.43.0.0/16"` - ServiceDomain string `help:"Cluster service domain, e.g. cluster.local"` - Vip string `help:"Cluster api server static loadbalancer vip"` - Version string `help:"Cluster kubernetes version"` + NAME string `help:"Name of cluster"` + ClusterType string `help:"Cluster cluster type" choices:"default|serverless"` + ResourceType string `help:"Cluster cluster type" choices:"host|guest"` + CloudType string `help:"Cluster cloud type" choices:"private|public|hybrid"` + Mode string `help:"Cluster mode type" choices:"customize|managed|import"` + Provider string `help:"Cluster provider" choices:"onecloud|aws|aliyun|azure|qcloud|system"` + ServiceCidr string `help:"Cluster service CIDR, e.g. 10.43.0.0/16"` + ServiceDomain string `help:"Cluster service domain, e.g. cluster.local"` + Vip string `help:"Cluster api server static loadbalancer vip"` + Version string `help:"Cluster kubernetes version"` + ImageRepo string `help:"Image repository, e.g. registry-1.docker.io/yunion"` + ImageRepoInsecure bool `help:"Image repostiory is insecure"` AddMachineOptions } @@ -136,11 +138,19 @@ func (o KubeClusterCreateOptions) Params() (*jsonutils.JSONDict, error) { if o.Vip != "" { params.Add(jsonutils.NewString(o.Vip), "vip") } + imageRepo := jsonutils.NewDict() + if o.ImageRepo != "" { + imageRepo.Add(jsonutils.NewString(o.ImageRepo), "url") + } + if o.ImageRepoInsecure { + imageRepo.Add(jsonutils.JSONTrue, "insecure") + } machineObjs, err := o.AddMachineOptions.Params() if err != nil { return nil, err } params.Add(machineObjs, "machines") + params.Add(imageRepo, "image_repository") return params, nil }