kube_secrets_encode 0.1.1 → 1.0.0
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/README.md +2 -2
- data/bin/kube_secrets +0 -1
- data/kube_secrets_encode.gemspec +2 -2
- data/lib/kube_secrets_encode.rb +35 -17
- data/lib/kube_secrets_encode/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf9303014d0e0fe0e8b839d512960cb3a2242fe
|
4
|
+
data.tar.gz: 0bc6aacce3cbe1589e547662d71d60ae16b97e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b07237ebb2705f0f281dd1af986e8b4398a0d7be4b88ab96254d81894e6d84101b8e72071aa9a4dcbfcc8e5a29636492e8902cc7e9767b9fc37844d04e81cb6
|
7
|
+
data.tar.gz: f6ad28812d0c9bbd4d9d261397089f9bd225167ffc44ab1f0bcfcc4c7bf55078bb3ac4060e3033292b8f0c2915d344186693bd932bc0f537bd3bc0fc7d36c738
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ gem install kube_secrets_encode
|
|
13
13
|
The command line to run is as follows
|
14
14
|
|
15
15
|
```
|
16
|
-
kube_secrets filename
|
16
|
+
kube_secrets --file=filename
|
17
17
|
```
|
18
18
|
|
19
19
|
This will encode the secrets in the file specified and render the result to screen.
|
@@ -25,7 +25,7 @@ This will encode the secrets in the file specified and render the result to scre
|
|
25
25
|
This will perform the reverse of encode
|
26
26
|
|
27
27
|
```
|
28
|
-
kube_secrets filename --decode
|
28
|
+
kube_secrets --file=filename --decode
|
29
29
|
```
|
30
30
|
|
31
31
|
|
data/bin/kube_secrets
CHANGED
data/kube_secrets_encode.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Stewart McKee"]
|
10
10
|
spec.email = ["stewart@theizone.co.uk"]
|
11
11
|
|
12
|
-
spec.summary = "
|
13
|
-
spec.description = "
|
12
|
+
spec.summary = "kube_secrets enables you to encode and decode the base64 encoding of secrets in place within your config files making it easier to modify them."
|
13
|
+
spec.description = "kube_secrets enables you to encode and decode the base64 encoding of secrets in place within your config files making it easier to modify them."
|
14
14
|
spec.homepage = "https://github.com/stewartmckee/kube_secrets_encode"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
data/lib/kube_secrets_encode.rb
CHANGED
@@ -8,13 +8,22 @@ module KubeSecretsEncode
|
|
8
8
|
class Command
|
9
9
|
include Executable
|
10
10
|
|
11
|
+
# filename of file being encoded or decoded
|
12
|
+
def file=(filename)
|
13
|
+
@file = filename
|
14
|
+
end
|
15
|
+
def file
|
16
|
+
@file
|
17
|
+
end
|
18
|
+
|
19
|
+
# enables write after decode or encode
|
11
20
|
def yes=(bool)
|
12
21
|
@yes = bool
|
13
22
|
end
|
14
|
-
|
15
23
|
def yes?
|
16
24
|
@yes
|
17
25
|
end
|
26
|
+
# switch from default encode to decode mode
|
18
27
|
def decode=(bool)
|
19
28
|
@decode = bool
|
20
29
|
end
|
@@ -29,29 +38,38 @@ module KubeSecretsEncode
|
|
29
38
|
end
|
30
39
|
alias :h? :help?
|
31
40
|
|
32
|
-
|
33
|
-
|
41
|
+
def self.usage_name
|
42
|
+
"kube_secrets"
|
43
|
+
end
|
44
|
+
|
45
|
+
# kube_secrets enables you to encode and decode the base64 encoding of secrets in place within your config files making it easier to modify them.
|
46
|
+
def call()
|
34
47
|
documents = []
|
35
|
-
|
36
|
-
|
37
|
-
if document["
|
38
|
-
document["data"]
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
48
|
+
if file && File.exists?(file)
|
49
|
+
YAML.load_stream(File.open(file)) do |document|
|
50
|
+
if document["kind"] == "Secret"
|
51
|
+
if document["data"]
|
52
|
+
document["data"].each do |k,v|
|
53
|
+
if decode?
|
54
|
+
document["data"][k] = Base64.strict_decode64(v)
|
55
|
+
else
|
56
|
+
document["data"][k] = Base64.strict_encode64(v)
|
57
|
+
end
|
43
58
|
end
|
44
59
|
end
|
45
60
|
end
|
61
|
+
documents << document
|
46
62
|
end
|
47
|
-
documents
|
48
|
-
end
|
49
|
-
yaml = documents.map{|d| d.to_yaml}.join
|
63
|
+
yaml = documents.map{|d| d.to_yaml}.join
|
50
64
|
|
51
|
-
|
52
|
-
|
53
|
-
|
65
|
+
puts yaml
|
66
|
+
if yes?
|
67
|
+
File.open(file, 'w') { |file| file.write(yaml) }
|
68
|
+
end
|
69
|
+
else
|
70
|
+
cli.show_help
|
54
71
|
end
|
72
|
+
exit
|
55
73
|
end
|
56
74
|
end
|
57
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kube_secrets_encode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stewart McKee
|
@@ -80,7 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
-
description:
|
83
|
+
description: kube_secrets enables you to encode and decode the base64 encoding of
|
84
|
+
secrets in place within your config files making it easier to modify them.
|
84
85
|
email:
|
85
86
|
- stewart@theizone.co.uk
|
86
87
|
executables:
|
@@ -127,5 +128,6 @@ rubyforge_project:
|
|
127
128
|
rubygems_version: 2.6.12
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
|
-
summary:
|
131
|
+
summary: kube_secrets enables you to encode and decode the base64 encoding of secrets
|
132
|
+
in place within your config files making it easier to modify them.
|
131
133
|
test_files: []
|