kubes_google 0.1.1 → 0.1.2
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/CHANGELOG.md +3 -0
- data/README.md +3 -2
- data/lib/kubes_google/secrets.rb +8 -2
- data/lib/kubes_google/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64cbb6d5f91c9d194e47f9695b79802c5615367afe6464933b83bb59d9dfc418
|
4
|
+
data.tar.gz: 6d3d98f419a73dd8117dc87cfd0adf43e40e2e9feef447c8bbcfe5867b1410c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 500425e494045b16a68672ad80c6d2157fc3a0dcd501c627850c6b3432dd95bec3dba727d31a7bed59d17be128366c4056bccb788d398659032b57afeb6b13e1
|
7
|
+
data.tar.gz: 679203c3c148448bfab87162c5267d1403e4f37c5f3dfd6e01bcf042dc7d4453e1919199037092651c807bb774b7a4afb6348f63603146463f552983c5e2c29e
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.1.2]
|
7
|
+
- #1 base64 option
|
8
|
+
|
6
9
|
## [0.1.1]
|
7
10
|
- dont base64 secret values in data by default
|
8
11
|
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Then set the secrets in the YAML:
|
|
29
29
|
|
30
30
|
.kubes/resources/shared/secret.yaml
|
31
31
|
|
32
|
-
```
|
32
|
+
```yaml
|
33
33
|
apiVersion: v1
|
34
34
|
kind: Secret
|
35
35
|
metadata:
|
@@ -38,7 +38,7 @@ metadata:
|
|
38
38
|
app: demo
|
39
39
|
data:
|
40
40
|
<% KubesGoogle::Secrets.data.each do |k,v| -%>
|
41
|
-
<%= k %>: <%=
|
41
|
+
<%= k %>: <%= base64(v) %>
|
42
42
|
<% end -%>
|
43
43
|
```
|
44
44
|
|
@@ -78,6 +78,7 @@ Secrets#initialize options:
|
|
78
78
|
|
79
79
|
Variable | Description | Default
|
80
80
|
---|---|---
|
81
|
+
base64 | Automatically base64 encode the values. | false
|
81
82
|
upcase | Automatically upcase the Kubernetes secret data keys. | false
|
82
83
|
prefix | Prefixed used to list and filter Google secrets. IE: `projects/686010496118/secrets/demo-dev-`. Can also be set with the `GCP_SECRET_PREFIX` env variable. The env variable takes the highest precedence. | nil
|
83
84
|
|
data/lib/kubes_google/secrets.rb
CHANGED
@@ -2,8 +2,8 @@ require "google-cloud-secret_manager"
|
|
2
2
|
|
3
3
|
module KubesGoogle
|
4
4
|
class Secrets
|
5
|
-
def initialize(upcase: false, prefix: nil)
|
6
|
-
@upcase = upcase
|
5
|
+
def initialize(upcase: false, base64: false, prefix: nil)
|
6
|
+
@upcase, @base64 = upcase, base64
|
7
7
|
@prefix = ENV['GCP_SECRET_PREFIX'] || prefix || raise("GOOGLE_PROJECT env variable is not set. It's required.")
|
8
8
|
@project_id = ENV['GOOGLE_PROJECT']
|
9
9
|
# IE: prefix: projects/686010496118/secrets/demo-dev-
|
@@ -22,10 +22,16 @@ module KubesGoogle
|
|
22
22
|
key = secret.name.sub(@prefix,'')
|
23
23
|
key = key.upcase if @upcase
|
24
24
|
value = version.payload.data
|
25
|
+
# strict_encode64 to avoid newlines https://stackoverflow.com/questions/2620975/strange-n-in-base64-encoded-string-in-ruby
|
26
|
+
value = Base64.strict_encode64(value).strip if @base64
|
25
27
|
self.class.data[key] = value
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
31
|
+
def data
|
32
|
+
self.class.data
|
33
|
+
end
|
34
|
+
|
29
35
|
class_attribute :data
|
30
36
|
self.data = {}
|
31
37
|
end
|
data/lib/kubes_google/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubes_google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|