kubernetes_helper 1.10.0 → 1.11.3
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 +7 -3
- data/lib/kubernetes_helper/version.rb +1 -1
- data/lib/templates/_job_liveness.yml +1 -1
- data/lib/templates/_volumes.yml +0 -1
- data/lib/templates/cd.sh +12 -6
- data/lib/templates/deployment.yml +1 -6
- data/lib/templates/settings.rb +2 -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: 235b38e0301bf3d021a192dc336183f89bd3ca214d5c5464b701d4ed03e1faef
|
4
|
+
data.tar.gz: 28ffb4e42d000427b08643c14f24b626d2ee78ace071219bddaf64b35b7b88af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8556cd967823100b097347f1a02e2e8681ab16e319c44faf5baa959accb3ca52c08339c1eb1ca04f61c712f63d8e8b76e51e21c5caa1da78e8f79c82c541d8e
|
7
|
+
data.tar.gz: bdbf65ea0309743fb11567d30b2be2bea66382932553a253860762aef5637e04781e07fc78119735d1d9ea30d2e0854d2c58478cc75627b4f100e2710e6973e2
|
data/README.md
CHANGED
@@ -54,8 +54,8 @@ it looks for the file inside kubernetes_helper template folder.
|
|
54
54
|
|
55
55
|
## Settings API
|
56
56
|
Below settings are used when running Continuous Deployment
|
57
|
-
- `continuous_deployment.image_name` (String
|
58
|
-
- `continuous_deployment.
|
57
|
+
- `continuous_deployment.image_name` (String): Partial docker image url. Sample: `gcr.io/my-account/my_app_name`
|
58
|
+
- `continuous_deployment.image_tag` (String, default 'latest'): Image tag to be used for this application
|
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`
|
@@ -71,7 +71,9 @@ Below settings are used when configuring the application in the k8s environment
|
|
71
71
|
- `deployment.env_vars` (Hash, optional): List of static env variables (Note: Not recommended for sensitive values). Sample: `{ 'RAILS_ENV' => 'production' }`
|
72
72
|
- `deployment.command` (String, Optional): Bash command to be used for web containers. Sample: `rails s -b 0.0.0.0`
|
73
73
|
- `deployment.liveness_path` (String, Optional): Relative path to be used for readiness and liveness checker of the web app. Sample: `/check_liveness`
|
74
|
-
- `deployment.custom_volumes` (Hash<name: path>, Optional): Custom volumes to be mounted.
|
74
|
+
- `deployment.custom_volumes` (Hash<name: path>, Optional): Custom volumes to be mounted.
|
75
|
+
Sample volume: `{ my_volume: { kind: 'hostPath', mount_path: '/', settings: { path: '..', type: 'Directory' } } }`
|
76
|
+
Sample secret: `{ pubsub_secret: { kind: 'secret', mount_path: '/secrets/pubsub', settings: { secretName: 'my_secret_name' } } }`
|
75
77
|
|
76
78
|
- `deployment.job_name` (String, optional): Job deployment name (Note: Underscores are not accepted). Sample: `my-app-job`. Note: This deployment is created only if this value is present
|
77
79
|
- `deployment.job_command` (String, optional): Bash command to be used for job container. Sample: `bundle exec sidekiq`
|
@@ -90,6 +92,8 @@ Below settings are used when configuring the application in the k8s environment
|
|
90
92
|
- `ingress.certificate_name` (Optional): Ssl certificate is not created nor assigned if empty value. Sample: `my-app-lets-encrypt`. Note: requires `certificate_domain`
|
91
93
|
- `ingress.certificate_domain` (Optional): Domain name for the certificate. Sample: `myapp.com`. Note: does not support for willcard domains
|
92
94
|
|
95
|
+
- `cloud.name` (String, optional): Cloud service name. Default `gcloud`.
|
96
|
+
|
93
97
|
### Partials
|
94
98
|
- `_container_extra_settings.yml` Partial template to add custom container settings. Receives `pod` as local variable (`web` | `job` | `cloudsql` | `logs`). Sample:
|
95
99
|
```yaml
|
@@ -3,7 +3,7 @@
|
|
3
3
|
livenessProbe: &liveness_probe
|
4
4
|
exec:
|
5
5
|
command: [ /bin/sh, -c,
|
6
|
-
'if [ $(ps -ef | grep "<%= deployment.job_services.join("
|
6
|
+
'if [ $(ps -ef | grep "<%= deployment.job_services.join("\\|") %>" | grep -v "grep" | wc -l) -lt <%= deployment.job_services.count %> ]; then
|
7
7
|
echo "Some required services are not running"; exit 1;
|
8
8
|
fi' ]
|
9
9
|
initialDelaySeconds: 120
|
data/lib/templates/_volumes.yml
CHANGED
data/lib/templates/cd.sh
CHANGED
@@ -15,7 +15,7 @@ DOCKER_BUILD_CMD="<%=continuous_deployment.docker_build_cmd || 'build -f Dockerf
|
|
15
15
|
CI_COMMIT_SHA=$(git rev-parse --verify HEAD || :)
|
16
16
|
CI_COMMIT_SHA=${CI_COMMIT_SHA:-$(date +%s) }
|
17
17
|
DEPLOY_NAME="${IMAGE_NAME}:${CI_COMMIT_SHA}"
|
18
|
-
LATEST_NAME="${IMAGE_NAME}
|
18
|
+
LATEST_NAME="${IMAGE_NAME}:<%= continuous_deployment.image_tag || 'latest' %>"
|
19
19
|
|
20
20
|
if [ ! -z "$KB_AUTH_TOKEN" ]
|
21
21
|
then
|
@@ -37,10 +37,17 @@ then
|
|
37
37
|
fi
|
38
38
|
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
ALREADY_DEPLOYED="$(gcloud container images list-tags --format='get(tags)' $IMAGE_NAME | grep $CI_COMMIT_SHA || :;)"
|
41
|
+
if [ -z $ALREADY_DEPLOYED ]
|
42
|
+
then
|
43
|
+
## Build and push containers
|
44
|
+
echo "****** image not created yet, building image..."
|
45
|
+
docker $DOCKER_BUILD_CMD -t $DEPLOY_NAME .
|
46
|
+
docker push $DEPLOY_NAME
|
47
|
+
fi
|
48
|
+
|
49
|
+
echo "****** tagging image $DEPLOY_NAME as $LATEST_NAME"
|
42
50
|
docker tag $DEPLOY_NAME $LATEST_NAME
|
43
|
-
docker push $DEPLOY_NAME
|
44
51
|
docker push $LATEST_NAME
|
45
52
|
|
46
53
|
## Update new secrets defined in secrets.yml as ENV vars for deployments
|
@@ -54,5 +61,4 @@ for deployment in "${deployments[@]}"; do
|
|
54
61
|
[ -z "$deployment" ] && continue # if empty value
|
55
62
|
|
56
63
|
<%= include_template "_cd_apply_images.sh" %>
|
57
|
-
done
|
58
|
-
|
64
|
+
done
|
@@ -21,12 +21,7 @@ documents:
|
|
21
21
|
spec: &template_spec
|
22
22
|
containers:
|
23
23
|
- &app_container
|
24
|
-
|
25
|
-
image: '<%= continuous_deployment.image_name %>:latest'
|
26
|
-
<% else %>
|
27
|
-
image: '<%= continuous_deployment.image %>'
|
28
|
-
<% end %>
|
29
|
-
|
24
|
+
image: '<%= continuous_deployment.image_name %>:<%= continuous_deployment.image_tag || "latest" %>'
|
30
25
|
<% if deployment.command %>
|
31
26
|
command: ["/bin/bash", "-c", "<%= deployment.command %>"]
|
32
27
|
<% end %>
|
data/lib/templates/settings.rb
CHANGED
@@ -24,7 +24,8 @@ settings = {
|
|
24
24
|
certificate_domain: is_production ? 'myapp.com' : 'beta.myapp.com' # nil if domain is not required
|
25
25
|
},
|
26
26
|
continuous_deployment: {
|
27
|
-
|
27
|
+
image_name: "gcr.io/my-account/#{app_name}",
|
28
|
+
image_tag: 'latest',
|
28
29
|
project_name: 'my-project-name',
|
29
30
|
cluster_name: 'my-cluster-name',
|
30
31
|
cluster_region: 'europe-west4-a',
|
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.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- owen2345
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erb
|