kubernetes-deploy 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kubernetes-deploy/kubernetes_resource.rb +14 -12
- data/lib/kubernetes-deploy/runner.rb +13 -8
- data/lib/kubernetes-deploy/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 05fd6f9e6d7f1ed75f28c9bf9c25508be5a8ce84
         | 
| 4 | 
            +
              data.tar.gz: 8712e70aab07e4ce005feff75c4bad5441242508
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c426af3a8c735dbf2c4543fb11ed84c7ae177a047790b4e53bf725124bd01ba1d77d0923da9123fb491bd6f1e982e7c99de287799b622e4bfc16e1a1e379fdc6
         | 
| 7 | 
            +
              data.tar.gz: 2f18a43c9929f2148ed9b614f46d7af115fec162235368301c9e3600bdd953c8f82c601bfa8e8d1687a8aa864746a103ddedecb4687df77b4a464404326733fa
         | 
| @@ -187,18 +187,7 @@ module KubernetesDeploy | |
| 187 187 |  | 
| 188 188 | 
             
                def report_status_to_statsd(watch_time)
         | 
| 189 189 | 
             
                  unless @statsd_report_done
         | 
| 190 | 
            -
                     | 
| 191 | 
            -
                      "failure"
         | 
| 192 | 
            -
                    elsif deploy_timed_out?
         | 
| 193 | 
            -
                      "timeout"
         | 
| 194 | 
            -
                    elsif deploy_succeeded?
         | 
| 195 | 
            -
                      "success"
         | 
| 196 | 
            -
                    else
         | 
| 197 | 
            -
                      "unknown"
         | 
| 198 | 
            -
                    end
         | 
| 199 | 
            -
                    tags = %W(namespace:#{namespace} resource:#{id} type:#{type} sha:#{ENV['REVISION']} status:#{status})
         | 
| 200 | 
            -
                    ::StatsD.measure('resource.duration', watch_time * 1000, tags: tags)
         | 
| 201 | 
            -
                    ::StatsD.increment('resource.status', 1, tags: tags)
         | 
| 190 | 
            +
                    ::StatsD.measure('resource.duration', watch_time, tags: statsd_tags)
         | 
| 202 191 | 
             
                    @statsd_report_done = true
         | 
| 203 192 | 
             
                  end
         | 
| 204 193 | 
             
                end
         | 
| @@ -272,5 +261,18 @@ module KubernetesDeploy | |
| 272 261 | 
             
                ensure
         | 
| 273 262 | 
             
                  file.close if file
         | 
| 274 263 | 
             
                end
         | 
| 264 | 
            +
             | 
| 265 | 
            +
                def statsd_tags
         | 
| 266 | 
            +
                  status = if deploy_failed?
         | 
| 267 | 
            +
                    "failure"
         | 
| 268 | 
            +
                  elsif deploy_timed_out?
         | 
| 269 | 
            +
                    "timeout"
         | 
| 270 | 
            +
                  elsif deploy_succeeded?
         | 
| 271 | 
            +
                    "success"
         | 
| 272 | 
            +
                  else
         | 
| 273 | 
            +
                    "unknown"
         | 
| 274 | 
            +
                  end
         | 
| 275 | 
            +
                  %W(context:#{context} namespace:#{namespace} resource:#{id} type:#{type} sha:#{ENV['REVISION']} status:#{status})
         | 
| 276 | 
            +
                end
         | 
| 275 277 | 
             
              end
         | 
| 276 278 | 
             
            end
         | 
| @@ -105,9 +105,9 @@ module KubernetesDeploy | |
| 105 105 |  | 
| 106 106 | 
             
                  if deploy_has_priority_resources?(resources)
         | 
| 107 107 | 
             
                    @logger.phase_heading("Predeploying priority resources")
         | 
| 108 | 
            -
                     | 
| 109 | 
            -
             | 
| 110 | 
            -
                     | 
| 108 | 
            +
                    start_priority_resource = Time.now.utc
         | 
| 109 | 
            +
                    predeploy_priority_resources(resources)
         | 
| 110 | 
            +
                    ::StatsD.measure('priority_resources.duration', statsd_duration(start_priority_resource), tags: statsd_tags)
         | 
| 111 111 | 
             
                  end
         | 
| 112 112 |  | 
| 113 113 | 
             
                  @logger.phase_heading("Deploying all resources")
         | 
| @@ -116,9 +116,9 @@ module KubernetesDeploy | |
| 116 116 | 
             
                  end
         | 
| 117 117 |  | 
| 118 118 | 
             
                  if verify_result
         | 
| 119 | 
            -
                     | 
| 120 | 
            -
             | 
| 121 | 
            -
                     | 
| 119 | 
            +
                    start_normal_resource = Time.now.utc
         | 
| 120 | 
            +
                    deploy_resources(resources, prune: prune, verify: true)
         | 
| 121 | 
            +
                    ::StatsD.measure('normal_resources.duration', statsd_duration(start_normal_resource), tags: statsd_tags)
         | 
| 122 122 | 
             
                    record_statuses(resources)
         | 
| 123 123 | 
             
                    success = resources.all?(&:deploy_succeeded?)
         | 
| 124 124 | 
             
                  else
         | 
| @@ -136,7 +136,8 @@ module KubernetesDeploy | |
| 136 136 | 
             
                  success = false
         | 
| 137 137 | 
             
                ensure
         | 
| 138 138 | 
             
                  @logger.print_summary(success)
         | 
| 139 | 
            -
                   | 
| 139 | 
            +
                  status = success ? "success" : "failed"
         | 
| 140 | 
            +
                  ::StatsD.measure('all_resources.duration', statsd_duration(start), tags: statsd_tags << "status:#{status}")
         | 
| 140 141 | 
             
                  success
         | 
| 141 142 | 
             
                end
         | 
| 142 143 |  | 
| @@ -441,7 +442,11 @@ module KubernetesDeploy | |
| 441 442 | 
             
                end
         | 
| 442 443 |  | 
| 443 444 | 
             
                def statsd_tags
         | 
| 444 | 
            -
                  %W(namespace:#{@namespace} sha:#{@current_sha})
         | 
| 445 | 
            +
                  %W(namespace:#{@namespace} sha:#{@current_sha} context:#{@context})
         | 
| 446 | 
            +
                end
         | 
| 447 | 
            +
             | 
| 448 | 
            +
                def statsd_duration(start_time)
         | 
| 449 | 
            +
                  (Time.now.utc - start_time).round(1)
         | 
| 445 450 | 
             
                end
         | 
| 446 451 | 
             
              end
         | 
| 447 452 | 
             
            end
         |