TenantManager_impl_k8s_anywhere #47
@ -21,8 +21,7 @@ impl TenantManager for K8sTenantManager {
 | 
				
			|||||||
                "metadata": {
 | 
					                "metadata": {
 | 
				
			||||||
                    "labels": {
 | 
					                    "labels": {
 | 
				
			||||||
                        "harmony.nationtech.io/tenant.id": config.id,
 | 
					                        "harmony.nationtech.io/tenant.id": config.id,
 | 
				
			||||||
                        "name": config.name,
 | 
					                        "harmony.nationtech.io/tenant.name": config.name,
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                "name": config.name,
 | 
					                "name": config.name,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
@ -32,7 +31,6 @@ impl TenantManager for K8sTenantManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let namespace: Namespace = serde_json::from_value(namespace).unwrap();
 | 
					        let namespace: Namespace = serde_json::from_value(namespace).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        let resource_quota = json!(
 | 
					        let resource_quota = json!(
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
           "apiVersion": "v1",
 | 
					           "apiVersion": "v1",
 | 
				
			||||||
@ -42,21 +40,20 @@ impl TenantManager for K8sTenantManager {
 | 
				
			|||||||
               "apiVersion": "v1",
 | 
					               "apiVersion": "v1",
 | 
				
			||||||
               "kind": "ResourceQuota",
 | 
					               "kind": "ResourceQuota",
 | 
				
			||||||
               "metadata": {
 | 
					               "metadata": {
 | 
				
			||||||
                    "name": config.name
 | 
					                 "name": config.name,
 | 
				
			||||||
 | 
					                 "labels": {
 | 
				
			||||||
 | 
					                  "harmony.nationtech.io/tenant.id": config.id,
 | 
				
			||||||
 | 
					                  "harmony.nationtech.io/tenant.name": config.name,
 | 
				
			||||||
 | 
					                 },
 | 
				
			||||||
 | 
					                 "namespace": config.name,
 | 
				
			||||||
               },
 | 
					               },
 | 
				
			||||||
               "spec": {
 | 
					               "spec": {
 | 
				
			||||||
                 "hard": {
 | 
					                 "hard": {
 | 
				
			||||||
                      "cpu": config.resource_limits.cpu_limit_cores,
 | 
					                   "limits.cpu": format!("{:.0}",config.resource_limits.cpu_limit_cores),
 | 
				
			||||||
                      "memory": format!("{:.3}Gi", config.resource_limits.memory_limit_gb),
 | 
					                   "limits.memory": format!("{:.3}Gi", config.resource_limits.memory_limit_gb),
 | 
				
			||||||
                    },
 | 
					                   "requests.cpu": format!("{:.0}",config.resource_limits.cpu_request_cores),
 | 
				
			||||||
                    "scopeSelector": {
 | 
					                   "requests.memory": format!("{:.3}Gi", config.resource_limits.memory_request_gb),
 | 
				
			||||||
                      "matchExpressions": [
 | 
					                   "requests.storage": format!("{:.3}", config.resource_limits.storage_total_gb)
 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                          "operator": "In",
 | 
					 | 
				
			||||||
                          "scopeName": "PriorityClass",
 | 
					 | 
				
			||||||
                          "values": ["high"]
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                      ]
 | 
					 | 
				
			||||||
                 }
 | 
					                 }
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
             }
 | 
					             }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user