fix(k8s/applications): fix an issue with daemonset in 0/0 state (#4288)

pull/4289/head
Anthony Lapenna 2020-08-31 17:21:25 +12:00 committed by GitHub
parent 8dac2df7bf
commit 9300603777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

View File

@ -130,10 +130,10 @@
</td> </td>
</tr> </tr>
<tr ng-if="!$ctrl.dataset"> <tr ng-if="!$ctrl.dataset">
<td colspan="6" class="text-center text-muted">Loading...</td> <td colspan="7" class="text-center text-muted">Loading...</td>
</tr> </tr>
<tr ng-if="$ctrl.state.filteredDataSet.length === 0"> <tr ng-if="$ctrl.state.filteredDataSet.length === 0">
<td colspan="6" class="text-center text-muted">No pod available.</td> <td colspan="7" class="text-center text-muted">No pod available.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -3,14 +3,14 @@ import { KubernetesPortMapping, KubernetesPortMappingPort } from 'Kubernetes/mod
import { KubernetesServiceTypes } from 'Kubernetes/models/service/models'; import { KubernetesServiceTypes } from 'Kubernetes/models/service/models';
import { KubernetesConfigurationTypes } from 'Kubernetes/models/configuration/models'; import { KubernetesConfigurationTypes } from 'Kubernetes/models/configuration/models';
import { import {
KubernetesApplicationConfigurationFormValueOverridenKeyTypes, KubernetesApplicationAutoScalerFormValue,
KubernetesApplicationEnvironmentVariableFormValue,
KubernetesApplicationConfigurationFormValue, KubernetesApplicationConfigurationFormValue,
KubernetesApplicationConfigurationFormValueOverridenKey, KubernetesApplicationConfigurationFormValueOverridenKey,
KubernetesApplicationConfigurationFormValueOverridenKeyTypes,
KubernetesApplicationEnvironmentVariableFormValue,
KubernetesApplicationPersistedFolderFormValue, KubernetesApplicationPersistedFolderFormValue,
KubernetesApplicationPublishedPortFormValue,
KubernetesApplicationAutoScalerFormValue,
KubernetesApplicationPlacementFormValue, KubernetesApplicationPlacementFormValue,
KubernetesApplicationPublishedPortFormValue,
} from 'Kubernetes/models/application/formValues'; } from 'Kubernetes/models/application/formValues';
import { import {
KubernetesApplicationEnvConfigMapPayload, KubernetesApplicationEnvConfigMapPayload,
@ -23,13 +23,13 @@ import {
KubernetesApplicationVolumeSecretPayload, KubernetesApplicationVolumeSecretPayload,
} from 'Kubernetes/models/application/payloads'; } from 'Kubernetes/models/application/payloads';
import KubernetesVolumeHelper from 'Kubernetes/helpers/volumeHelper'; import KubernetesVolumeHelper from 'Kubernetes/helpers/volumeHelper';
import { KubernetesApplicationPlacementTypes, KubernetesApplicationDeploymentTypes } from 'Kubernetes/models/application/models'; import { KubernetesApplicationDeploymentTypes, KubernetesApplicationPlacementTypes } from 'Kubernetes/models/application/models';
import { KubernetesPodNodeAffinityNodeSelectorRequirementOperators, KubernetesPodAffinity } from 'Kubernetes/pod/models'; import { KubernetesPodAffinity, KubernetesPodNodeAffinityNodeSelectorRequirementOperators } from 'Kubernetes/pod/models';
import { import {
KubernetesNodeSelectorTermPayload,
KubernetesPreferredSchedulingTermPayload,
KubernetesPodNodeAffinityPayload,
KubernetesNodeSelectorRequirementPayload, KubernetesNodeSelectorRequirementPayload,
KubernetesNodeSelectorTermPayload,
KubernetesPodNodeAffinityPayload,
KubernetesPreferredSchedulingTermPayload,
} from 'Kubernetes/pod/payloads/affinities'; } from 'Kubernetes/pod/payloads/affinities';
class KubernetesApplicationHelper { class KubernetesApplicationHelper {
@ -65,7 +65,7 @@ class KubernetesApplicationHelper {
} }
static associateContainersAndApplication(app) { static associateContainersAndApplication(app) {
if (!app.Pods) { if (!app.Pods || app.Pods.length === 0) {
return []; return [];
} }
const containers = app.Pods[0].Containers; const containers = app.Pods[0].Containers;

View File

@ -40,6 +40,10 @@ function computeTolerations(nodes, application) {
// Some operators require empty "values" field, some only one element in "values" field, etc // Some operators require empty "values" field, some only one element in "values" field, etc
function computeAffinities(nodes, application) { function computeAffinities(nodes, application) {
if (!application.Pods || application.Pods.length === 0) {
return nodes;
}
const pod = application.Pods[0]; const pod = application.Pods[0];
_.forEach(nodes, (n) => { _.forEach(nodes, (n) => {
if (pod.NodeSelector) { if (pod.NodeSelector) {