Sha256: 4ec49d3f6b8ed4712710623e3afa3d64db95f730f83f5da07670b5942bc5ebfe
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module Krane class Cloudsql < KubernetesResource TIMEOUT = 10.minutes SYNC_DEPENDENCIES = %w(Deployment Service) def sync(cache) super @proxy_deployment = cache.get_instance(Deployment.kind, "cloudsql-#{cloudsql_resource_uuid}") @proxy_service = cache.get_instance(Service.kind, "cloudsql-#{@name}") end def status deploy_succeeded? ? "Provisioned" : "Unknown" end def deploy_succeeded? proxy_deployment_ready? && proxy_service_ready? end def deploy_failed? false end private def proxy_deployment_ready? return false unless (status = @proxy_deployment["status"]) # all cloudsql-proxy pods are running status.fetch("availableReplicas", -1) == status.fetch("replicas", 0) end def proxy_service_ready? return false unless @proxy_service.present? # the service has an assigned cluster IP and is therefore functioning @proxy_service.dig("spec", "clusterIP").present? end def cloudsql_resource_uuid return unless @instance_data @instance_data.dig("metadata", "uid") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
krane-1.1.1 | lib/krane/kubernetes_resource/cloudsql.rb |
krane-1.1.0 | lib/krane/kubernetes_resource/cloudsql.rb |