kubernetes_helper 1.12.1 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/kubernetes_helper/version.rb +1 -1
- data/lib/kubernetes_helper.rb +2 -2
- data/lib/templates/cd.sh +4 -2
- data/lib/templates/deployment.yml +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: ac69b9f6972032067714455719b0c5563e5f2c0fed0a82a21665fdbae3b7cf41
|
4
|
+
data.tar.gz: a5b8d1b32f9fe5d9d8cdc6e96e45e0d96090db42f61bbfb11c896bd6ec92c5dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0189b8f37392fcaeba4e8982936f3ddc8fd6bfd4866cd47f04b5f8989e12f95863de50fb6a9201f7a58ca07ca00c4a1ceb1445fe4857eed07ad79a83c1ca6c
|
7
|
+
data.tar.gz: d39a3d77f973eb1e05c8dc5357b22102f6cf7bb0baa24ccbeb96d88a9c134b4f1ded05c40588e6e4baff74adf0d46d709897e3123798c172f60c142a775bbbb8
|
data/README.md
CHANGED
@@ -61,6 +61,7 @@ Below settings are used when running Continuous Deployment
|
|
61
61
|
- `continuous_deployment.cluster_region`: Cluster region name. Sample: `europe-west4-a`
|
62
62
|
- `continuous_deployment.docker_build_cmd`: Docker command to build the corresponding image. Sample: `build --target production -f Dockerfile `
|
63
63
|
- `continuous_deployment.update_deployment` (Boolean, default: false): If true permits to re-generate and update the k8s deployment(s) before applying the new version (new docker image)
|
64
|
+
- `continuous_deployment.before_building_image` (String, default: empty): Add the ability to enter commands before building docker image
|
64
65
|
|
65
66
|
Below settings are used when configuring the application in the k8s environment
|
66
67
|
- `deployment.name` (String): Web deployment name (Note: Underscores are not accepted). Sample: `my-app`
|
data/lib/kubernetes_helper.rb
CHANGED
@@ -14,7 +14,7 @@ module KubernetesHelper
|
|
14
14
|
|
15
15
|
# @param env_name (String)
|
16
16
|
# @return [Hash]
|
17
|
-
def self.load_settings
|
17
|
+
def self.load_settings # rubocop:disable Metrics/MethodLength:
|
18
18
|
config_file = File.join(settings_path, 'settings.rb')
|
19
19
|
load config_file
|
20
20
|
|
@@ -30,7 +30,7 @@ module KubernetesHelper
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.deep_merge(hash1, hash2)
|
33
|
-
merger = proc { |_key, v1, v2| v1.
|
33
|
+
merger = proc { |_key, v1, v2| v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2 }
|
34
34
|
hash1.merge(hash2, &merger)
|
35
35
|
end
|
36
36
|
|
data/lib/templates/cd.sh
CHANGED
@@ -37,6 +37,7 @@ then
|
|
37
37
|
fi
|
38
38
|
|
39
39
|
|
40
|
+
<%=continuous_deployment.before_building_image || ''%>
|
40
41
|
ALREADY_DEPLOYED="$(gcloud container images list-tags --format='get(tags)' $IMAGE_NAME | grep $CI_COMMIT_SHA || :;)"
|
41
42
|
if [ -z $ALREADY_DEPLOYED ]
|
42
43
|
then
|
@@ -44,11 +45,12 @@ then
|
|
44
45
|
echo "****** image not created yet, building image..."
|
45
46
|
docker $DOCKER_BUILD_CMD -t $DEPLOY_NAME .
|
46
47
|
docker push $DEPLOY_NAME
|
48
|
+
else
|
49
|
+
echo "****** image was already created: $ALREADY_DEPLOYED"
|
47
50
|
fi
|
48
51
|
|
49
52
|
echo "****** tagging image $DEPLOY_NAME as $LATEST_NAME"
|
50
|
-
|
51
|
-
docker push $LATEST_NAME
|
53
|
+
gcloud container images add-tag --quiet $DEPLOY_NAME $LATEST_NAME
|
52
54
|
|
53
55
|
## Update new secrets defined in secrets.yml as ENV vars for deployments
|
54
56
|
<% if continuous_deployment.update_deployment %>
|
@@ -30,7 +30,7 @@ documents:
|
|
30
30
|
import_secrets: ['secrets.yml', '<%=secrets.name%>']
|
31
31
|
ports:
|
32
32
|
- containerPort: &port <%= deployment.app_port || 3000 %>
|
33
|
-
name: '<%=service.backend_port_name%>'
|
33
|
+
name: '<%=service.backend_port_name || 'b-port'%>'
|
34
34
|
|
35
35
|
<% if deployment.liveness_path %>
|
36
36
|
livenessProbe: &liveness_probe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- owen2345
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erb
|