2022-07-06 06:08:45 +00:00
< page-header
ng-if="$ctrl.state.viewReady"
title="'Create a namespace'"
breadcrumbs="[{ label:'Namespaces', link:'kubernetes.resourcePools' }, 'Create a namespace']"
reload="true"
>< / page-header >
2020-07-05 23:21:03 +00:00
2021-07-14 09:15:21 +00:00
< kubernetes-view-loading view-ready = "$ctrl.state.viewReady" > < / kubernetes-view-loading >
2020-07-05 23:21:03 +00:00
2021-07-14 09:15:21 +00:00
< div ng-if = "$ctrl.state.viewReady" >
2020-07-05 23:21:03 +00:00
< div class = "row" >
< div class = "col-lg-12 col-md-12 col-xs-12" >
< rd-widget >
< rd-widget-body >
< form class = "form-horizontal" autocomplete = "off" name = "resourcePoolCreationForm" >
2020-08-12 23:30:23 +00:00
<!-- #region NAME INPUT -->
2020-07-05 23:21:03 +00:00
< div class = "form-group" >
2022-08-01 04:45:28 +00:00
< label for = "pool_name" class = "col-sm-3 col-lg-2 control-label text-left required" > Name< / label >
< div class = "col-sm-8" >
2020-07-05 23:21:03 +00:00
< input
type="text"
class="form-control"
name="pool_name"
2021-07-14 09:15:21 +00:00
ng-model="$ctrl.formValues.Name"
2020-07-05 23:21:03 +00:00
ng-pattern="/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/"
2021-07-14 09:15:21 +00:00
ng-change="$ctrl.onChangeName()"
2020-07-05 23:21:03 +00:00
placeholder="my-project"
2021-08-26 00:05:28 +00:00
data-cy="k8sNamespaceCreate-namespaceNameInput"
2020-07-05 23:21:03 +00:00
required
auto-focus
/>
2022-08-01 04:45:28 +00:00
< span class = "help-block" >
< div class = "form-group" ng-show = "resourcePoolCreationForm.pool_name.$invalid || $ctrl.state.isAlreadyExist || $ctrl.state.hasPrefixKube" >
2022-09-14 23:09:19 +00:00
< div class = "col-sm-12 small text-warning" >
2022-08-01 04:45:28 +00:00
< div ng-messages = "resourcePoolCreationForm.pool_name.$error" >
< p class = "vertical-center" ng-message = "required" > < pr-icon icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > This field is required.< / p >
< p class = "vertical-center" ng-message = "pattern"
>< pr-icon icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > This field must consist of lower case alphanumeric characters or '-', and
contain at most 63 characters, and must start and end with an alphanumeric character.< /p
>
< / div >
< p class = "vertical-center" ng-if = "$ctrl.state.hasPrefixKube"
>< pr-icon icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > Prefix "kube-" is reserved for Kubernetes system namespaces.< /p
>
2022-08-22 20:55:41 +00:00
< p class = "vertical-center" ng-if = "$ctrl.state.isAlreadyExist" >
< pr-icon icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > A namespace with the same name already exists.
< / p >
2022-08-01 04:45:28 +00:00
< / div >
< / div >
< / span >
2020-07-05 23:21:03 +00:00
< / div >
< / div >
2022-08-01 04:45:28 +00:00
2020-08-12 23:30:23 +00:00
<!-- #endregion -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Quota < / div >
2020-08-12 23:30:23 +00:00
<!-- #region QUOTA -->
2020-07-05 23:21:03 +00:00
<!-- quotas - switch -->
< div class = "form-group" >
< div class = "col-sm-12 small text-muted" >
2022-08-01 04:45:28 +00:00
< p class = "vertical-center" >
< pr-icon class = "vertical-center" icon = "'info'" feather = "true" mode = "'primary'" > < / pr-icon >
2021-06-01 08:56:47 +00:00
A namespace segments the underlying physical Kubernetes cluster into smaller virtual clusters. You should assign a capped limit of resources to this namespace or
2020-07-05 23:21:03 +00:00
disable for the safe operation of your platform.
< / p >
< / div >
< div class = "col-sm-12" >
2022-08-01 04:45:28 +00:00
< por-switch-field
data-cy="'k8sNamespaceCreate-resourceAssignmentToggle'"
label="'Resource assignment'"
label-class="'col-sm-3 col-lg-2'"
name="'k8s-resourcepool-resourcequota'"
checked="$ctrl.formValues.HasQuota"
on-change="($ctrl.onToggleResourceQuota)"
>< / por-switch-field >
2020-07-05 23:21:03 +00:00
< / div >
< / div >
<!-- !quotas - switch -->
2021-07-14 09:15:21 +00:00
< div ng-if = "$ctrl.formValues.HasQuota" >
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Resource limits < / div >
2020-07-05 23:21:03 +00:00
< div >
2022-08-12 18:22:45 +00:00
< div class = "form-group" >
2022-09-14 23:09:19 +00:00
< span class = "col-sm-12 small text-warning" ng-switch on = "$ctrl.formValues.HasQuota && !$ctrl.isQuotaValid()" >
2022-08-12 18:22:45 +00:00
< p class = "vertical-center mb-0" ng-switch-when = "true"
2022-08-01 04:45:28 +00:00
>< pr-icon class = "vertical-center" icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > At least a single limit must be set for the quota to be
valid.
< / p >
2022-08-12 18:22:45 +00:00
< p class = "vertical-center mb-0" ng-switch-default > < / p >
2022-08-01 04:45:28 +00:00
< / span >
< / div >
2020-07-05 23:21:03 +00:00
<!-- memory - limit - input -->
2022-08-12 18:22:45 +00:00
< div class = "form-group flex flex-row !mb-0" >
< label for = "memory-limit" class = "col-sm-3 col-lg-2 control-label text-left" > Memory limit (MB) < / label >
< div class = "col-xs-6" >
2022-11-04 01:12:53 +00:00
< por-slider
min="$ctrl.defaults.MemoryLimit"
max="$ctrl.state.sliderMaxMemory"
2021-07-14 09:15:21 +00:00
step="128"
ng-if="$ctrl.state.sliderMaxMemory"
2022-11-04 01:12:53 +00:00
value="$ctrl.formValues.MemoryLimit"
on-change="($ctrl.handleMemoryLimitChange)"
visible-tooltip="true"
2021-08-26 00:05:28 +00:00
data-cy="k8sNamespaceCreate-memoryLimitSlider"
2022-11-04 01:12:53 +00:00
>< / por-slider >
2020-07-05 23:21:03 +00:00
< / div >
2022-11-04 01:12:53 +00:00
< div class = "col-sm-2 vertical-center pt-6" >
2020-07-05 23:21:03 +00:00
< input
name="memory_limit"
type="number"
2021-07-14 09:15:21 +00:00
min="{{ $ctrl.defaults.MemoryLimit }}"
max="{{ $ctrl.state.sliderMaxMemory }}"
2020-07-05 23:21:03 +00:00
class="form-control"
2021-07-14 09:15:21 +00:00
ng-model="$ctrl.formValues.MemoryLimit"
2020-07-05 23:21:03 +00:00
id="memory-limit"
2021-08-26 00:05:28 +00:00
data-cy="k8sNamespaceCreate-memoryLimitInput"
2020-07-05 23:21:03 +00:00
required
/>
2022-08-12 18:22:45 +00:00
< / div >
< / div >
< div class = "flex flex-row w-full" >
< span class = "col-sm-3 col-lg-2" > < / span >
< span class = "help-block col-sm-9 col-lg-10" >
< div ng-show = "resourcePoolCreationForm.memory_limit.$invalid" >
2022-09-14 23:09:19 +00:00
< div class = "small text-warning" >
2022-08-12 18:22:45 +00:00
< div ng-messages = "resourcePoolCreationForm.pool_name.$error" >
< p class = "vertical-center"
>< pr-icon class = "vertical-center" icon = "'alert-triangle'" feather = "true" mode = "'warning'" > < / pr-icon > Value must be between
{{ $ctrl.defaults.MemoryLimit }} and
{{ $ctrl.state.sliderMaxMemory }}
< / p >
2022-08-01 04:45:28 +00:00
< / div >
< / div >
2022-08-12 18:22:45 +00:00
< / div >
< / span >
2020-07-05 23:21:03 +00:00
< / div >
<!-- !memory - limit - input -->
<!-- cpu - limit - input -->
2022-08-12 18:22:45 +00:00
< div class = "form-group flex flex-row" >
< label for = "cpu-limit" class = "col-sm-3 col-lg-2 control-label text-left" > CPU limit < / label >
< div class = "col-xs-8" >
2022-11-04 01:12:53 +00:00
< por-slider
min="$ctrl.defaults.CpuLimit"
max="$ctrl.state.sliderMaxCpu"
2021-07-14 09:15:21 +00:00
step="0.1"
ng-if="$ctrl.state.sliderMaxCpu"
2022-11-04 01:12:53 +00:00
value="$ctrl.formValues.CpuLimit"
on-change="($ctrl.handleCpuLimitChange)"
2021-08-26 00:05:28 +00:00
data-cy="k8sNamespaceCreate-cpuLimitSlider"
2022-11-04 01:12:53 +00:00
visible-tooltip="true"
>< / por-slider >
2020-07-05 23:21:03 +00:00
< / div >
< / div >
<!-- !cpu - limit - input -->
< / div >
< / div >
2020-08-12 23:30:23 +00:00
<!-- #endregion -->
2020-12-14 01:31:59 +00:00
<!-- #region LOAD - BALANCERS -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Load balancers < / div >
2020-12-14 01:31:59 +00:00
< div class = "form-group" >
2022-08-01 04:45:28 +00:00
< span class = "col-sm-12 text-muted small vertical-center" >
2022-08-12 18:22:45 +00:00
< pr-icon icon = "'info'" feather = "true" mode = "'primary'" class = "vertical-center" > < / pr-icon >
2021-04-27 08:12:34 +00:00
You can set a quota on the amount of external load balancers that can be created inside this namespace. Set this quota to 0 to effectively disable the use of load
balancers in this namespace.
2020-12-14 01:31:59 +00:00
< / span >
< / div >
< div class = "form-group" >
< div class = "col-sm-12" >
2021-10-06 06:24:26 +00:00
< por-switch-field
2021-12-14 19:14:53 +00:00
data-cy="'k8sNamespaceCreate-loadBalancerQuotaToggle'"
label="'Load Balancer quota'"
2022-08-01 04:45:28 +00:00
label-class="'col-sm-3 col-lg-2'"
2021-12-14 19:14:53 +00:00
name="'k8s-resourcepool-lbquota'"
feature-id="$ctrl.LBQuotaFeatureId"
checked="$ctrl.formValues.UseLoadBalancersQuota"
on-change="($ctrl.onToggleLoadBalancerQuota)"
2021-10-06 06:24:26 +00:00
>< / por-switch-field >
2020-12-14 01:31:59 +00:00
< / div >
< / div >
<!-- #endregion -->
2022-09-26 19:43:24 +00:00
< div ng-if = "$ctrl.state.ingressAvailabilityPerNamespace" >
2020-08-20 00:51:14 +00:00
<!-- #region INGRESSES -->
2022-09-26 19:43:24 +00:00
< div class = "col-sm-12 form-section-title" > Networking < / div >
< ingress-class-datatable
ng-if="$ctrl.state.ingressAvailabilityPerNamespace"
2022-10-24 20:41:30 +00:00
on-change-controllers="($ctrl.onChangeIngressControllerAvailability)"
2022-09-26 19:43:24 +00:00
ingress-controllers="$ctrl.ingressControllers"
description="'Enable the ingress controllers that users can select when publishing applications in this namespace.'"
no-ingress-controller-label="'No ingress controllers found in the cluster. Go to the cluster setup view to configure and allow the use of ingress controllers in the cluster.'"
view="'namespace'"
>< / ingress-class-datatable >
2020-08-20 00:51:14 +00:00
<!-- #endregion -->
2020-08-12 23:30:23 +00:00
< / div >
2021-07-14 09:15:21 +00:00
<!-- #region REGISTRIES -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Registries < / div >
2021-07-14 09:15:21 +00:00
< div class = "form-group" >
< div class = "col-sm-12 small text-muted" >
2022-08-01 04:45:28 +00:00
< p class = "vertical-center" >
2022-08-12 18:22:45 +00:00
< pr-icon icon = "'info'" mode = "'primary'" feather = "true" > < / pr-icon >
2022-08-01 04:45:28 +00:00
Define which registries can be used by users who have access to this namespace.
2021-07-14 09:15:21 +00:00
< / p >
< / div >
< / div >
< div class = "form-group" >
2022-09-21 07:10:58 +00:00
< label class = "col-sm-3 col-lg-2 control-label text-left !pt-0" for = "registries-selector" > Select registries < / label >
2022-08-12 18:22:45 +00:00
< div class = "col-sm-8 col-lg-9" >
2021-07-14 09:15:21 +00:00
< span class = "small text-muted" ng-if = "!$ctrl.registries.length && $ctrl.state.isAdmin" >
2022-08-12 18:22:45 +00:00
No registries available. Head over to the < a ui-sref = "portainer.registries" > registry view< / a > to define a container registry.
2021-07-14 09:15:21 +00:00
< / span >
< span class = "small text-muted" ng-if = "!$ctrl.registries.length && !$ctrl.state.isAdmin" >
No registries available. Contact your administrator to create a container registry.
< / span >
2022-09-21 07:10:58 +00:00
< create-namespace-registries-selector
input-id="'registries-selector'"
value="$ctrl.formValues.Registries"
on-change="($ctrl.onRegistriesChange)"
options="$ctrl.registries"
2021-07-14 09:15:21 +00:00
>
2022-09-21 07:10:58 +00:00
< / create-namespace-registries-selector >
2021-07-14 09:15:21 +00:00
< / div >
< / div >
<!-- #endregion -->
2022-09-26 19:43:24 +00:00
<!-- #region STORAGES -->
< div class = "col-sm-12 form-section-title" > Storage < / div >
< div class = "form-group" >
< span class = "col-sm-12 text-muted small vertical-center" >
< pr-icon icon = "'info'" mode = "'primary'" feather = "true" > < / pr-icon >
Quotas can be set on each storage option to prevent users from exceeding a specific threshold when deploying applications. You can set a quota to 0 to effectively
prevent the usage of a specific storage option inside this namespace.
< / span >
< / div >
< div class = "col-sm-12 form-section-title vertical-center" >
< pr-icon icon = "'svg-route'" > < / pr-icon >
standard
< / div >
< storage-class-switch value = "sc.Selected" name = "sc.Name" on-change = "(ctrl.onToggleStorageQuota)" authorization = "K8sResourcePoolDetailsW" > < / storage-class-switch >
<!-- #endregion -->
2021-06-09 22:38:23 +00:00
<!-- summary -->
2021-07-14 09:15:21 +00:00
< kubernetes-summary-view ng-if = "resourcePoolCreationForm.$valid && !$ctrl.isCreateButtonDisabled()" form-values = "$ctrl.formValues" > < / kubernetes-summary-view >
2021-06-09 22:38:23 +00:00
<!-- !summary -->
2022-01-17 05:53:32 +00:00
< div class = "col-sm-12 form-section-title" > Actions < / div >
2020-08-12 23:30:23 +00:00
<!-- #region ACTIONS -->
2020-07-05 23:21:03 +00:00
< div class = "form-group" >
< div class = "col-sm-12" >
< button
type="button"
2022-08-01 04:45:28 +00:00
class="btn btn-primary btn-sm !ml-0"
2021-07-14 09:15:21 +00:00
ng-disabled="!resourcePoolCreationForm.$valid || $ctrl.isCreateButtonDisabled()"
ng-click="$ctrl.createResourcePool()"
button-spinner="$ctrl.state.actionInProgress"
2020-07-05 23:21:03 +00:00
>
2021-08-26 00:05:28 +00:00
< span ng-hide = "$ctrl.state.actionInProgress" data-cy = "k8sNamespace-createNamespaceButton" > Create namespace< / span >
2021-07-14 09:15:21 +00:00
< span ng-show = "$ctrl.state.actionInProgress" > Creation in progress...< / span >
2020-07-05 23:21:03 +00:00
< / button >
< / div >
< / div >
2020-08-12 23:30:23 +00:00
<!-- #endregion -->
2020-07-05 23:21:03 +00:00
< / form >
< / rd-widget-body >
< / rd-widget >
< / div >
< / div >
< / div >