Skip to content

Commit

Permalink
Merge pull request #79 from Shopify/bugsnag_resource
Browse files Browse the repository at this point in the history
Add resource for Bugsnag TPR
  • Loading branch information
mkobetic authored Apr 21, 2017
2 parents 88a2ce6 + bf3635a commit db5d55f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/kubernetes-deploy/kubernetes_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def self.for_type(type, name, namespace, context, file)
when 'deployment' then Deployment.new(name, namespace, context, file)
when 'pod' then Pod.new(name, namespace, context, file)
when 'redis' then Redis.new(name, namespace, context, file)
when 'bugsnag' then Bugsnag.new(name, namespace, context, file)
when 'ingress' then Ingress.new(name, namespace, context, file)
when 'persistentvolumeclaim' then PersistentVolumeClaim.new(name, namespace, context, file)
when 'service' then Service.new(name, namespace, context, file)
Expand Down
41 changes: 41 additions & 0 deletions lib/kubernetes-deploy/kubernetes_resource/bugsnag.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true
module KubernetesDeploy
class Bugsnag < KubernetesResource
TIMEOUT = 1.minute

def initialize(name, namespace, context, file)
@name = name
@namespace = namespace
@context = context
@file = file
@secret_found = false
end

def sync
_, _err, st = run_kubectl("get", type, @name)
@found = st.success?
if @found
secrets, _err, _st = run_kubectl("get", "secrets", "--output=name")
@secret_found = secrets.split.any? { |s| s.end_with?("-bugsnag") }
end
@status = @secret_found ? "Available" : "Unknown"
log_status
end

def deploy_succeeded?
@secret_found
end

def deploy_failed?
false
end

def exists?
@found
end

def tpr?
true
end
end
end
2 changes: 2 additions & 0 deletions lib/kubernetes-deploy/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
pod
redis
service
bugsnag
).each do |subresource|
require "kubernetes-deploy/kubernetes_resource/#{subresource}"
end
Expand All @@ -30,6 +31,7 @@ class Runner
PREDEPLOY_SEQUENCE = %w(
Cloudsql
Redis
Bugsnag
ConfigMap
PersistentVolumeClaim
Pod
Expand Down

0 comments on commit db5d55f

Please sign in to comment.