Skip to content

Commit 334b639

Browse files
stash
1 parent 0190000 commit 334b639

5 files changed

Lines changed: 46 additions & 9 deletions

File tree

lib/krane/kubernetes_resource/pod.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def doom_reason
235235
# to too many pods referencing the same secret/configmap: https://github.com/kubernetes/kubernetes/pull/74755
236236
# Error message format source: https://github.com/kubernetes/kubernetes/pull/75260
237237
elsif limbo_reason == "CreateContainerConfigError" && !limbo_message.match("failed to sync (.*?) cache")
238-
"Failed to generate container configuration: #{limbo_message}"
238+
container configuration: #{limbo_message}"
239239
elsif @status.dig("lastState", "terminated", "reason") == "ContainerCannotRun"
240240
# ref: https://github.com/kubernetes/kubernetes/blob/562e721ece8a16e05c7e7d6bdd6334c910733ab2/pkg/kubelet/dockershim/docker_container.go#L353
241241
exit_code = @status.dig('lastState', 'terminated', 'exitCode')

lib/krane/resource_deployer.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,19 @@ def deploy_resources(resources, prune: false, verify:, record_summary: true)
116116
# Fail Fast! This is a programmer mistake.
117117
raise ArgumentError, "Unexpected deploy method! (#{individual_resource.deploy_method.inspect})"
118118
end
119-
applyables += updated_individuals.select { |r| pruneable_types.include?(r.type) && !r.deploy_method_override }
120-
121119
next if status.success?
122120

123121
raise FatalDeploymentError, <<~MSG
124-
Failed to replace or create resource: #{individual_resource.id}
125-
#{individual_resource.sensitive_template_content? ? '<suppressed sensitive output>' : err}
122+
Failed to replace or create resource: #{individual_resource.id}
123+
#{individual_resource.sensitive_template_content? ? '<suppressed sensitive output>' : err}
126124
MSG
127125
end
128126

127+
applyables += updated_individuals.select { |r| pruneable_types.include?(r.type) && !r.deploy_method_override }
129128
apply_all(applyables, prune)
130-
129+
watchables = ((applyables + updated_individuals)).uniq
131130
if verify
132-
watcher = Krane::ResourceWatcher.new(resources: resources, deploy_started_at: deploy_started_at,
131+
watcher = Krane::ResourceWatcher.new(resources: watchables, deploy_started_at: deploy_started_at,
133132
timeout: @global_timeout, task_config: @task_config, sha: @current_sha)
134133
watcher.run(record_summary: record_summary)
135134
end
@@ -258,10 +257,15 @@ def create_resource(resource)
258257
output: 'json', output_is_sensitive: resource.sensitive_template_content?,
259258
use_namespace: !resource.global?)
260259

260+
updated_resource_hash = JSON.parse(updated_resource_definition)
261+
updated_resource_hash.delete("status")
262+
updated_resource_hash["metadata"].delete("resourceVersion")
263+
updated_resource_hash["metadata"].delete("generateName")
264+
261265
updated_resource = KubernetesResource.build(
262266
namespace: @task_config.namespace,
263267
context: @task_config.context,
264-
definition: updated_resource_definition,
268+
definition: updated_resource_hash,
265269
logger:,
266270
statsd_tags:,
267271
crd: resource.is_a?(CustomResource) ? resource.crd : nil,

lib/krane/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# frozen_string_literal: true
22
module Krane
3-
VERSION = "3.6.3"
3+
VERSION = "3.7.0"
44
end

tophat/configmap-data.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: hello-cloud-configmap-data
5+
labels:
6+
name: hello-cloud-configmap-data
7+
app: hello-cloud
8+
data:
9+
datapoint1: value1
10+
datapoint2: value2

tophat/pod.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-using-generate-name-
5+
# name: pod
6+
annotations:
7+
krane.shopify.io/timeout-override: 60s
8+
# container.apparmor.security.beta.kubernetes.io/command-runner: runtime/default
9+
labels:
10+
type: pod-using-generate-name
11+
name: pod-using-generate-name
12+
spec:
13+
activeDeadlineSeconds: 60
14+
restartPolicy: Never
15+
containers:
16+
- name: busybox-container
17+
image: busybox
18+
imagePullPolicy: IfNotPresent
19+
command: ["sh", "-c", "echo 'Hello from the command runner!' && test 1 -eq 1"]
20+
resources:
21+
requests:
22+
memory: 100Mi
23+
cpu: 100m

0 commit comments

Comments
 (0)