export async function checkManifestStability()

in src/utilities/manifestStabilityUtils.ts [12:98]


export async function checkManifestStability(
   kubectl: Kubectl,
   resources: Resource[],
   resourceType: ClusterType
): Promise<void> {
   // Skip if resource type is microsoft.containerservice/fleets
   if (resourceType === ResourceTypeFleet) {
      core.info(`Skipping checkManifestStability for ${ResourceTypeFleet}`)
      return
   }
   let rolloutStatusHasErrors = false
   for (let i = 0; i < resources.length; i++) {
      const resource = resources[i]

      if (
         KubernetesConstants.WORKLOAD_TYPES_WITH_ROLLOUT_STATUS.indexOf(
            resource.type.toLowerCase()
         ) >= 0
      ) {
         try {
            const result = await kubectl.checkRolloutStatus(
               resource.type,
               resource.name,
               resource.namespace
            )
            checkForErrors([result])
         } catch (ex) {
            core.error(ex)
            await kubectl.describe(
               resource.type,
               resource.name,
               IS_SILENT,
               resource.namespace
            )
            rolloutStatusHasErrors = true
         }
      }

      if (resource.type == KubernetesConstants.KubernetesWorkload.POD) {
         try {
            await checkPodStatus(kubectl, resource)
         } catch (ex) {
            core.warning(
               `Could not determine pod status: ${JSON.stringify(ex)}`
            )
            await kubectl.describe(
               resource.type,
               resource.name,
               IS_SILENT,
               resource.namespace
            )
         }
      }
      if (
         resource.type ==
         KubernetesConstants.DiscoveryAndLoadBalancerResource.SERVICE
      ) {
         try {
            const service = await getService(kubectl, resource)
            const {spec, status} = service
            if (spec.type === KubernetesConstants.ServiceTypes.LOAD_BALANCER) {
               if (!isLoadBalancerIPAssigned(status)) {
                  await waitForServiceExternalIPAssignment(kubectl, resource)
               } else {
                  core.info(
                     `ServiceExternalIP ${resource.name} ${status.loadBalancer.ingress[0].ip}`
                  )
               }
            }
         } catch (ex) {
            core.warning(
               `Could not determine service status of: ${resource.name} Error: ${ex}`
            )
            await kubectl.describe(
               resource.type,
               resource.name,
               IS_SILENT,
               resource.namespace
            )
         }
      }
   }

   if (rolloutStatusHasErrors) {
      throw new Error('Rollout status error')
   }
}