kubernetes-deploy 0.26.2 → 0.26.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbfc9ddacc1877541f3c3d580be4e4f8dd2e4bbb59f6bbe52232ccc77985df1e
|
4
|
+
data.tar.gz: 1b15550b1ba3eada31790eb1b5521be3f6a9837108e379f97eb9791548b1478a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f7fe96e6737b17e2d979ca6cbf6c21b8f2524a4029d0a1756c859029a003688ad0b51e6d9f55ac34190ca635a9b071a657b3654d3c7f2793627505e0cd5942c
|
7
|
+
data.tar.gz: 438181bf2d2e491c0ffb5565a96f98b4d2d9352b6a88958fae80cfaedc1590a11cd0a768f1e35878a59f13ec5e57b18f3d8ce89459ba16be014d41c706d5e5b4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## next
|
2
2
|
|
3
|
+
## 0.26.3
|
4
|
+
|
5
|
+
*Bug fixes*
|
6
|
+
- Fixes a bug introduced in 0.26.0 where listing multiple files in the $KUBECONFIG environment variable would throw an error ([#468](https://github.com/Shopify/kubernetes-deploy/pull/468))
|
7
|
+
- Fixes a bug introduced in 0.26.2 where kubernetes-render started adding YAML headers to empty render results ([#467](https://github.com/Shopify/kubernetes-deploy/pull/467))
|
8
|
+
|
3
9
|
## 0.26.2
|
4
10
|
|
5
11
|
*Enhancements*
|
@@ -7,7 +13,7 @@
|
|
7
13
|
through a yaml parser. ([#454](https://github.com/Shopify/kubernetes-deploy/pull/454))
|
8
14
|
|
9
15
|
*Bug fixes*
|
10
|
-
- Remove use of deprecated feature preventing use with
|
16
|
+
- Remove use of deprecated feature preventing use with Kubernetes 1.14 ([#460](https://github.com/Shopify/kubernetes-deploy/pull/460))
|
11
17
|
|
12
18
|
## 0.26.1
|
13
19
|
|
@@ -7,18 +7,14 @@ module KubernetesDeploy
|
|
7
7
|
class ContextMissingError < FatalDeploymentError
|
8
8
|
def initialize(context_name, kubeconfig)
|
9
9
|
super("`#{context_name}` context must be configured in your " \
|
10
|
-
"KUBECONFIG file(s) (#{kubeconfig}).")
|
10
|
+
"KUBECONFIG file(s) (#{kubeconfig.join(', ')}).")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.kubeconfig
|
15
|
-
new.kubeconfig
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :kubeconfig
|
19
|
-
|
20
14
|
def initialize(kubeconfig: ENV["KUBECONFIG"])
|
21
|
-
|
15
|
+
files = kubeconfig || "#{Dir.home}/.kube/config"
|
16
|
+
# Split the list by colon for Linux and Mac, and semicolon for Windows.
|
17
|
+
@kubeconfig_files = files.split(/[:;]/).map!(&:strip).reject(&:empty?)
|
22
18
|
end
|
23
19
|
|
24
20
|
def build_v1_kubeclient(context)
|
@@ -100,33 +96,32 @@ module KubernetesDeploy
|
|
100
96
|
)
|
101
97
|
end
|
102
98
|
|
103
|
-
def config_files
|
104
|
-
# Split the list by colon for Linux and Mac, and semicolon for Windows.
|
105
|
-
kubeconfig.split(/[:;]/).map!(&:strip).reject(&:empty?)
|
106
|
-
end
|
107
|
-
|
108
99
|
def validate_config_files
|
109
100
|
errors = []
|
110
|
-
if
|
101
|
+
if @kubeconfig_files.empty?
|
111
102
|
errors << "Kube config file name(s) not set in $KUBECONFIG"
|
112
103
|
else
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
104
|
+
@kubeconfig_files.each do |f|
|
105
|
+
# If any files in the list are not valid, we can't be sure the merged context list is what the user intended
|
106
|
+
errors << "Kube config not found at #{f}" unless File.file?(f)
|
117
107
|
end
|
118
108
|
end
|
119
109
|
errors
|
120
110
|
end
|
121
111
|
|
112
|
+
def validate_config_files!
|
113
|
+
errors = validate_config_files
|
114
|
+
raise TaskConfigurationError, errors.join(', ') if errors.present?
|
115
|
+
end
|
116
|
+
|
122
117
|
private
|
123
118
|
|
124
119
|
def build_kubeclient(api_version:, context:, endpoint_path: nil)
|
120
|
+
validate_config_files!
|
121
|
+
@kubeclient_configs ||= @kubeconfig_files.map { |f| KubeConfig.read(f) }
|
125
122
|
# Find a context defined in kube conf files that matches the input context by name
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
raise ContextMissingError.new(context, kubeconfig) unless config
|
123
|
+
config = @kubeclient_configs.find { |c| c.contexts.include?(context) }
|
124
|
+
raise ContextMissingError.new(context, @kubeconfig_files) unless config
|
130
125
|
|
131
126
|
kube_context = config.context(context)
|
132
127
|
client = Kubeclient::Client.new(
|
@@ -9,7 +9,6 @@ module KubernetesDeploy
|
|
9
9
|
|
10
10
|
def initialize(namespace:, context:, logger:, log_failure_by_default:, default_timeout: DEFAULT_TIMEOUT,
|
11
11
|
output_is_sensitive_default: false)
|
12
|
-
@kubeconfig = KubeclientBuilder.kubeconfig
|
13
12
|
@namespace = namespace
|
14
13
|
@context = context
|
15
14
|
@logger = logger
|
@@ -27,7 +26,6 @@ module KubernetesDeploy
|
|
27
26
|
output_is_sensitive = @output_is_sensitive_default if output_is_sensitive.nil?
|
28
27
|
|
29
28
|
args = args.unshift("kubectl")
|
30
|
-
args.push("--kubeconfig=#{@kubeconfig}")
|
31
29
|
args.push("--namespace=#{@namespace}") if use_namespace
|
32
30
|
args.push("--context=#{@context}") if use_context
|
33
31
|
args.push("--output=#{output}") if output
|
@@ -65,14 +65,19 @@ module KubernetesDeploy
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def render_filename(filename, stream)
|
68
|
-
|
68
|
+
file_basename = File.basename(filename)
|
69
|
+
@logger.info("Rendering #{file_basename}...")
|
69
70
|
file_content = File.read(File.join(@template_dir, filename))
|
70
71
|
rendered_content = @renderer.render_template(filename, file_content)
|
71
72
|
implicit = true
|
72
73
|
YAML.parse_stream(rendered_content, "<rendered> #{filename}") { |d| implicit = d.implicit }
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
if rendered_content.present?
|
75
|
+
stream.puts "---\n" if implicit
|
76
|
+
stream.puts rendered_content
|
77
|
+
@logger.info("Rendered #{file_basename}")
|
78
|
+
else
|
79
|
+
@logger.warn("Rendered #{file_basename} successfully, but the result was blank")
|
80
|
+
end
|
76
81
|
rescue Psych::SyntaxError => exception
|
77
82
|
raise InvalidTemplateError.new("Template is not valid YAML. #{exception.message}", filename: filename)
|
78
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Verey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-04-
|
12
|
+
date: 2019-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|