mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
fix(namespace): create ns qa feedback [EE-2226] (#10474)
This commit is contained in:
parent
bcb3f918d1
commit
07ec2ffe5e
11 changed files with 34 additions and 43 deletions
|
@ -11,6 +11,7 @@ type K8sNamespaceDetails struct {
|
|||
Name string `json:"Name"`
|
||||
Annotations map[string]string `json:"Annotations"`
|
||||
ResourceQuota *K8sResourceQuota `json:"ResourceQuota"`
|
||||
Owner string `json:"Owner"`
|
||||
}
|
||||
|
||||
type K8sResourceQuota struct {
|
||||
|
|
|
@ -63,15 +63,21 @@ func (kcl *KubeClient) GetNamespace(name string) (portainer.K8sNamespaceInfo, er
|
|||
|
||||
// CreateNamespace creates a new ingress in a given namespace in a k8s endpoint.
|
||||
func (kcl *KubeClient) CreateNamespace(info models.K8sNamespaceDetails) error {
|
||||
portainerLabels := map[string]string{
|
||||
"io.portainer.kubernetes.resourcepool.name": info.Name,
|
||||
"io.portainer.kubernetes.resourcepool.owner": info.Owner,
|
||||
}
|
||||
|
||||
var ns v1.Namespace
|
||||
ns.Name = info.Name
|
||||
ns.Annotations = info.Annotations
|
||||
ns.Labels = portainerLabels
|
||||
|
||||
resourceQuota := &v1.ResourceQuota{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "portainer-rq-" + info.Name,
|
||||
Namespace: info.Name,
|
||||
Labels: portainerLabels,
|
||||
},
|
||||
Spec: v1.ResourceQuotaSpec{
|
||||
Hard: v1.ResourceList{},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue