Commit 8d3e96ac authored by Dylan Griffith's avatar Dylan Griffith

Add more structured JSON logging to Kubernetes classes

parent 80eebd8e
......@@ -11,8 +11,15 @@ module Clusters
yield(operation) if block_given?
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
logger.error(exception: e.class.name, service: self.class.name, provider_id: provider.id, message: e.message)
provider.make_errored!("Failed to request to CloudPlatform; #{e.message}")
end
private
def logger
@logger ||= Gitlab::Kubernetes::Logger.build
end
end
end
end
......@@ -16,15 +16,22 @@ module Clusters
ClusterPlatformConfigureWorker.perform_async(cluster.id)
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
logger.error(exception: e.class.name, service: self.class.name, provider_id: provider.id, message: e.message)
provider.make_errored!("Failed to request to CloudPlatform; #{e.message}")
rescue Kubeclient::HttpError => e
logger.error(exception: e.class.name, service: self.class.name, provider_id: provider.id, message: e.message)
provider.make_errored!("Failed to run Kubeclient: #{e.message}")
rescue ActiveRecord::RecordInvalid => e
logger.error(exception: e.class.name, service: self.class.name, provider_id: provider.id, message: e.message)
provider.make_errored!("Failed to configure Google Kubernetes Engine Cluster: #{e.message}")
end
private
def logger
@logger ||= Gitlab::Kubernetes::Logger.build
end
def create_gitlab_service_account!
Clusters::Gcp::Kubernetes::CreateOrUpdateServiceAccountService.gitlab_creator(
kube_client,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment