mirror of
https://github.com/puppetlabs/vmpooler-provider-gce.git
synced 2026-01-26 03:18:41 -05:00
Compare commits
90 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fce29feb60 | ||
|
|
651e4ba892 | ||
|
|
ec6383fac8 | ||
|
|
a5c4805106 | ||
|
|
fff2b5c766 | ||
|
|
8eec9a765f | ||
|
|
2d56355b74 | ||
|
|
bbce7bd019 | ||
|
|
428f7a041d | ||
|
|
5cad1c9711 | ||
|
|
01a0446e03 | ||
|
|
9639a2df7f | ||
|
|
e58c1a8bb3 | ||
|
|
81c59cfc9a | ||
|
|
493e358ba1 | ||
|
|
11405592c3 | ||
|
|
fbd6c7e505 | ||
|
|
f26108277e | ||
|
|
cec4ea64d6 | ||
|
|
2753d5da2a | ||
|
|
0347c42735 | ||
|
|
d3713133c8 | ||
|
|
62da7dd6ba | ||
|
|
521a0f11f1 | ||
|
|
726a598abc | ||
|
|
e0cc9712ed | ||
|
|
ea9896104a | ||
|
|
ac3ae71ac8 | ||
|
|
ce61a7a6c2 | ||
|
|
dc31dee2a4 | ||
|
|
2d4ff56429 | ||
|
|
2971ee6082 | ||
|
|
80234b4337 | ||
|
|
8795d3a818 | ||
|
|
515ba9f0a5 | ||
|
|
3c5f71aea2 | ||
|
|
bf2e20dcfe | ||
|
|
bee66557ea | ||
|
|
355d3a60ce | ||
|
|
06d940a964 | ||
|
|
1aaa6711b5 | ||
|
|
38064771aa | ||
|
|
fcf79c9421 | ||
|
|
36e9044087 | ||
|
|
1375093b43 | ||
|
|
911c15dc4e | ||
|
|
d8c47134ef | ||
|
|
8015a18ea4 | ||
|
|
407b3f09dd | ||
|
|
aaf2112166 | ||
|
|
0883fe8f0d | ||
|
|
b8e630ed17 | ||
|
|
cbec1d9d3a | ||
|
|
e8c3e2f8ba | ||
|
|
30c524922c | ||
|
|
dd1829abf8 | ||
|
|
1d8b9c5ab9 | ||
|
|
91cf44d54a | ||
|
|
733856809c | ||
|
|
6d0842d48b | ||
|
|
4afe1db81b | ||
|
|
97eb08011c | ||
|
|
992d35003c | ||
|
|
f93610a3ff | ||
|
|
d1c9d946f6 | ||
|
|
8451e2834d | ||
|
|
c2f6868237 | ||
|
|
84a026e8ad | ||
|
|
3c95190eae | ||
|
|
26327210a4 | ||
|
|
b94d54f129 | ||
|
|
9d5d0d7c2d | ||
|
|
2a39a8cf06 | ||
|
|
79516d8014 | ||
|
|
7d399da016 | ||
|
|
46b9c5aef0 | ||
|
|
3d21d543b5 | ||
|
|
dc6c5c491e | ||
|
|
39d6d0d849 | ||
|
|
e06917dd92 | ||
| c6533af9ed | |||
|
|
f297108aa2 | ||
|
|
a1ea9f7b5a | ||
|
|
5074ad4840 | ||
|
|
65965dd542 | ||
|
|
b62580df0a | ||
|
|
336f417b4f | ||
|
|
c6ca569fce | ||
|
|
614c474305 | ||
|
|
761fc6cbb1 |
22 changed files with 654 additions and 110 deletions
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
|
|
@ -3,6 +3,11 @@ updates:
|
||||||
- package-ecosystem: bundler
|
- package-ecosystem: bundler
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "13:00"
|
open-pull-requests-limit: 10
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
|
|
||||||
12
.github/workflows/auto_release_prep.yml
vendored
Normal file
12
.github/workflows/auto_release_prep.yml
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
name: Automated release prep
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto_release_prep:
|
||||||
|
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/auto_release_prep.yml@v1
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
project-type: ruby
|
||||||
|
version-file-path: lib/vmpooler-provider-gce/version.rb
|
||||||
8
.github/workflows/dependabot_merge.yml
vendored
Normal file
8
.github/workflows/dependabot_merge.yml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
name: Dependabot auto-merge
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependabot_merge:
|
||||||
|
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/dependabot_merge.yml@v1
|
||||||
|
secrets: inherit
|
||||||
8
.github/workflows/ensure_label.yml
vendored
Normal file
8
.github/workflows/ensure_label.yml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
name: Ensure label
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ensure_label:
|
||||||
|
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/ensure_label.yml@v1
|
||||||
|
secrets: inherit
|
||||||
70
.github/workflows/release.yml
vendored
70
.github/workflows/release.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Release
|
name: Release Gem
|
||||||
|
|
||||||
on: workflow_dispatch
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
|
@ -7,25 +7,77 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'puppetlabs/vmpooler-provider-gce'
|
if: github.repository == 'puppetlabs/vmpooler-provider-gce'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Get Version
|
|
||||||
id: gv
|
- name: Get Current Version
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
id: cv
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { data: response } = await github.rest.repos.getLatestRelease({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
})
|
||||||
|
console.log(`The latest release is ${response.tag_name}`)
|
||||||
|
return response.tag_name
|
||||||
|
result-encoding: string
|
||||||
|
|
||||||
|
- name: Get Next Version
|
||||||
|
id: nv
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=ver::$(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)"
|
version=$(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
echo "Found version $version from lib/vmpooler-provider-gce/version.rb"
|
||||||
|
|
||||||
|
- name: Generate Changelog
|
||||||
|
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
|
||||||
|
with:
|
||||||
|
args: >-
|
||||||
|
--future-release ${{ steps.nv.outputs.version }}
|
||||||
|
env:
|
||||||
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Validate Changelog
|
||||||
|
run : |
|
||||||
|
set -e
|
||||||
|
if [[ -n $(git status --porcelain) ]]; then
|
||||||
|
echo "Here is the current git status:"
|
||||||
|
git status
|
||||||
|
echo
|
||||||
|
echo "The following changes were detected:"
|
||||||
|
git --no-pager diff
|
||||||
|
echo "Uncommitted PRs found in the changelog. Please submit a release prep PR of changes after running `./update-changelog`"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate Release Notes
|
||||||
|
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
|
||||||
|
with:
|
||||||
|
args: >-
|
||||||
|
--since-tag ${{ steps.cv.outputs.result }}
|
||||||
|
--future-release ${{ steps.nv.outputs.version }}
|
||||||
|
--output release-notes.md
|
||||||
|
env:
|
||||||
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Tag Release
|
- name: Tag Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
tag: ${{ steps.gv.outputs.ver }}
|
tag: ${{ steps.nv.outputs.version }}
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
bodyfile: release-notes.md
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
generateReleaseNotes: true
|
|
||||||
- name: Install Ruby 2.5.8
|
# This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
|
||||||
|
- name: Install Ruby jruby-9.4.3.0
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: '2.5.8'
|
ruby-version: 'jruby-9.4.3.0'
|
||||||
|
|
||||||
- name: Build gem
|
- name: Build gem
|
||||||
run: gem build *.gemspec
|
run: gem build *.gemspec
|
||||||
|
|
||||||
- name: Publish gem
|
- name: Publish gem
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/.gem
|
mkdir -p $HOME/.gem
|
||||||
|
|
|
||||||
39
.github/workflows/security.yml
vendored
Normal file
39
.github/workflows/security.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
name: Security
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
scan:
|
||||||
|
name: Mend Scanning
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repo content
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
- name: setup ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: 2.7
|
||||||
|
# setup a package lock if one doesn't exist, otherwise do nothing
|
||||||
|
- name: check lock
|
||||||
|
run: '[ -f "Gemfile.lock" ] && echo "package lock file exists, skipping" || bundle lock'
|
||||||
|
# install java
|
||||||
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
|
java-version: '17'
|
||||||
|
# download mend
|
||||||
|
- name: download_mend
|
||||||
|
run: curl -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
|
||||||
|
- name: run mend
|
||||||
|
run: java -jar wss-unified-agent.jar
|
||||||
|
env:
|
||||||
|
WS_APIKEY: ${{ secrets.MEND_API_KEY }}
|
||||||
|
WS_WSS_URL: https://saas-eu.whitesourcesoftware.com/agent
|
||||||
|
WS_USERKEY: ${{ secrets.MEND_TOKEN }}
|
||||||
|
WS_PRODUCTNAME: RE
|
||||||
|
WS_PROJECTNAME: ${{ github.event.repository.name }}
|
||||||
9
.github/workflows/testing.yml
vendored
9
.github/workflows/testing.yml
vendored
|
|
@ -18,9 +18,9 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby-version:
|
ruby-version:
|
||||||
- '2.5.8'
|
- 'jruby-9.4.3.0'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
|
|
@ -34,10 +34,9 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby-version:
|
ruby-version:
|
||||||
- '2.5.8'
|
- 'jruby-9.4.3.0'
|
||||||
- 'jruby-9.2.12.0'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
3
.github_changelog_generator
Normal file
3
.github_changelog_generator
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
project=vmpooler-provider-gce
|
||||||
|
user=puppetlabs
|
||||||
|
exclude_labels=maintenance
|
||||||
110
CHANGELOG.md
Normal file
110
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.3.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.3.0) (2023-08-18)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.2.0...1.3.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- \(POD-10\) Log reason for failed VM checks. [\#33](https://github.com/puppetlabs/vmpooler-provider-gce/pull/33) ([isaac-hammes](https://github.com/isaac-hammes))
|
||||||
|
|
||||||
|
## [1.2.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.2.0) (2023-08-10)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.1.0...1.2.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Bump jruby to 9.4.3.0 and update lockfile [\#31](https://github.com/puppetlabs/vmpooler-provider-gce/pull/31) ([yachub](https://github.com/yachub))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Bump thor from 1.2.1 to 1.2.2 [\#29](https://github.com/puppetlabs/vmpooler-provider-gce/pull/29) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
|
||||||
|
## [1.1.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.1.0) (2023-05-01)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.0.0...1.1.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Migrate issue management to Jira [\#27](https://github.com/puppetlabs/vmpooler-provider-gce/pull/27) ([yachub](https://github.com/yachub))
|
||||||
|
- Bump jruby to 9.4.2.0 [\#26](https://github.com/puppetlabs/vmpooler-provider-gce/pull/26) ([yachub](https://github.com/yachub))
|
||||||
|
- Bump rack-test from 2.0.2 to 2.1.0 [\#24](https://github.com/puppetlabs/vmpooler-provider-gce/pull/24) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Update googleauth requirement from \>= 0.16.2, \< 1.3.0 to \>= 0.16.2, \< 1.4.0 [\#18](https://github.com/puppetlabs/vmpooler-provider-gce/pull/18) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
|
||||||
|
## [1.0.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.0.0) (2023-04-19)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.5.0...1.0.0)
|
||||||
|
|
||||||
|
**Breaking changes:**
|
||||||
|
|
||||||
|
- \(RE-15124\) Decouple DNS Record Management into DNS Plugins [\#21](https://github.com/puppetlabs/vmpooler-provider-gce/pull/21) ([yachub](https://github.com/yachub))
|
||||||
|
|
||||||
|
## [0.5.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.5.0) (2023-03-06)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.4.0...0.5.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- \(RE-15161\) Update to jruby-9.4.1.0 and move socket timeout to new method. [\#22](https://github.com/puppetlabs/vmpooler-provider-gce/pull/22) ([isaac-hammes](https://github.com/isaac-hammes))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add docs and update actions [\#20](https://github.com/puppetlabs/vmpooler-provider-gce/pull/20) ([yachub](https://github.com/yachub))
|
||||||
|
- \(RE-15111\) Migrate Snyk to Mend Scanning [\#19](https://github.com/puppetlabs/vmpooler-provider-gce/pull/19) ([yachub](https://github.com/yachub))
|
||||||
|
- \(RE-14811\) Remove DIO as codeowners [\#17](https://github.com/puppetlabs/vmpooler-provider-gce/pull/17) ([yachub](https://github.com/yachub))
|
||||||
|
- Add Snyk action [\#16](https://github.com/puppetlabs/vmpooler-provider-gce/pull/16) ([yachub](https://github.com/yachub))
|
||||||
|
- Add release-engineering to codeowners [\#15](https://github.com/puppetlabs/vmpooler-provider-gce/pull/15) ([yachub](https://github.com/yachub))
|
||||||
|
|
||||||
|
## [0.4.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.4.0) (2022-07-27)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.3.0...0.4.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- \(maint\) Refactor cloud dns [\#13](https://github.com/puppetlabs/vmpooler-provider-gce/pull/13) ([sbeaulie](https://github.com/sbeaulie))
|
||||||
|
- Update googleauth requirement from \>= 0.16.2, \< 1.2.0 to \>= 0.16.2, \< 1.3.0 [\#12](https://github.com/puppetlabs/vmpooler-provider-gce/pull/12) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
|
||||||
|
## [0.3.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.3.0) (2022-06-21)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.2.0...0.3.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- release prep 0.3.0 [\#11](https://github.com/puppetlabs/vmpooler-provider-gce/pull/11) ([sbeaulie](https://github.com/sbeaulie))
|
||||||
|
- \(DIO-3162\) vmpooler gce provider to support disk type \(to use ssd\) [\#10](https://github.com/puppetlabs/vmpooler-provider-gce/pull/10) ([sbeaulie](https://github.com/sbeaulie))
|
||||||
|
|
||||||
|
## [0.2.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.2.0) (2022-04-19)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.2...0.2.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Set hostname for instance during create\_vm [\#8](https://github.com/puppetlabs/vmpooler-provider-gce/pull/8) ([yachub](https://github.com/yachub))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- 0.2.0 release prep [\#9](https://github.com/puppetlabs/vmpooler-provider-gce/pull/9) ([yachub](https://github.com/yachub))
|
||||||
|
- Update vmpooler requirement from ~\> 1.3, \>= 1.3.0 to \>= 1.3.0, ~\> 2.3 [\#7](https://github.com/puppetlabs/vmpooler-provider-gce/pull/7) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Update googleauth requirement from ~\> 0.16.2 to \>= 0.16.2, \< 1.2.0 [\#6](https://github.com/puppetlabs/vmpooler-provider-gce/pull/6) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
|
||||||
|
## [0.1.2](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.2) (2022-01-10)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.1...0.1.2)
|
||||||
|
|
||||||
|
## [0.1.1](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.1) (2022-01-10)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.0...0.1.1)
|
||||||
|
|
||||||
|
## [0.1.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.0) (2022-01-10)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/588e29b6e100327336bf0910ae16b6a85ffe279a...0.1.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Adding the cloud DNS API library and related methods [\#4](https://github.com/puppetlabs/vmpooler-provider-gce/pull/4) ([sbeaulie](https://github.com/sbeaulie))
|
||||||
|
- fix simplecov with jruby, add a .rubocop.yml config file [\#3](https://github.com/puppetlabs/vmpooler-provider-gce/pull/3) ([sbeaulie](https://github.com/sbeaulie))
|
||||||
|
- Add a release workflow for pushing to Rubygems [\#1](https://github.com/puppetlabs/vmpooler-provider-gce/pull/1) ([genebean](https://github.com/genebean))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
# This will cause DIO to be assigned review of any opened PRs against
|
# This will cause RE to be assigned review of any opened PRs against
|
||||||
# the branches containing this file.
|
# the branches containing this file.
|
||||||
# See https://help.github.com/en/articles/about-code-owners for info on how to
|
# See https://help.github.com/en/articles/about-code-owners for info on how to
|
||||||
# take ownership of parts of the code base that should be reviewed by another
|
# take ownership of parts of the code base that should be reviewed by another
|
||||||
# team.
|
# team.
|
||||||
|
|
||||||
# DIO will be the default owners for everything in the repo.
|
# RE will be the default owners for everything in the repo.
|
||||||
* @puppetlabs/dio
|
* @puppetlabs/release-engineering
|
||||||
|
|
||||||
|
|
|
||||||
239
Gemfile.lock
Normal file
239
Gemfile.lock
Normal file
|
|
@ -0,0 +1,239 @@
|
||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
vmpooler-provider-gce (1.3.0)
|
||||||
|
google-apis-compute_v1 (~> 0.14)
|
||||||
|
googleauth (>= 0.16.2, < 1.4.0)
|
||||||
|
vmpooler (~> 3.0)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
addressable (2.8.5)
|
||||||
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
|
ast (2.4.2)
|
||||||
|
bindata (2.4.15)
|
||||||
|
builder (3.2.4)
|
||||||
|
climate_control (1.2.0)
|
||||||
|
coderay (1.1.3)
|
||||||
|
concurrent-ruby (1.2.2)
|
||||||
|
connection_pool (2.4.1)
|
||||||
|
declarative (0.0.20)
|
||||||
|
deep_merge (1.2.2)
|
||||||
|
diff-lcs (1.5.0)
|
||||||
|
docile (1.4.0)
|
||||||
|
faraday (2.7.10)
|
||||||
|
faraday-net_http (>= 2.0, < 3.1)
|
||||||
|
ruby2_keywords (>= 0.0.4)
|
||||||
|
faraday-net_http (3.0.2)
|
||||||
|
ffi (1.15.5-java)
|
||||||
|
google-apis-compute_v1 (0.75.0)
|
||||||
|
google-apis-core (>= 0.11.0, < 2.a)
|
||||||
|
google-apis-core (0.11.1)
|
||||||
|
addressable (~> 2.5, >= 2.5.1)
|
||||||
|
googleauth (>= 0.16.2, < 2.a)
|
||||||
|
httpclient (>= 2.8.1, < 3.a)
|
||||||
|
mini_mime (~> 1.0)
|
||||||
|
representable (~> 3.0)
|
||||||
|
retriable (>= 2.0, < 4.a)
|
||||||
|
rexml
|
||||||
|
webrick
|
||||||
|
google-cloud-env (1.6.0)
|
||||||
|
faraday (>= 0.17.3, < 3.0)
|
||||||
|
googleauth (1.3.0)
|
||||||
|
faraday (>= 0.17.3, < 3.a)
|
||||||
|
jwt (>= 1.4, < 3.0)
|
||||||
|
memoist (~> 0.16)
|
||||||
|
multi_json (~> 1.11)
|
||||||
|
os (>= 0.9, < 2.0)
|
||||||
|
signet (>= 0.16, < 2.a)
|
||||||
|
httpclient (2.8.3)
|
||||||
|
jwt (2.7.1)
|
||||||
|
memoist (0.16.2)
|
||||||
|
method_source (1.0.0)
|
||||||
|
mini_mime (1.1.5)
|
||||||
|
mock_redis (0.37.0)
|
||||||
|
multi_json (1.15.0)
|
||||||
|
mustermann (3.0.0)
|
||||||
|
ruby2_keywords (~> 0.0.1)
|
||||||
|
net-ldap (0.18.0)
|
||||||
|
nio4r (2.5.9)
|
||||||
|
nio4r (2.5.9-java)
|
||||||
|
opentelemetry-api (1.2.1)
|
||||||
|
opentelemetry-common (0.20.0)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-exporter-jaeger (0.23.0)
|
||||||
|
opentelemetry-api (~> 1.1)
|
||||||
|
opentelemetry-common (~> 0.20)
|
||||||
|
opentelemetry-sdk (~> 1.2)
|
||||||
|
opentelemetry-semantic_conventions
|
||||||
|
thrift
|
||||||
|
opentelemetry-instrumentation-base (0.22.2)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-registry (~> 0.1)
|
||||||
|
opentelemetry-instrumentation-concurrent_ruby (0.21.1)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||||
|
opentelemetry-instrumentation-http_client (0.22.2)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-common (~> 0.20.0)
|
||||||
|
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||||
|
opentelemetry-instrumentation-rack (0.23.4)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-common (~> 0.20.0)
|
||||||
|
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||||
|
opentelemetry-instrumentation-redis (0.25.3)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-common (~> 0.20.0)
|
||||||
|
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||||
|
opentelemetry-instrumentation-sinatra (0.23.2)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
opentelemetry-common (~> 0.20.0)
|
||||||
|
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||||
|
opentelemetry-instrumentation-rack (~> 0.21)
|
||||||
|
opentelemetry-registry (0.3.0)
|
||||||
|
opentelemetry-api (~> 1.1)
|
||||||
|
opentelemetry-resource_detectors (0.24.1)
|
||||||
|
google-cloud-env
|
||||||
|
opentelemetry-sdk (~> 1.0)
|
||||||
|
opentelemetry-sdk (1.3.0)
|
||||||
|
opentelemetry-api (~> 1.1)
|
||||||
|
opentelemetry-common (~> 0.20)
|
||||||
|
opentelemetry-registry (~> 0.2)
|
||||||
|
opentelemetry-semantic_conventions
|
||||||
|
opentelemetry-semantic_conventions (1.10.0)
|
||||||
|
opentelemetry-api (~> 1.0)
|
||||||
|
os (1.1.4)
|
||||||
|
parallel (1.23.0)
|
||||||
|
parser (3.2.2.3)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
|
pickup (0.0.11)
|
||||||
|
prometheus-client (4.2.1)
|
||||||
|
pry (0.14.2)
|
||||||
|
coderay (~> 1.1)
|
||||||
|
method_source (~> 1.0)
|
||||||
|
pry (0.14.2-java)
|
||||||
|
coderay (~> 1.1)
|
||||||
|
method_source (~> 1.0)
|
||||||
|
spoon (~> 0.0)
|
||||||
|
public_suffix (5.0.3)
|
||||||
|
puma (6.3.0)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
puma (6.3.0-java)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
racc (1.7.1)
|
||||||
|
racc (1.7.1-java)
|
||||||
|
rack (2.2.8)
|
||||||
|
rack-protection (3.1.0)
|
||||||
|
rack (~> 2.2, >= 2.2.4)
|
||||||
|
rack-test (2.1.0)
|
||||||
|
rack (>= 1.3)
|
||||||
|
rainbow (3.1.1)
|
||||||
|
rake (13.0.6)
|
||||||
|
redis (4.8.1)
|
||||||
|
regexp_parser (2.8.1)
|
||||||
|
representable (3.2.0)
|
||||||
|
declarative (< 0.1.0)
|
||||||
|
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||||
|
uber (< 0.2.0)
|
||||||
|
retriable (3.1.2)
|
||||||
|
rexml (3.2.6)
|
||||||
|
rspec (3.12.0)
|
||||||
|
rspec-core (~> 3.12.0)
|
||||||
|
rspec-expectations (~> 3.12.0)
|
||||||
|
rspec-mocks (~> 3.12.0)
|
||||||
|
rspec-core (3.12.2)
|
||||||
|
rspec-support (~> 3.12.0)
|
||||||
|
rspec-expectations (3.12.3)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.12.0)
|
||||||
|
rspec-mocks (3.12.6)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.12.0)
|
||||||
|
rspec-support (3.12.1)
|
||||||
|
rubocop (1.1.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 2.7.1.5)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8)
|
||||||
|
rexml
|
||||||
|
rubocop-ast (>= 1.0.1)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 1.4.0, < 2.0)
|
||||||
|
rubocop-ast (1.29.0)
|
||||||
|
parser (>= 3.2.1.0)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
ruby2_keywords (0.0.5)
|
||||||
|
signet (0.17.0)
|
||||||
|
addressable (~> 2.8)
|
||||||
|
faraday (>= 0.17.5, < 3.a)
|
||||||
|
jwt (>= 1.5, < 3.0)
|
||||||
|
multi_json (~> 1.10)
|
||||||
|
simplecov (0.22.0)
|
||||||
|
docile (~> 1.1)
|
||||||
|
simplecov-html (~> 0.11)
|
||||||
|
simplecov_json_formatter (~> 0.1)
|
||||||
|
simplecov-html (0.12.3)
|
||||||
|
simplecov_json_formatter (0.1.4)
|
||||||
|
sinatra (3.1.0)
|
||||||
|
mustermann (~> 3.0)
|
||||||
|
rack (~> 2.2, >= 2.2.4)
|
||||||
|
rack-protection (= 3.1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
spicy-proton (2.1.15)
|
||||||
|
bindata (~> 2.3)
|
||||||
|
spoon (0.0.6)
|
||||||
|
ffi
|
||||||
|
statsd-ruby (1.5.0)
|
||||||
|
thor (1.2.2)
|
||||||
|
thrift (0.18.1)
|
||||||
|
tilt (2.2.0)
|
||||||
|
trailblazer-option (0.1.2)
|
||||||
|
uber (0.1.0)
|
||||||
|
unicode-display_width (1.8.0)
|
||||||
|
vmpooler (3.2.0)
|
||||||
|
concurrent-ruby (~> 1.1)
|
||||||
|
connection_pool (~> 2.2)
|
||||||
|
deep_merge (~> 1.2)
|
||||||
|
net-ldap (~> 0.16)
|
||||||
|
opentelemetry-exporter-jaeger (= 0.23.0)
|
||||||
|
opentelemetry-instrumentation-concurrent_ruby (= 0.21.1)
|
||||||
|
opentelemetry-instrumentation-http_client (= 0.22.2)
|
||||||
|
opentelemetry-instrumentation-redis (= 0.25.3)
|
||||||
|
opentelemetry-instrumentation-sinatra (= 0.23.2)
|
||||||
|
opentelemetry-resource_detectors (= 0.24.1)
|
||||||
|
opentelemetry-sdk (~> 1.3, >= 1.3.0)
|
||||||
|
pickup (~> 0.0.11)
|
||||||
|
prometheus-client (>= 2, < 5)
|
||||||
|
puma (>= 5.0.4, < 7)
|
||||||
|
rack (>= 2.2, < 4.0)
|
||||||
|
rake (~> 13.0)
|
||||||
|
redis (~> 4.1)
|
||||||
|
sinatra (>= 2, < 4)
|
||||||
|
spicy-proton (~> 2.1)
|
||||||
|
statsd-ruby (~> 1.4)
|
||||||
|
webrick (1.8.1)
|
||||||
|
yarjuf (2.0.0)
|
||||||
|
builder
|
||||||
|
rspec (~> 3)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
universal-java-1.8
|
||||||
|
universal-java-11
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
climate_control (>= 0.2.0)
|
||||||
|
mock_redis (>= 0.17.0)
|
||||||
|
pry
|
||||||
|
rack-test (>= 0.6)
|
||||||
|
rspec (>= 3.2)
|
||||||
|
rubocop (~> 1.1.0)
|
||||||
|
simplecov (>= 0.11.2)
|
||||||
|
thor (~> 1.0, >= 1.0.1)
|
||||||
|
vmpooler-provider-gce!
|
||||||
|
yarjuf (>= 2.0)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.7
|
||||||
62
README.md
62
README.md
|
|
@ -1,5 +1,15 @@
|
||||||
# vmpooler-provider-gce
|
# vmpooler-provider-gce
|
||||||
|
|
||||||
|
- [vmpooler-provider-gce](#vmpooler-provider-gce)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Migrating to v1](#migrating-to-v1)
|
||||||
|
- [DNS](#dns)
|
||||||
|
- [Labels](#labels)
|
||||||
|
- [Pre-requisite](#pre-requisite)
|
||||||
|
- [Update the Gemfile Lock](#update-the-gemfile-lock)
|
||||||
|
- [Releasing](#releasing)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
This is a provider for [VMPooler](https://github.com/puppetlabs/vmpooler) allows using GCE to create instances, disks,
|
This is a provider for [VMPooler](https://github.com/puppetlabs/vmpooler) allows using GCE to create instances, disks,
|
||||||
snapshots, or destroy instances for specific pools.
|
snapshots, or destroy instances for specific pools.
|
||||||
|
|
||||||
|
|
@ -14,6 +24,42 @@ GCE authorization is handled via a service account (or personal account) private
|
||||||
|
|
||||||
1. GOOGLE_APPLICATION_CREDENTIALS environment variable eg GOOGLE_APPLICATION_CREDENTIALS=/my/home/directory/my_account_key.json
|
1. GOOGLE_APPLICATION_CREDENTIALS environment variable eg GOOGLE_APPLICATION_CREDENTIALS=/my/home/directory/my_account_key.json
|
||||||
|
|
||||||
|
### Migrating to v1
|
||||||
|
|
||||||
|
Starting with the v1.x release, management of DNS records has been extracted from this compute provider and implemented as DNS plugins, similar to compute providers. This means each pool configuration should be pointing to a configuration object in `:dns_config` to determine it's method of record management.
|
||||||
|
|
||||||
|
For those using DNS management via this provider, the DNS related options should be moved under `:dns_configs:<INSERT_YOUR_OWN_SYMBOL>` with the value for `dns_class`.
|
||||||
|
|
||||||
|
For example, the following keys in a v0.x GCE provider config:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
:providers:
|
||||||
|
:gce:
|
||||||
|
domain: vmpooler.example.com
|
||||||
|
dns_zone_resource_name: vmpooler-example-com
|
||||||
|
```
|
||||||
|
|
||||||
|
Would be moved to:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
:dns_configs:
|
||||||
|
:example:
|
||||||
|
dns_class: gcp-clouddns
|
||||||
|
project: jake-vmpooler-dev
|
||||||
|
domain: vmpooler.example.com
|
||||||
|
zone_name: vmpooler-example-com
|
||||||
|
```
|
||||||
|
|
||||||
|
Then any pools that should have records created via the dns config above should now reference the named dns config in the `dns_plugin` key:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
:pools:
|
||||||
|
- name: 'debian-11-x86_64'
|
||||||
|
dns_plugin: 'example'
|
||||||
|
```
|
||||||
|
|
||||||
|
For complete examples on how to use the GCP DNS plugin see [vmpooler-dns-gcp](https://github.com/puppetlabs/vmpooler-dns-gcp).
|
||||||
|
|
||||||
### DNS
|
### DNS
|
||||||
DNS is integrated via Google's CloudDNS service. To enable, a CloudDNS zone name must be provided in the config (see the example yaml file dns_zone_resource_name)
|
DNS is integrated via Google's CloudDNS service. To enable, a CloudDNS zone name must be provided in the config (see the example yaml file dns_zone_resource_name)
|
||||||
|
|
||||||
|
|
@ -37,7 +83,21 @@ do not have the pool label, and can be configured to allow a specific list of un
|
||||||
- The service account needs to be given permissions to the project (broad permissions would be compute v1 admin and dns admin). A yaml file is provided that lists the least-privilege permissions needed
|
- The service account needs to be given permissions to the project (broad permissions would be compute v1 admin and dns admin). A yaml file is provided that lists the least-privilege permissions needed
|
||||||
- if using DNS, a DNS zone needs to be created in CloudDNS, and configured in the provider's config section with the name of that zone (dns_zone_resource_name). When not specified, the DNS setup and teardown is skipped.
|
- if using DNS, a DNS zone needs to be created in CloudDNS, and configured in the provider's config section with the name of that zone (dns_zone_resource_name). When not specified, the DNS setup and teardown is skipped.
|
||||||
|
|
||||||
|
## Update the Gemfile Lock
|
||||||
|
|
||||||
|
To update the `Gemfile.lock` run `./update-gemfile-lock`.
|
||||||
|
|
||||||
|
Verify, and update if needed, that the docker tag in the script and GitHub action workflows matches what is used in the [vmpooler-deployment Dockerfile](https://github.com/puppetlabs/vmpooler-deployment/blob/main/docker/Dockerfile).
|
||||||
|
|
||||||
|
## Releasing
|
||||||
|
|
||||||
|
Follow these steps to publish a new GitHub release, and build and push the gem to <https://rubygems.org>.
|
||||||
|
|
||||||
|
1. Bump the "VERSION" in `lib/vmpooler-provider-gce/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release.
|
||||||
|
2. Run `./release-prep` to update `Gemfile.lock` and `CHANGELOG.md`.
|
||||||
|
3. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label.
|
||||||
|
4. After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
vmpooler-provider-gce is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details.
|
vmpooler-provider-gce is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details.
|
||||||
|
|
|
||||||
7
install-gemfile-lock
Executable file
7
install-gemfile-lock
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
|
||||||
|
docker run -it --rm \
|
||||||
|
-v $(pwd):/app \
|
||||||
|
jruby:9.4.3.0-jdk11 \
|
||||||
|
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends make git netbase && cd /app && gem install bundler && bundle install --jobs 3; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module VmpoolerProviderGce
|
module VmpoolerProviderGce
|
||||||
VERSION = '0.1.0'
|
VERSION = '1.3.0'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'googleauth'
|
|
||||||
require 'google/apis/compute_v1'
|
|
||||||
require 'google/cloud/dns'
|
|
||||||
require 'bigdecimal'
|
require 'bigdecimal'
|
||||||
require 'bigdecimal/util'
|
require 'bigdecimal/util'
|
||||||
|
require 'google/apis/compute_v1'
|
||||||
|
require 'googleauth'
|
||||||
|
require 'vmpooler/dns/base'
|
||||||
require 'vmpooler/providers/base'
|
require 'vmpooler/providers/base'
|
||||||
|
|
||||||
module Vmpooler
|
module Vmpooler
|
||||||
|
|
@ -58,11 +58,6 @@ module Vmpooler
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def dns
|
|
||||||
@dns ||= Google::Cloud::Dns.new(project_id: project)
|
|
||||||
@dns
|
|
||||||
end
|
|
||||||
|
|
||||||
# main configuration options
|
# main configuration options
|
||||||
def project
|
def project
|
||||||
provider_config['project']
|
provider_config['project']
|
||||||
|
|
@ -87,12 +82,9 @@ module Vmpooler
|
||||||
return provider_config['machine_type'] if provider_config['machine_type']
|
return provider_config['machine_type'] if provider_config['machine_type']
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain
|
def domain(pool_name)
|
||||||
provider_config['domain']
|
dns_plugin_name = pool_config(pool_name)['dns_plugin']
|
||||||
end
|
dns_config(dns_plugin_name)
|
||||||
|
|
||||||
def dns_zone_resource_name
|
|
||||||
provider_config['dns_zone_resource_name']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Base methods that are implemented:
|
# Base methods that are implemented:
|
||||||
|
|
@ -181,19 +173,28 @@ module Vmpooler
|
||||||
network: network_name
|
network: network_name
|
||||||
)
|
)
|
||||||
network_interfaces.subnetwork = subnetwork_name(pool_name) if subnetwork_name(pool_name)
|
network_interfaces.subnetwork = subnetwork_name(pool_name) if subnetwork_name(pool_name)
|
||||||
init_params = {
|
init_params = Google::Apis::ComputeV1::AttachedDiskInitializeParams.new(
|
||||||
source_image: pool['template'], # The source image to create this disk.
|
source_image: pool['template'], # The source image to create this disk.
|
||||||
labels: { 'vm' => new_vmname, 'pool' => pool_name },
|
labels: { 'vm' => new_vmname, 'pool' => pool_name },
|
||||||
disk_name: "#{new_vmname}-disk0"
|
disk_name: "#{new_vmname}-disk0"
|
||||||
}
|
)
|
||||||
|
# rubocop:disable Style/IfUnlessModifier
|
||||||
|
if pool['disk_type'] && !pool['disk_type'].empty?
|
||||||
|
init_params.disk_type = "https://www.googleapis.com/compute/v1/projects/#{project}/zones/#{zone(pool_name)}/diskTypes/#{pool['disk_type']}"
|
||||||
|
end
|
||||||
|
# rubocop:enable Style/IfUnlessModifier
|
||||||
disk = Google::Apis::ComputeV1::AttachedDisk.new(
|
disk = Google::Apis::ComputeV1::AttachedDisk.new(
|
||||||
auto_delete: true,
|
auto_delete: true,
|
||||||
boot: true,
|
boot: true,
|
||||||
initialize_params: Google::Apis::ComputeV1::AttachedDiskInitializeParams.new(init_params)
|
initialize_params: init_params
|
||||||
)
|
)
|
||||||
|
append_domain = domain(pool_name)
|
||||||
|
fqdn = "#{new_vmname}.#{append_domain}" if append_domain
|
||||||
|
|
||||||
# Assume all pool config is valid i.e. not missing
|
# Assume all pool config is valid i.e. not missing
|
||||||
client = ::Google::Apis::ComputeV1::Instance.new(
|
client = ::Google::Apis::ComputeV1::Instance.new(
|
||||||
name: new_vmname,
|
name: new_vmname,
|
||||||
|
hostname: fqdn,
|
||||||
machine_type: pool['machine_type'],
|
machine_type: pool['machine_type'],
|
||||||
disks: [disk],
|
disks: [disk],
|
||||||
network_interfaces: [network_interfaces],
|
network_interfaces: [network_interfaces],
|
||||||
|
|
@ -204,9 +205,12 @@ module Vmpooler
|
||||||
debug_logger('trigger insert_instance')
|
debug_logger('trigger insert_instance')
|
||||||
result = connection.insert_instance(project, zone(pool_name), client)
|
result = connection.insert_instance(project, zone(pool_name), client)
|
||||||
wait_for_operation(project, pool_name, result)
|
wait_for_operation(project, pool_name, result)
|
||||||
created_instance = get_vm(pool_name, new_vmname)
|
get_vm(pool_name, new_vmname)
|
||||||
dns_setup(created_instance)
|
end
|
||||||
created_instance
|
|
||||||
|
def get_vm_ip_address(vm_name, pool_name)
|
||||||
|
vm_object = get_vm(pool_name, vm_name)
|
||||||
|
vm_object['ip']
|
||||||
end
|
end
|
||||||
|
|
||||||
# create_disk creates an additional disk for an existing VM. It will name the new
|
# create_disk creates an additional disk for an existing VM. It will name the new
|
||||||
|
|
@ -420,10 +424,8 @@ module Vmpooler
|
||||||
|
|
||||||
unless deleted
|
unless deleted
|
||||||
debug_logger("trigger delete_instance #{vm_name}")
|
debug_logger("trigger delete_instance #{vm_name}")
|
||||||
vm_hash = get_vm(pool_name, vm_name)
|
|
||||||
result = connection.delete_instance(project, zone(pool_name), vm_name)
|
result = connection.delete_instance(project, zone(pool_name), vm_name)
|
||||||
wait_for_operation(project, pool_name, result, 10)
|
wait_for_operation(project, pool_name, result, 10)
|
||||||
dns_teardown(vm_hash)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# list and delete any leftover disk, for instance if they were detached from the instance
|
# list and delete any leftover disk, for instance if they were detached from the instance
|
||||||
|
|
@ -458,13 +460,17 @@ module Vmpooler
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def vm_ready?(_pool_name, vm_name)
|
def vm_ready?(pool_name, vm_name, redis)
|
||||||
|
debug_logger('vm_ready?')
|
||||||
begin
|
begin
|
||||||
# TODO: we could use a healthcheck resource attached to instance
|
# TODO: we could use a healthcheck resource attached to instance
|
||||||
open_socket(vm_name, domain || global_config[:config]['domain'])
|
domain = domain(pool_name)
|
||||||
rescue StandardError => _e
|
open_socket(vm_name, domain)
|
||||||
|
rescue StandardError => e
|
||||||
|
redis.hset("vmpooler__vm__#{vm_name}", 'open_socket_error', e.to_s)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
redis.hdel("vmpooler__vm__#{vm_name}", 'open_socket_error')
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -493,9 +499,6 @@ module Vmpooler
|
||||||
|
|
||||||
debug_logger("trigger async delete_instance #{vm.name}")
|
debug_logger("trigger async delete_instance #{vm.name}")
|
||||||
result = connection.delete_instance(project, zone, vm.name)
|
result = connection.delete_instance(project, zone, vm.name)
|
||||||
vm_pool = vm.labels&.key?('pool') ? vm.labels['pool'] : nil
|
|
||||||
existing_vm = generate_vm_hash(vm, vm_pool)
|
|
||||||
dns_teardown(existing_vm)
|
|
||||||
result_list << result
|
result_list << result
|
||||||
end
|
end
|
||||||
# now check they are done
|
# now check they are done
|
||||||
|
|
@ -556,31 +559,6 @@ module Vmpooler
|
||||||
|
|
||||||
# END BASE METHODS
|
# END BASE METHODS
|
||||||
|
|
||||||
def dns_setup(created_instance)
|
|
||||||
dns_zone = dns.zone(dns_zone_resource_name) if dns_zone_resource_name
|
|
||||||
return unless dns_zone && created_instance && created_instance['name'] && created_instance['ip']
|
|
||||||
|
|
||||||
name = created_instance['name']
|
|
||||||
begin
|
|
||||||
change = dns_zone.add(name, 'A', 60, [created_instance['ip']])
|
|
||||||
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change
|
|
||||||
rescue Google::Cloud::AlreadyExistsError => _e
|
|
||||||
# DNS setup is done only for new instances, so in the rare case where a DNS record already exists (it is stale) and we replace it.
|
|
||||||
# the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists
|
|
||||||
change = dns_zone.replace(name, 'A', 60, [created_instance['ip']])
|
|
||||||
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def dns_teardown(created_instance)
|
|
||||||
dns_zone = dns.zone(dns_zone_resource_name) if dns_zone_resource_name
|
|
||||||
return unless dns_zone && created_instance
|
|
||||||
|
|
||||||
name = created_instance['name']
|
|
||||||
change = dns_zone.remove(name, 'A')
|
|
||||||
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address removed") if change
|
|
||||||
end
|
|
||||||
|
|
||||||
def should_be_ignored(item, allowlist)
|
def should_be_ignored(item, allowlist)
|
||||||
return false if allowlist.nil?
|
return false if allowlist.nil?
|
||||||
|
|
||||||
|
|
@ -694,15 +672,13 @@ module Vmpooler
|
||||||
|
|
||||||
# This should supercede the open_socket method in the Pool Manager
|
# This should supercede the open_socket method in the Pool Manager
|
||||||
def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)
|
def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)
|
||||||
Timeout.timeout(timeout) do
|
target_host = host
|
||||||
target_host = host
|
target_host = "#{host}.#{domain}" if domain
|
||||||
target_host = "#{host}.#{domain}" if domain
|
sock = TCPSocket.new(target_host, port, connect_timeout: timeout)
|
||||||
sock = TCPSocket.new target_host, port
|
begin
|
||||||
begin
|
yield sock if block_given?
|
||||||
yield sock if block_given?
|
ensure
|
||||||
ensure
|
sock.close
|
||||||
sock.close
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
15
release-prep
Executable file
15
release-prep
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
|
||||||
|
#
|
||||||
|
# Update Gemfile.lock
|
||||||
|
docker run -t --rm \
|
||||||
|
-v $(pwd):/app \
|
||||||
|
jruby:9.4.3.0-jdk11 \
|
||||||
|
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends git make netbase && cd /app && gem install bundler && bundle install --jobs 3; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'
|
||||||
|
|
||||||
|
# Update Changelog
|
||||||
|
docker run -t --rm -e CHANGELOG_GITHUB_TOKEN -v $(pwd):/usr/local/src/your-app \
|
||||||
|
githubchangeloggenerator/github-changelog-generator:1.16.2 \
|
||||||
|
github_changelog_generator --future-release $(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
MockDNS = Struct.new(
|
|
||||||
# https://rubydoc.info/gems/google-cloud-dns/0.35.1/Google/Cloud/Dns
|
|
||||||
:change, :credentials, :project, :record, :zone,
|
|
||||||
keyword_init: true
|
|
||||||
) do
|
|
||||||
def zone(zone)
|
|
||||||
self.zone = zone
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -10,7 +10,6 @@ require 'vmpooler'
|
||||||
require 'redis'
|
require 'redis'
|
||||||
require 'vmpooler/metrics'
|
require 'vmpooler/metrics'
|
||||||
require 'computeservice_helper'
|
require 'computeservice_helper'
|
||||||
require 'dnsservice_helper'
|
|
||||||
|
|
||||||
def project_root_dir
|
def project_root_dir
|
||||||
File.dirname(File.dirname(__FILE__))
|
File.dirname(File.dirname(__FILE__))
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,11 @@ describe 'Vmpooler::PoolManager::Provider::Gce' do
|
||||||
:config:
|
:config:
|
||||||
max_tries: 3
|
max_tries: 3
|
||||||
retry_factor: 10
|
retry_factor: 10
|
||||||
|
:dns_configs:
|
||||||
|
:gcp-clouddns:
|
||||||
|
project: vmpooler-test
|
||||||
|
domain: vmpooler.example.com
|
||||||
|
dns_zone_resource_name: vmpooler-example-com
|
||||||
:providers:
|
:providers:
|
||||||
:gce:
|
:gce:
|
||||||
connection_pool_timeout: 1
|
connection_pool_timeout: 1
|
||||||
|
|
@ -32,6 +37,7 @@ describe 'Vmpooler::PoolManager::Provider::Gce' do
|
||||||
timeout: 10
|
timeout: 10
|
||||||
ready_ttl: 1440
|
ready_ttl: 1440
|
||||||
provider: 'gce'
|
provider: 'gce'
|
||||||
|
dns_config: 'gcp-clouddns'
|
||||||
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
|
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
|
||||||
EOT
|
EOT
|
||||||
)
|
)
|
||||||
|
|
@ -51,8 +57,6 @@ EOT
|
||||||
|
|
||||||
subject { Vmpooler::PoolManager::Provider::Gce.new(config, logger, metrics, redis_connection_pool, 'gce', provider_options) }
|
subject { Vmpooler::PoolManager::Provider::Gce.new(config, logger, metrics, redis_connection_pool, 'gce', provider_options) }
|
||||||
|
|
||||||
before(:each) { allow(subject).to receive(:dns).and_return(MockDNS.new()) }
|
|
||||||
|
|
||||||
describe '#name' do
|
describe '#name' do
|
||||||
it 'should be gce' do
|
it 'should be gce' do
|
||||||
expect(subject.name).to eq('gce')
|
expect(subject.name).to eq('gce')
|
||||||
|
|
@ -61,22 +65,24 @@ EOT
|
||||||
|
|
||||||
describe '#manual tests live' do
|
describe '#manual tests live' do
|
||||||
context 'in itsysops' do
|
context 'in itsysops' do
|
||||||
before(:each) { allow(subject).to receive(:dns).and_call_original }
|
let(:vmname) { "instance-31" }
|
||||||
let(:vmname) { "instance-24" }
|
|
||||||
let(:project) { 'vmpooler-test' }
|
let(:project) { 'vmpooler-test' }
|
||||||
let(:config) { YAML.load(<<~EOT
|
let(:config) { YAML.load(<<~EOT
|
||||||
---
|
---
|
||||||
:config:
|
:config:
|
||||||
max_tries: 3
|
max_tries: 3
|
||||||
retry_factor: 10
|
retry_factor: 10
|
||||||
|
:dns_configs:
|
||||||
|
:gcp-clouddns:
|
||||||
|
project: vmpooler-test
|
||||||
|
domain: vmpooler.example.com
|
||||||
|
dns_zone_resource_name: vmpooler-example-com
|
||||||
:providers:
|
:providers:
|
||||||
:gce:
|
:gce:
|
||||||
connection_pool_timeout: 1
|
connection_pool_timeout: 1
|
||||||
project: '#{project}'
|
project: '#{project}'
|
||||||
zone: '#{zone}'
|
zone: '#{zone}'
|
||||||
network_name: 'projects/itsysopsnetworking/global/networks/shared1'
|
network_name: 'projects/itsysopsnetworking/global/networks/shared1'
|
||||||
dns_zone_resource_name: 'test-vmpooler-puppet-net'
|
|
||||||
domain: 'test.vmpooler.puppet.net'
|
|
||||||
:pools:
|
:pools:
|
||||||
- name: '#{poolname}'
|
- name: '#{poolname}'
|
||||||
alias: [ 'mockpool' ]
|
alias: [ 'mockpool' ]
|
||||||
|
|
@ -85,16 +91,14 @@ EOT
|
||||||
timeout: 10
|
timeout: 10
|
||||||
ready_ttl: 1440
|
ready_ttl: 1440
|
||||||
provider: 'gce'
|
provider: 'gce'
|
||||||
|
dns_config: 'gcp-clouddns'
|
||||||
subnetwork_name: 'projects/itsysopsnetworking/regions/us-west1/subnetworks/vmpooler-test'
|
subnetwork_name: 'projects/itsysopsnetworking/regions/us-west1/subnetworks/vmpooler-test'
|
||||||
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
|
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
|
||||||
|
disk_type: 'pd-ssd'
|
||||||
EOT
|
EOT
|
||||||
) }
|
) }
|
||||||
skip 'gets a vm' do
|
skip 'gets a vm' do
|
||||||
result = subject.create_vm(poolname, vmname)
|
result = subject.create_vm(poolname, vmname)
|
||||||
#result = subject.destroy_vm(poolname, vmname)
|
|
||||||
subject.get_vm(poolname, vmname)
|
|
||||||
#subject.dns_teardown({'name' => vmname})
|
|
||||||
# subject.dns_setup({'name' => vmname, 'ip' => '1.2.3.5'})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -346,14 +350,20 @@ EOT
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#vm_ready?' do
|
describe '#vm_ready?' do
|
||||||
let(:domain) { nil }
|
let(:domain) { 'vmpooler.example.com' }
|
||||||
|
before(:each) do
|
||||||
|
allow(subject).to receive(:domain).and_return('vmpooler.example.com')
|
||||||
|
end
|
||||||
|
|
||||||
context 'When a VM is ready' do
|
context 'When a VM is ready' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
expect(subject).to receive(:open_socket).with(vmname, domain)
|
expect(subject).to receive(:open_socket).with(vmname, domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return true' do
|
it 'should return true' do
|
||||||
expect(subject.vm_ready?(poolname, vmname)).to be true
|
redis_connection_pool.with_metrics do |redis|
|
||||||
|
expect(subject.vm_ready?(poolname, vmname, redis)).to be true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -363,7 +373,9 @@ EOT
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
expect(subject.vm_ready?(poolname, vmname)).to be false
|
redis_connection_pool.with_metrics do |redis|
|
||||||
|
expect(subject.vm_ready?(poolname, vmname, redis)).to be false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
7
update-gemfile-lock
Executable file
7
update-gemfile-lock
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
|
||||||
|
docker run -it --rm \
|
||||||
|
-v $(pwd):/app \
|
||||||
|
jruby:9.4.3.0-jdk11 \
|
||||||
|
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends git make netbase && cd /app && gem install bundler && bundle install --jobs 3 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'
|
||||||
|
|
@ -16,10 +16,8 @@ Gem::Specification.new do |s|
|
||||||
s.files = Dir[ "lib/**/*" ]
|
s.files = Dir[ "lib/**/*" ]
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.add_dependency "google-apis-compute_v1", "~> 0.14"
|
s.add_dependency "google-apis-compute_v1", "~> 0.14"
|
||||||
s.add_dependency "googleauth", "~> 0.16.2"
|
s.add_dependency "googleauth", ">= 0.16.2", "< 1.4.0"
|
||||||
s.add_dependency "google-cloud-dns", "~> 0.35.1"
|
s.add_dependency 'vmpooler', '~> 3.0'
|
||||||
|
|
||||||
s.add_development_dependency 'vmpooler', '~> 1.3', '>= 1.3.0'
|
|
||||||
|
|
||||||
# Testing dependencies
|
# Testing dependencies
|
||||||
s.add_development_dependency 'climate_control', '>= 0.2.0'
|
s.add_development_dependency 'climate_control', '>= 0.2.0'
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,10 @@
|
||||||
# (optional: default is global provider zone value)
|
# (optional: default is global provider zone value)
|
||||||
# - machine_type
|
# - machine_type
|
||||||
# Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/machine-type
|
# Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/machine-type
|
||||||
|
# - disk_type
|
||||||
|
# the disk type to use, see https://cloud.google.com/compute/docs/disks one of
|
||||||
|
# pd-standard, pd-balanced, pd-ssd or pd-extreme
|
||||||
|
# (optional, when nil or empty defaults to pd-standard)
|
||||||
# Example:
|
# Example:
|
||||||
|
|
||||||
:pools:
|
:pools:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue