mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
fix showing namespaces for standard user (#7917)
This commit is contained in:
parent
446febb0f6
commit
a550bfaedb
6 changed files with 77 additions and 7 deletions
|
@ -44,6 +44,21 @@ func (kcl *KubeClient) GetNamespaces() (map[string]portainer.K8sNamespaceInfo, e
|
|||
return results, nil
|
||||
}
|
||||
|
||||
// GetNamespace gets the namespace in the current k8s environment(endpoint).
|
||||
func (kcl *KubeClient) GetNamespace(name string) (portainer.K8sNamespaceInfo, error) {
|
||||
namespace, err := kcl.cli.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return portainer.K8sNamespaceInfo{}, err
|
||||
}
|
||||
|
||||
result := portainer.K8sNamespaceInfo{
|
||||
IsSystem: isSystemNamespace(*namespace),
|
||||
IsDefault: namespace.Name == defaultNamespace,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CreateIngress creates a new ingress in a given namespace in a k8s endpoint.
|
||||
func (kcl *KubeClient) CreateNamespace(info models.K8sNamespaceDetails) error {
|
||||
client := kcl.cli.CoreV1().Namespaces()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue