fix(cluster): fix cluster setup no ingress develop EE-4352 (#7776)

* fix(cluster) update cluster wo controllers EE-4352

* fix(ing): stop errors in ns EE-4352
pull/7742/head
Ali 2 years ago committed by GitHub
parent 7d8b037761
commit 1722257d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,6 +15,7 @@ export const componentsModule = angular
'onChangeAvailability',
'description',
'ingressControllers',
'isLoading',
'noIngressControllerLabel',
'view',
])

@ -44,6 +44,7 @@
<ingress-class-datatable
on-change-availability="(ctrl.onChangeAvailability)"
ingress-controllers="ctrl.originalIngressControllers"
is-loading="ctrl.isIngressControllersLoading"
description="'Enabling ingress controllers in your cluster allows them to be available in the Portainer UI for users to publish applications over HTTP/HTTPS. A controller must have a class name for it to be included here.'"
no-ingress-controller-label="'No supported ingress controllers found.'"
view="'cluster'"

@ -198,7 +198,7 @@ class KubernetesConfigureController {
this.assignFormValuesToEndpoint(this.endpoint, storageClasses, ingressClasses);
await this.EndpointService.updateEndpoint(this.endpoint.Id, this.endpoint);
// updateIngressControllerClassMap must be done after updateEndpoint, as a hacky workaround. A better solution: saving ingresscontrollers somewhere else, is being discussed
await updateIngressControllerClassMap(this.state.endpointId, this.ingressControllers);
await updateIngressControllerClassMap(this.state.endpointId, this.ingressControllers || []);
this.state.isSaving = true;
const storagePromises = _.map(storageClasses, (storageClass) => {
const oldStorageClass = _.find(this.oldStorageClasses, { Name: storageClass.Name });
@ -224,19 +224,7 @@ class KubernetesConfigureController {
}
configure() {
const toDel = _.filter(this.formValues.IngressClasses, { NeedsDeletion: true });
if (toDel.length) {
this.ModalService.confirmUpdate(
`Removing ingress controllers may cause applications to be unaccessible. All ingress configurations from affected applications will be removed.<br/><br/>Do you wish to continue?`,
(confirmed) => {
if (confirmed) {
return this.$async(this.configureAsync);
}
}
);
} else {
return this.$async(this.configureAsync);
}
return this.$async(this.configureAsync);
}
/* #endregion */
@ -292,6 +280,7 @@ class KubernetesConfigureController {
IngressAvailabilityPerNamespace: false,
};
this.isIngressControllersLoading = true;
try {
this.availableAccessModes = new KubernetesStorageClassAccessPolicies();
@ -332,6 +321,7 @@ class KubernetesConfigureController {
this.Notifications.error('Failure', err, 'Unable to retrieve environment configuration');
} finally {
this.state.viewReady = true;
this.isIngressControllersLoading = false;
}
window.addEventListener('beforeunload', this.onBeforeOnload);

@ -109,7 +109,7 @@ class KubernetesCreateResourcePoolController {
this.checkDefaults();
this.formValues.Owner = this.Authentication.getUserDetails().username;
await this.KubernetesResourcePoolService.create(this.formValues);
await updateIngressControllerClassMap(this.endpoint.Id, this.ingressControllers, this.formValues.Name);
await updateIngressControllerClassMap(this.endpoint.Id, this.ingressControllers || [], this.formValues.Name);
this.Notifications.success('Namespace successfully created', this.formValues.Name);
this.$state.go('kubernetes.resourcePools');
} catch (err) {

@ -144,7 +144,7 @@ class KubernetesResourcePoolController {
try {
this.checkDefaults();
await this.KubernetesResourcePoolService.patch(oldFormValues, newFormValues);
await updateIngressControllerClassMap(this.endpoint.Id, this.ingressControllers, this.formValues.Name);
await updateIngressControllerClassMap(this.endpoint.Id, this.ingressControllers || [], this.formValues.Name);
this.Notifications.success('Namespace successfully updated', this.pool.Namespace.Name);
this.$state.reload(this.$state.current);
} catch (err) {

@ -19,6 +19,7 @@ interface Props {
) => void; // angular function to save the ingress class list
description: string;
ingressControllers: IngressControllerClassMap[] | undefined;
isLoading: boolean;
noIngressControllerLabel: string;
view: string;
}
@ -27,6 +28,7 @@ export function IngressClassDatatable({
onChangeAvailability,
description,
ingressControllers,
isLoading,
noIngressControllerLabel,
view,
}: Props) {
@ -42,7 +44,7 @@ export function IngressClassDatatable({
storageKey="ingressClasses"
columns={columns}
settingsStore={settings}
isLoading={!ingControllerFormValues}
isLoading={isLoading}
emptyContentLabel={noIngressControllerLabel}
titleOptions={{
icon: 'database',

Loading…
Cancel
Save