mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 18:58:02 +08:00
[REV] change get common labels method
This commit is contained in:
parent
b98e089c83
commit
55fa1801f0
@ -134,11 +134,9 @@ func initBaseStatefulSet(as *v1.AppService, service *dbmodel.TenantServices) {
|
||||
stateful.Namespace = service.TenantID
|
||||
stateful.Name = service.ServiceAlias
|
||||
stateful.GenerateName = service.ServiceAlias
|
||||
stateful.Labels = getCommonLable(stateful.Labels, map[string]string{
|
||||
"name": service.ServiceAlias,
|
||||
"version": service.DeployVersion,
|
||||
"service_id": service.ServiceID,
|
||||
"creater_id": as.CreaterID,
|
||||
stateful.Labels = as.GetCommonLables(stateful.Labels, map[string]string{
|
||||
"name": service.ServiceAlias,
|
||||
"version": service.DeployVersion,
|
||||
})
|
||||
as.SetStatefulSet(stateful)
|
||||
}
|
||||
@ -157,11 +155,9 @@ func initBaseDeployment(as *v1.AppService, service *dbmodel.TenantServices) {
|
||||
deployment.Namespace = service.TenantID
|
||||
deployment.Name = util.NewUUID()
|
||||
deployment.GenerateName = strings.Replace(service.ServiceAlias, "_", "-", -1)
|
||||
deployment.Labels = getCommonLable(deployment.Labels, map[string]string{
|
||||
"name": service.ServiceAlias,
|
||||
"version": service.DeployVersion,
|
||||
"service_id": service.ServiceID,
|
||||
"creater_id": as.CreaterID,
|
||||
deployment.Labels = as.GetCommonLables(deployment.Labels, map[string]string{
|
||||
"name": service.ServiceAlias,
|
||||
"version": service.DeployVersion,
|
||||
})
|
||||
as.SetDeployment(deployment)
|
||||
}
|
||||
|
@ -56,11 +56,9 @@ func TenantServiceVersion(as *v1.AppService, dbmanager db.Manager) error {
|
||||
}
|
||||
podtmpSpec := corev1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: getCommonLable(map[string]string{
|
||||
"name": as.ServiceAlias,
|
||||
"version": as.DeployVersion,
|
||||
"service_id": as.ServiceID,
|
||||
"creater_id": as.CreaterID,
|
||||
Labels: as.GetCommonLables(map[string]string{
|
||||
"name": as.ServiceAlias,
|
||||
"version": as.DeployVersion,
|
||||
}),
|
||||
Annotations: createPodAnnotations(as),
|
||||
},
|
||||
|
@ -16,9 +16,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package conversion
|
||||
package v1
|
||||
|
||||
func getCommonLable(labels ...map[string]string) map[string]string {
|
||||
//GetCommonLables get common lables
|
||||
func (a *AppService) GetCommonLables(labels ...map[string]string) map[string]string {
|
||||
var resultLabel = make(map[string]string)
|
||||
for _, l := range labels {
|
||||
for k, v := range l {
|
||||
@ -26,5 +27,7 @@ func getCommonLable(labels ...map[string]string) map[string]string {
|
||||
}
|
||||
}
|
||||
resultLabel["creater"] = "Rainbond"
|
||||
resultLabel["creater_id"] = a.CreaterID
|
||||
resultLabel["service_id"] = a.ServiceID
|
||||
return resultLabel
|
||||
}
|
Loading…
Reference in New Issue
Block a user