kubernetes_helper 1.12.8 → 1.13.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/README.md +8 -4
- data/lib/kubernetes_helper/core.rb +3 -1
- data/lib/kubernetes_helper/version.rb +1 -1
- data/lib/kubernetes_helper.rb +2 -1
- data/lib/templates/cd.sh +5 -4
- data/lib/templates/settings.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: 9257b84ef107ed3b39ce537325de4357b348023becbf0f14fcf761bdf652d3f0
|
4
|
+
data.tar.gz: 77abef0bae873a41b1ed2fce90d49c55f07b43acbef6b578ae9b0e7f45716893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2798fb189f4e2ab77507dd8095d0f2741ef70d163a03d98f734f6d4772395b7521c77aed051a97a9d5241fca3ef0d8cdc0d19c4ea430ea81ed0af7e4d9f89ca
|
7
|
+
data.tar.gz: 4446e493e3cb37ec030d99e1ede09738bce1e8cd17f16f35c95ded98c1a18213cb7997d03d7b3e6c6c59d273fcf5468a09cd709aaaca6f87859bfa5f44d419f5
|
data/README.md
CHANGED
@@ -59,10 +59,11 @@ Below settings are used when running Continuous Deployment
|
|
59
59
|
- `continuous_deployment.project_name`: Cloud project name. Sample: `my-project-name`
|
60
60
|
- `continuous_deployment.cluster_name`: Cluster cluster name. Sample: `my-cluster-name`
|
61
61
|
- `continuous_deployment.cluster_region`: Cluster region name. Sample: `europe-west4-a`
|
62
|
-
- `continuous_deployment.docker_build_cmd
|
62
|
+
- `continuous_deployment.docker_build_cmd` (deprecated): Docker command to build the corresponding image. Sample: `build --target production -f Dockerfile `
|
63
|
+
- `continuous_deployment.docker_cmd` (String): Docker command to build the corresponding image.
|
64
|
+
Simple docker image: `docker build -f Dockerfile -t $DEPLOY_NAME .`
|
65
|
+
Docker image with target: `docker build --target production -f Dockerfile -t $DEPLOY_NAME .`
|
63
66
|
- `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
|
65
|
-
- `continuous_deployment.after_building_image` (String, default: empty): Add the ability to enter commands after building docker image
|
66
67
|
|
67
68
|
Below settings are used when configuring the application in the k8s environment
|
68
69
|
- `deployment.name` (String): Web deployment name (Note: Underscores are not accepted). Sample: `my-app`
|
@@ -70,7 +71,10 @@ Below settings are used when configuring the application in the k8s environment
|
|
70
71
|
- `deployment.replicas_range` (Array<min, max, cpu_percentage>, Optional): Defines the minimum and the maximum number of pods that could automatically be created when `CPUUtilizationPercentage` is above than defined. Sample: `[1, 3, 50]`
|
71
72
|
- `deployment.cloud_secret_name` (String, Optional): K8s credentials name where cloud secrets will be saved (includes permission like DB). Sample: `my-app-cloud-secret`
|
72
73
|
- `deployment.cloud_sql_instance` (String, Optional): Cloud sql instance name. Sample: `my-project:europe-west1:my-instance-name=tcp:5432` (5432 => postgres, 3306 => mysql)
|
73
|
-
- `deployment.env_vars` (Hash, optional): List of static env variables (Note: Not recommended for sensitive values).
|
74
|
+
- `deployment.env_vars` (Hash, optional): List of static or external env variables (Note: Not recommended for sensitive values).
|
75
|
+
Sample: `{ 'RAILS_ENV' => 'production' }`
|
76
|
+
Example for external secrets: `{ PAPERTRAIL_PORT: { name: 'common_secrets', key: 'paper_trail_port' }` will import `paper_trail_port` value from `common_secrets` yml as `PAPERTRAIL_PORT`
|
77
|
+
|
74
78
|
- `deployment.command` (String, Optional): Bash command to be used for web containers. Sample: `rails s -b 0.0.0.0`
|
75
79
|
- `deployment.liveness_path` (String, Optional): Relative path to be used for readiness and liveness checker of the web app. Sample: `/check_liveness`
|
76
80
|
- `deployment.custom_volumes` (Hash<name: path>, Optional): Custom volumes to be mounted.
|
@@ -83,9 +83,11 @@ module KubernetesHelper
|
|
83
83
|
|
84
84
|
def static_env_vars
|
85
85
|
(config_values.dig(:deployment, :env_vars) || {}).map do |key, value|
|
86
|
+
external = value.is_a?(Hash)
|
87
|
+
value = { 'secretKeyRef' => { 'name' => value[:name], 'key' => value[:key].to_s } } if external
|
86
88
|
{
|
87
89
|
'name' => key.to_s,
|
88
|
-
'value' => value
|
90
|
+
(external ? 'valueFrom' : 'value') => value
|
89
91
|
}
|
90
92
|
end
|
91
93
|
end
|
data/lib/kubernetes_helper.rb
CHANGED
data/lib/templates/cd.sh
CHANGED
@@ -10,7 +10,6 @@ IMAGE_NAME="<%=continuous_deployment.image_name%>"
|
|
10
10
|
CLUSTER_NAME="<%=continuous_deployment.cluster_name%>"
|
11
11
|
PROJECT_NAME="<%=continuous_deployment.project_name%>"
|
12
12
|
CLUSTER_REGION="<%=continuous_deployment.cluster_region%>"
|
13
|
-
DOCKER_BUILD_CMD="<%=continuous_deployment.docker_build_cmd || 'build -f Dockerfile'%>"
|
14
13
|
|
15
14
|
CI_COMMIT_SHA=$(git rev-parse --verify HEAD || :)
|
16
15
|
CI_COMMIT_SHA=${CI_COMMIT_SHA:-$(date +%s) }
|
@@ -42,9 +41,11 @@ if [ -z $ALREADY_DEPLOYED ]
|
|
42
41
|
then
|
43
42
|
## Build and push containers
|
44
43
|
echo "****** image not created yet, building image..."
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
<% if continuous_deployment.docker_cmd %>
|
45
|
+
<%= continuous_deployment.docker_cmd %>
|
46
|
+
<% else %>
|
47
|
+
docker <%=continuous_deployment.docker_build_cmd || 'build -f Dockerfile'%> -t $DEPLOY_NAME .
|
48
|
+
<% end %>
|
48
49
|
docker push $DEPLOY_NAME
|
49
50
|
else
|
50
51
|
echo "****** image was already created: $ALREADY_DEPLOYED"
|
data/lib/templates/settings.rb
CHANGED
@@ -35,7 +35,7 @@ settings = {
|
|
35
35
|
project_name: 'my-project-name',
|
36
36
|
cluster_name: 'my-cluster-name',
|
37
37
|
cluster_region: 'europe-west4-a',
|
38
|
-
|
38
|
+
docker_cmd: 'docker build -f Dockerfile -t $DEPLOY_NAME .', # using target: 'docker build --target production -f Dockerfile -t $DEPLOY_NAME .'
|
39
39
|
update_deployment: false # permits to reload secrets and re-generate/update deployment yaml
|
40
40
|
},
|
41
41
|
}
|
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.
|
4
|
+
version: 1.13.2
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erb
|