Sha256: 15b037706d437c70c0d0f5d349ac7d3b1a0f39682ca6713cf0749e628c417b2b
Contents?: true
Size: 1.29 KB
Versions: 6
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module KubernetesDeploy class CustomResourceDefinition < KubernetesResource TIMEOUT = 2.minutes GLOBAL = true def deploy_succeeded? names_accepted_status == "True" end def deploy_failed? names_accepted_status == "False" end def timeout_message "The names this CRD is attempting to register were neither accepted nor rejected in time" end def status if !exists? super elsif deploy_succeeded? "Names accepted" else "#{names_accepted_condition['reason']} (#{names_accepted_condition['message']})" end end def group_version_kind group = @definition.dig("spec", "group") version = @definition.dig("spec", "version") "#{group}/#{version}/#{kind}" end def kind @definition.dig("spec", "names", "kind") end def prunable? prunable = @definition.dig("metadata", "annotations", "kubernetes-deploy.shopify.io/prunable") prunable == "true" end private def names_accepted_condition conditions = @instance_data.dig("status", "conditions") || [] conditions.detect { |c| c["type"] == "NamesAccepted" } || {} end def names_accepted_status names_accepted_condition["status"] end end end
Version data entries
6 entries across 6 versions & 1 rubygems