k8s-deploy 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +12 -0
- data/.overcommit.yml +29 -0
- data/.rubocop.yml +16 -0
- data/.rubocop_todo.yml +29 -0
- data/CODE_OF_CONDUCT.md +133 -0
- data/CONTRIBUTING.md +63 -0
- data/Gemfile +11 -0
- data/LICENSE +21 -0
- data/README.md +55 -35
- data/Rakefile +8 -0
- data/lib/k8s-deploy/tasks/check.rb +2 -0
- data/lib/k8s-deploy/tasks/configuration.rb +6 -4
- data/lib/k8s-deploy/tasks/console_formatters.rb +3 -0
- data/lib/k8s-deploy/tasks/deploy.rb +5 -4
- data/lib/k8s-deploy/tasks/{k8s-deploy.rake → k8s_deploy.rake} +8 -6
- data/lib/k8s-deploy/tasks/status.rb +3 -1
- data/lib/k8s-deploy/tasks.rb +4 -1
- data/lib/k8s-deploy/version.rb +3 -2
- metadata +30 -14
- data/.gitignore +0 -13
- data/LICENSE.md +0 -21
- data/k8s-deploy.gemspec +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a7a0ca78a259fb7015ff1443449b73281f58d37fa9352b3ae6c822e1df6e4ff
|
4
|
+
data.tar.gz: abdd369612418be8747940c842e85719a15c3a6c7afdaf567f79a927729cfe88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6dd2d9a74dde82e29bc33ed72c0aedb9438abdec97fa4fe6bccd71bc1530f6c698c841f193995340979c4eb670125005aec625d6f7cb34493df9e90e5d9bc34
|
7
|
+
data.tar.gz: 7d056dc997c085dc8612da5355e1fb815105aef45b94721defce5051b62566ced901e996a89e98eaee94152c16d71253cbf5d732e3d57918c151dc3c608ba9d4
|
data/.editorconfig
ADDED
data/.overcommit.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PreCommit:
|
2
|
+
ALL:
|
3
|
+
on_warn: fail
|
4
|
+
BundleCheck:
|
5
|
+
enabled: true
|
6
|
+
FileSize:
|
7
|
+
enabled: true
|
8
|
+
size_limit_bytes: 1_000_000
|
9
|
+
ForbiddenBranches:
|
10
|
+
enabled: true
|
11
|
+
LineEndings:
|
12
|
+
enabled: true
|
13
|
+
RuboCop:
|
14
|
+
enabled: true
|
15
|
+
TrailingWhitespace:
|
16
|
+
enabled: true
|
17
|
+
YamlSyntax:
|
18
|
+
enabled: true
|
19
|
+
|
20
|
+
CommitMsg:
|
21
|
+
ALL:
|
22
|
+
on_warn: fail
|
23
|
+
# Disable some default Overcommit checks to avoid collisions with commitlint.
|
24
|
+
TextWidth:
|
25
|
+
enabled: false
|
26
|
+
CapitalizedSubject:
|
27
|
+
enabled: false
|
28
|
+
SingleLineSubject:
|
29
|
+
enabled: false
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# We want Exclude directives from different
|
2
|
+
# config files to get merged, not overwritten
|
3
|
+
inherit_mode:
|
4
|
+
merge:
|
5
|
+
- Exclude
|
6
|
+
|
7
|
+
inherit_from:
|
8
|
+
# Load configurations
|
9
|
+
- .rubocop_todo.yml
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
NewCops: enable
|
13
|
+
TargetRubyVersion: 2.0
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1000000`
|
3
|
+
# on 2023-05-04 16:31:35 UTC using RuboCop version 1.50.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 3
|
10
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Exclude:
|
13
|
+
- 'lib/k8s-deploy/tasks/deploy.rb'
|
14
|
+
- 'lib/k8s-deploy/tasks/status.rb'
|
15
|
+
|
16
|
+
# Offense count: 4
|
17
|
+
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
18
|
+
# AllowedMethods: refine
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Exclude:
|
21
|
+
- '**/*.gemspec'
|
22
|
+
- 'lib/k8s-deploy/tasks/k8s_deploy.rake'
|
23
|
+
|
24
|
+
# Offense count: 3
|
25
|
+
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
|
26
|
+
Metrics/MethodLength:
|
27
|
+
Exclude:
|
28
|
+
- 'lib/k8s-deploy/tasks/deploy.rb'
|
29
|
+
- 'lib/k8s-deploy/tasks/status.rb'
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
|
2
|
+
# Contributor Covenant Code of Conduct
|
3
|
+
|
4
|
+
## Our Pledge
|
5
|
+
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
10
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
11
|
+
identity and orientation.
|
12
|
+
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14
|
+
diverse, inclusive, and healthy community.
|
15
|
+
|
16
|
+
## Our Standards
|
17
|
+
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
19
|
+
community include:
|
20
|
+
|
21
|
+
* Demonstrating empathy and kindness toward other people
|
22
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
23
|
+
* Giving and gracefully accepting constructive feedback
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25
|
+
and learning from the experience
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
27
|
+
community
|
28
|
+
|
29
|
+
Examples of unacceptable behavior include:
|
30
|
+
|
31
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
32
|
+
any kind
|
33
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
34
|
+
* Public or private harassment
|
35
|
+
* Publishing others' private information, such as a physical or email address,
|
36
|
+
without their explicit permission
|
37
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
38
|
+
professional setting
|
39
|
+
|
40
|
+
## Enforcement Responsibilities
|
41
|
+
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45
|
+
or harmful.
|
46
|
+
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50
|
+
decisions when appropriate.
|
51
|
+
|
52
|
+
## Scope
|
53
|
+
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
55
|
+
an individual is officially representing the community in public spaces.
|
56
|
+
Examples of representing our community include using an official e-mail address,
|
57
|
+
posting via an official social media account, or acting as an appointed
|
58
|
+
representative at an online or offline event.
|
59
|
+
|
60
|
+
## Enforcement
|
61
|
+
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63
|
+
reported to the community leaders responsible for enforcement at
|
64
|
+
ospo@syngenta.com.
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
66
|
+
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
68
|
+
reporter of any incident.
|
69
|
+
|
70
|
+
## Enforcement Guidelines
|
71
|
+
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
74
|
+
|
75
|
+
### 1. Correction
|
76
|
+
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
78
|
+
unprofessional or unwelcome in the community.
|
79
|
+
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
83
|
+
|
84
|
+
### 2. Warning
|
85
|
+
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
87
|
+
actions.
|
88
|
+
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
94
|
+
ban.
|
95
|
+
|
96
|
+
### 3. Temporary Ban
|
97
|
+
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
99
|
+
sustained inappropriate behavior.
|
100
|
+
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
102
|
+
communication with the community for a specified period of time. No public or
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
105
|
+
Violating these terms may lead to a permanent ban.
|
106
|
+
|
107
|
+
### 4. Permanent Ban
|
108
|
+
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
112
|
+
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
114
|
+
community.
|
115
|
+
|
116
|
+
## Attribution
|
117
|
+
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
119
|
+
version 2.1, available at
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
121
|
+
|
122
|
+
Community Impact Guidelines were inspired by
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
124
|
+
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
127
|
+
[https://www.contributor-covenant.org/translations][translations].
|
128
|
+
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
130
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
- [Introduction](#introduction)
|
4
|
+
- [Reporting issues](#reporting-issues)
|
5
|
+
- [Contributing to code](#contributing-to-code)
|
6
|
+
- [Workflow for local development](#workflow-for-local-development)
|
7
|
+
- [Workflow for GitHub Codespaces in-browser development](#workflow-for-github-codespaces-in-browser-development)
|
8
|
+
- [About using VSCode](#about-using-vscode)
|
9
|
+
|
10
|
+
## Introduction
|
11
|
+
|
12
|
+
Contribution is welcome!
|
13
|
+
|
14
|
+
This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
15
|
+
|
16
|
+
## Reporting issues
|
17
|
+
|
18
|
+
Please, report any issues or bugs you find in the project's [Issues](https://github.com/syngenta/k8s-deploy/issues) section on GitHub.
|
19
|
+
|
20
|
+
## Contributing to code
|
21
|
+
|
22
|
+
### Workflow for local development
|
23
|
+
|
24
|
+
1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
|
25
|
+
2. [Clone the forked repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) to your local machine.
|
26
|
+
3. Create a new branch for your changes:
|
27
|
+
`git checkout -b "feat/my-new-feature"`.
|
28
|
+
4. Make your changes. We recommend using [VSCode + Docker](#about-using-vscode) locally.
|
29
|
+
5. Commit your changes:
|
30
|
+
`git commit -m "feat: my new feature"`.
|
31
|
+
6. Push your changes to your forked repo:
|
32
|
+
`git push origin feat/my-new-feature`.
|
33
|
+
7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
|
34
|
+
|
35
|
+
### Workflow for GitHub Codespaces in-browser development
|
36
|
+
|
37
|
+
1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
|
38
|
+
2. Open Codespaces by clicking the green button **Code** on the top right corner of the repo and then **Open with Codespaces**.
|
39
|
+
GitHub Codespaces will create and open a full-featured dev environment in the browser. You don't need to install anything locally.
|
40
|
+
3. Create a new branch for your changes:
|
41
|
+
`git checkout -b "feat/my-new-feature"`
|
42
|
+
4. Make your changes.
|
43
|
+
5. Commit your changes:
|
44
|
+
`git commit -m "feat: my new feature"`
|
45
|
+
6. Push your changes to your forked repo:
|
46
|
+
`git push origin feat/my-new-feature`
|
47
|
+
7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
|
48
|
+
|
49
|
+
### About using VSCode
|
50
|
+
|
51
|
+
The recommended way for local development is to use VSCode + Docker Desktop.
|
52
|
+
|
53
|
+
- [VSCode](https://code.visualstudio.com/)
|
54
|
+
- [Docker Desktop](https://www.docker.com/)
|
55
|
+
|
56
|
+
VSCode supports `.devcontainer` configuration that will automatically build a full-featured dev environment for you. All plugins and hooks are already configured for you.
|
57
|
+
|
58
|
+
```shell
|
59
|
+
git clone git@github.com:syngenta/k8s-deploy.git
|
60
|
+
cd k8s-deploy
|
61
|
+
|
62
|
+
code .
|
63
|
+
```
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright © 2016 Oleksii Leonov.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,19 +1,28 @@
|
|
1
|
-
|
2
|
-
=============
|
1
|
+
# k8s-deploy — automate deployments to Google Kubernetes Engine
|
3
2
|
|
4
|
-
Introduction
|
5
|
-
|
3
|
+
- [Introduction](#introduction)
|
4
|
+
- [Installation](#installation)
|
5
|
+
- [Configuration](#configuration)
|
6
|
+
- [Tasks](#tasks)
|
7
|
+
- [Contributing](#contributing)
|
8
|
+
- [License](#license)
|
6
9
|
|
7
|
-
|
10
|
+
## Introduction
|
8
11
|
|
9
|
-
This gem provides bunch of useful **Rake** tasks to automate
|
12
|
+
This gem provides a bunch of useful **Rake** tasks to automate deployment to the Kubernetes cluster in Google Kubernetes Engine (GKE):
|
10
13
|
|
11
|
-
|
12
|
-
|
14
|
+
- Show configuration for the environment.
|
15
|
+
- Show the status of running Deployment & Pods.
|
16
|
+
- Check GCloud/K8s configuration and GIT (branch, uncommitted changes, etc.).
|
17
|
+
- Build a new Docker image, push it to the registry, and patch Deployment.
|
18
|
+
- Rollback Deployment to the previous state.
|
19
|
+
- Scale Deployment to the desired number of replicas.
|
20
|
+
|
21
|
+
## Installation
|
13
22
|
|
14
23
|
### Bundler
|
15
24
|
|
16
|
-
Add gem to your Gemfile:
|
25
|
+
Add the gem to your Gemfile:
|
17
26
|
|
18
27
|
```ruby
|
19
28
|
gem 'k8s-deploy'
|
@@ -23,18 +32,17 @@ gem 'k8s-deploy'
|
|
23
32
|
|
24
33
|
Invoke the following command from your terminal:
|
25
34
|
|
26
|
-
```
|
35
|
+
```shell
|
27
36
|
gem install k8s-deploy
|
28
37
|
```
|
29
38
|
|
30
|
-
Configuration
|
31
|
-
-------------
|
39
|
+
## Configuration
|
32
40
|
|
33
|
-
1.
|
34
|
-
2. Add `require 'k8s-deploy/tasks'` to your Rakefile.
|
41
|
+
1. Put the `k8s-deploy.yml` configuration file into your project root.
|
42
|
+
2. Add `require 'k8s-deploy/tasks'` line to your Rakefile.
|
35
43
|
3. Check available tasks with `rake -T` command.
|
36
44
|
|
37
|
-
|
45
|
+
### Example of k8s-deploy.yml
|
38
46
|
|
39
47
|
```yml
|
40
48
|
production: # environment name
|
@@ -51,15 +59,15 @@ production: # environment name
|
|
51
59
|
|
52
60
|
You could add as many environments as you need (production, staging, test, etc.) to `k8s-deploy.yml`.
|
53
61
|
|
54
|
-
|
62
|
+
### Example of Rakefile file
|
55
63
|
|
56
64
|
```ruby
|
57
65
|
require 'k8s-deploy/tasks'
|
58
66
|
```
|
59
67
|
|
60
|
-
|
68
|
+
### Example of `rake -T` output
|
61
69
|
|
62
|
-
```
|
70
|
+
```shell
|
63
71
|
rake k8s:production:check # Check production ready for deploy
|
64
72
|
rake k8s:production:check:gcloud # Check production GCloud
|
65
73
|
rake k8s:production:check:git # Check production GIT
|
@@ -76,48 +84,60 @@ rake k8s:production:status:docker_image # Show production K8s Deployme
|
|
76
84
|
rake k8s:production:status:pods # Show production K8s Pods status
|
77
85
|
```
|
78
86
|
|
79
|
-
Tasks
|
80
|
-
-------------
|
87
|
+
## Tasks
|
81
88
|
|
82
89
|
All tasks have next structure:
|
83
90
|
|
84
|
-
```
|
91
|
+
```shell
|
85
92
|
rake k8s:<environment>:<main-task>:<sub-task>
|
86
93
|
```
|
87
94
|
|
88
95
|
### Main tasks
|
89
96
|
|
90
|
-
Show configuration for environment:
|
91
|
-
|
97
|
+
Show configuration for the environment:
|
98
|
+
|
99
|
+
```shell
|
92
100
|
rake k8s:<environment>:configuration
|
93
101
|
```
|
94
102
|
|
95
|
-
Show status of running Deployment & Pods:
|
96
|
-
|
103
|
+
Show the status of running Deployment & Pods:
|
104
|
+
|
105
|
+
```shell
|
97
106
|
rake k8s:<environment>:status
|
98
107
|
```
|
99
108
|
|
100
109
|
Check GCloud/K8s configuration and GIT (branch, uncommitted changes, etc.):
|
101
|
-
|
110
|
+
|
111
|
+
```shell
|
102
112
|
rake k8s:<environment>:check
|
103
113
|
```
|
104
114
|
|
105
|
-
Build new Docker image, push to registry, patch Deployment:
|
106
|
-
|
115
|
+
Build a new Docker image, push it to the registry, and patch Deployment:
|
116
|
+
|
117
|
+
```shell
|
107
118
|
rake k8s:<environment>:deploy
|
108
119
|
```
|
109
120
|
|
110
|
-
Rollback Deployment to previous state.
|
111
|
-
|
121
|
+
Rollback Deployment to the previous state.
|
122
|
+
|
123
|
+
```shell
|
112
124
|
rake k8s:<environment>:rollback
|
113
125
|
```
|
114
126
|
|
115
|
-
Scale Deployment to desired number of replicas.
|
116
|
-
|
127
|
+
Scale Deployment to the desired number of replicas.
|
128
|
+
|
129
|
+
```shell
|
117
130
|
rake k8s:<environment>:scale[1]
|
118
131
|
```
|
119
132
|
|
120
|
-
|
121
|
-
|
133
|
+
## Contributing
|
134
|
+
|
135
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/syngenta/k8s-deploy](https://github.com/syngenta/k8s-deploy).
|
136
|
+
|
137
|
+
Please, check our [Contribution guide](CONTRIBUTING.md) for more details.
|
138
|
+
|
139
|
+
This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
140
|
+
|
141
|
+
## License
|
122
142
|
|
123
|
-
The project uses the MIT License. See LICENSE
|
143
|
+
The project uses the MIT License. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
CONFIGURATION_OPTIONS = {
|
2
4
|
'git_branch' => 'GIT branch',
|
3
5
|
'dockerfile' => 'Path to Dockerfile',
|
@@ -13,10 +15,10 @@ CONFIGURATION_OPTIONS = {
|
|
13
15
|
def validate_configuration(configuration)
|
14
16
|
missed_parameters = CONFIGURATION_OPTIONS.keys - configuration.keys
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
return if missed_parameters.empty?
|
19
|
+
|
20
|
+
params_string = missed_parameters.join(', ')
|
21
|
+
raise "Missed parameters in configuration: #{params_string}."
|
20
22
|
end
|
21
23
|
|
22
24
|
def print_configuration(configuration)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
DELIMITER_WIDTH = 80
|
2
4
|
|
3
5
|
CONSOLE_COLORS = {
|
@@ -10,6 +12,7 @@ CONSOLE_COLORS = {
|
|
10
12
|
# colorizing output
|
11
13
|
def color_output(color)
|
12
14
|
raise 'Wrong color name' unless CONSOLE_COLORS.key?(color)
|
15
|
+
|
13
16
|
CONSOLE_COLORS[color] + yield.to_s + CONSOLE_COLORS[:no_color]
|
14
17
|
end
|
15
18
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
def build_timestamp
|
2
4
|
CURRENT_TIME.strftime('%Y%m%d%H%M%S')
|
3
5
|
end
|
4
6
|
|
5
7
|
def build_tag_name(git_hash)
|
6
|
-
build_timestamp
|
8
|
+
"#{build_timestamp}-#{git_hash}"
|
7
9
|
end
|
8
10
|
|
9
11
|
def get_git_hash(configuration)
|
@@ -91,16 +93,15 @@ def print_deploy_deployment_patch(configuration)
|
|
91
93
|
|
92
94
|
print color_output(:yellow) { 'Confirm deploy (y/N): ' }
|
93
95
|
|
94
|
-
|
96
|
+
puts
|
97
|
+
case $stdin.gets.strip
|
95
98
|
when 'Y', 'y', 'Yes', 'yes'
|
96
|
-
puts
|
97
99
|
puts color_output(:green) { 'Starting deploy...' }
|
98
100
|
system command
|
99
101
|
puts
|
100
102
|
puts 'Now you can check deploy status with ' \
|
101
103
|
"#{color_output(:yellow) { 'status' }} command."
|
102
104
|
else
|
103
|
-
puts
|
104
105
|
puts color_output(:red) { 'Deploy terminated.' }
|
105
106
|
exit 1
|
106
107
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'json'
|
3
5
|
require 'time'
|
4
6
|
|
5
|
-
require_relative 'console_formatters
|
6
|
-
require_relative 'configuration
|
7
|
-
require_relative 'status
|
8
|
-
require_relative 'check
|
9
|
-
require_relative 'deploy
|
7
|
+
require_relative 'console_formatters'
|
8
|
+
require_relative 'configuration'
|
9
|
+
require_relative 'status'
|
10
|
+
require_relative 'check'
|
11
|
+
require_relative 'deploy'
|
10
12
|
|
11
13
|
# Configuration file path
|
12
|
-
CONFIGURATION_FILE = 'k8s-deploy.yml'
|
14
|
+
CONFIGURATION_FILE = 'k8s-deploy.yml'
|
13
15
|
|
14
16
|
# Get start time
|
15
17
|
CURRENT_TIME = Time.now.utc
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
def print_deployment_status(configuration)
|
2
4
|
deployment_name = configuration['kubernetes_deployment_name']
|
3
5
|
|
@@ -57,7 +59,7 @@ def print_docker_image_status(configuration)
|
|
57
59
|
|
58
60
|
puts
|
59
61
|
begin
|
60
|
-
time_utc = Time.strptime(timestamp
|
62
|
+
time_utc = Time.strptime("#{timestamp} UTC", '%Y%m%d%H%M%S %Z')
|
61
63
|
puts "Timestamp:\t#{color_output(:green) { timestamp }}"
|
62
64
|
puts "Time (UTC):\t#{time_utc}"
|
63
65
|
puts "Time (local):\t#{time_utc.getlocal}"
|
data/lib/k8s-deploy/tasks.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake'
|
2
4
|
|
3
5
|
module K8sDeploy
|
6
|
+
# Rake tasks
|
4
7
|
class Tasks
|
5
8
|
include Rake::DSL if defined? Rake::DSL
|
6
9
|
def install_tasks
|
7
|
-
load 'k8s-deploy/tasks/
|
10
|
+
load 'k8s-deploy/tasks/k8s_deploy.rake'
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
data/lib/k8s-deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k8s-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksii Leonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -24,28 +24,44 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.2
|
27
|
-
description:
|
28
|
-
email:
|
27
|
+
description: Automate deployments to Google Kubernetes Engine (GKE)
|
28
|
+
email:
|
29
|
+
- mail@oleksiileonov.com
|
30
|
+
- oleksii.leonov@syngenta.com
|
31
|
+
- ospo@syngenta.com
|
29
32
|
executables: []
|
30
33
|
extensions: []
|
31
|
-
extra_rdoc_files:
|
34
|
+
extra_rdoc_files:
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
32
37
|
files:
|
33
|
-
- ".
|
34
|
-
-
|
38
|
+
- ".editorconfig"
|
39
|
+
- ".overcommit.yml"
|
40
|
+
- ".rubocop.yml"
|
41
|
+
- ".rubocop_todo.yml"
|
42
|
+
- CODE_OF_CONDUCT.md
|
43
|
+
- CONTRIBUTING.md
|
44
|
+
- Gemfile
|
45
|
+
- LICENSE
|
35
46
|
- README.md
|
36
|
-
-
|
47
|
+
- Rakefile
|
37
48
|
- lib/k8s-deploy/tasks.rb
|
38
49
|
- lib/k8s-deploy/tasks/check.rb
|
39
50
|
- lib/k8s-deploy/tasks/configuration.rb
|
40
51
|
- lib/k8s-deploy/tasks/console_formatters.rb
|
41
52
|
- lib/k8s-deploy/tasks/deploy.rb
|
42
|
-
- lib/k8s-deploy/tasks/
|
53
|
+
- lib/k8s-deploy/tasks/k8s_deploy.rake
|
43
54
|
- lib/k8s-deploy/tasks/status.rb
|
44
55
|
- lib/k8s-deploy/version.rb
|
45
|
-
homepage: https://github.com/
|
56
|
+
homepage: https://github.com/syngenta/k8s-deploy
|
46
57
|
licenses:
|
47
58
|
- MIT
|
48
|
-
metadata:
|
59
|
+
metadata:
|
60
|
+
homepage_uri: https://github.com/syngenta/k8s-deploy
|
61
|
+
source_code_uri: https://github.com/syngenta/k8s-deploy
|
62
|
+
documentation_uri: https://github.com/syngenta/k8s-deploy
|
63
|
+
bug_tracker_uri: https://github.com/syngenta/k8s-deploy/issues
|
64
|
+
rubygems_mfa_required: 'true'
|
49
65
|
post_install_message:
|
50
66
|
rdoc_options: []
|
51
67
|
require_paths:
|
@@ -54,15 +70,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
70
|
requirements:
|
55
71
|
- - ">="
|
56
72
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
73
|
+
version: 2.0.0
|
58
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
75
|
requirements:
|
60
76
|
- - ">="
|
61
77
|
- !ruby/object:Gem::Version
|
62
78
|
version: '0'
|
63
79
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
80
|
+
rubygems_version: 3.4.10
|
65
81
|
signing_key:
|
66
82
|
specification_version: 4
|
67
|
-
summary: automate
|
83
|
+
summary: k8s-deploy — automate deployments to Google Kubernetes Engine
|
68
84
|
test_files: []
|
data/.gitignore
DELETED
data/LICENSE.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License
|
2
|
-
===============
|
3
|
-
|
4
|
-
Copyright © 2016 Oleksii Leonov.
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
-
this software and associated documentation files (the 'Software'), to deal in
|
8
|
-
the Software without restriction, including without limitation the rights to
|
9
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
10
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
11
|
-
subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
18
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
19
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
20
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/k8s-deploy.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.expand_path('../lib/k8s-deploy/version', __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = 'k8s-deploy'
|
5
|
-
s.version = K8sDeploy::VERSION.dup
|
6
|
-
s.date = Time.now.strftime('%Y-%m-%d')
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.author = 'Oleksii Leonov'
|
9
|
-
s.email = 'mail@aleksejleonov.com'
|
10
|
-
s.homepage = 'https://github.com/cropio/k8s-deploy'
|
11
|
-
s.summary = 'automate deploy to Kubernetes.'
|
12
|
-
s.description = 'automate deploy to Kubernetes.'
|
13
|
-
s.license = 'MIT'
|
14
|
-
|
15
|
-
s.required_ruby_version = '>= 1.9.1'
|
16
|
-
s.add_dependency 'rake', '>= 0.8.2'
|
17
|
-
|
18
|
-
s.files = `git ls-files`.split("\n")
|
19
|
-
end
|