Skip to content

Commit 591512a

Browse files
committed
initial implementation
0 parents  commit 591512a

25 files changed

Lines changed: 2938 additions & 0 deletions

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/
4+
cover.out
5+
terrascaler

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Checklist
2+
3+
- [ ] The PR has a meaningful title. It will be used to auto generate the
4+
changelog.
5+
The PR has a meaningful description that sums up the change. It will be
6+
linked in the changelog.
7+
- [ ] PR contains a single logical change (to build a better changelog).
8+
- [ ] Update the documentation.
9+
- [ ] Categorize the PR by adding one of the labels:
10+
`bug`, `enhancement`, `documentation`, `change`, `breaking`, `dependency`
11+
as they show up in the changelog.
12+
- [ ] Link this PR to related issues or PRs.
13+
14+
<!--
15+
Thank you for your pull request. Please provide a description above and
16+
review the checklist.
17+
18+
Remove items that do not apply. For completed items, change [ ] to [x].
19+
These things are not required to open a PR and can be done afterwards,
20+
while the PR is open.
21+
-->

.github/renovate.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": ["config:recommended"],
3+
"labels": ["dependency"],
4+
"postUpdateOptions": ["gomodTidy"],
5+
"customManagers": [
6+
{
7+
"customType": "regex",
8+
"managerFilePatterns": ["/^Makefile$/"],
9+
"matchStrings": ["GOLANGCI_LINT_VERSION \\?= (?<currentValue>v[^\\s]+)"],
10+
"depNameTemplate": "golangci/golangci-lint",
11+
"datasourceTemplate": "github-releases",
12+
"versioningTemplate": "semver"
13+
}
14+
],
15+
"packageRules": [
16+
{
17+
"matchPackageNames": ["k8s.io/api", "k8s.io/apimachinery"],
18+
"allowedVersions": "< 1.0.0"
19+
}
20+
]
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: "CodeQL"
3+
4+
on:
5+
pull_request:
6+
branches: [master]
7+
paths-ignore:
8+
- .github/**
9+
schedule:
10+
- cron: "18 7 * * 0"
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: ["go"]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v6
29+
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v4
32+
with:
33+
languages: ${{ matrix.language }}
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v4
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v4
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: golangci-lint
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
paths-ignore:
9+
- .github/**
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
golangci:
16+
name: lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
- name: Set up Go
22+
uses: actions/setup-go@v6
23+
with:
24+
go-version-file: go.mod
25+
cache: true
26+
- name: golangci-lint
27+
uses: golangci/golangci-lint-action@v9
28+
with:
29+
args: --timeout=5m ./...

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: release
3+
4+
on:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Go
22+
uses: actions/setup-go@v6
23+
with:
24+
go-version-file: go.mod
25+
cache: true
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v4
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v4
30+
- name: Log in to GitHub Container registry
31+
uses: docker/login-action@v4
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v7
38+
with:
39+
version: latest
40+
args: release --clean
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Run tests
3+
4+
on:
5+
workflow_call:
6+
pull_request:
7+
branches:
8+
- master
9+
workflow_dispatch:
10+
11+
jobs:
12+
tests:
13+
name: Run Tests
14+
runs-on: ubuntu-latest
15+
16+
concurrency:
17+
group: terrascaler-tests
18+
cancel-in-progress: false
19+
20+
permissions:
21+
contents: read
22+
23+
steps:
24+
- name: Check out code
25+
uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
submodules: recursive
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v6
32+
with:
33+
go-version-file: go.mod
34+
check-latest: true
35+
cache: true
36+
37+
- name: Run tests
38+
run: make test
39+
40+
- name: Build binary
41+
run: make build

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/terrascaler
2+
bin/
3+
*.test
4+
coverage.out
5+
cover.out

.golangci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
version: "2"
3+
run:
4+
allow-parallel-runners: true
5+
linters:
6+
default: none
7+
enable:
8+
- copyloopvar
9+
- dupl
10+
- errcheck
11+
- goconst
12+
- gocyclo
13+
- govet
14+
- ineffassign
15+
- lll
16+
- misspell
17+
- nakedret
18+
- prealloc
19+
- revive
20+
- staticcheck
21+
- unconvert
22+
- unparam
23+
- unused
24+
settings:
25+
revive:
26+
rules:
27+
- name: comment-spacings
28+
exclusions:
29+
generated: lax
30+
rules:
31+
- linters:
32+
- dupl
33+
- lll
34+
path: internal/*
35+
paths:
36+
- third_party$
37+
- builtin$
38+
- examples$
39+
formatters:
40+
enable:
41+
- gofmt
42+
- goimports
43+
exclusions:
44+
generated: lax
45+
paths:
46+
- third_party$
47+
- builtin$
48+
- examples$

.goreleaser.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
version: 2
3+
project_name: terrascaler
4+
before:
5+
hooks:
6+
- go mod tidy
7+
builds:
8+
- main: ./cmd/terrascaler
9+
binary: terrascaler
10+
env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- linux
14+
goarch:
15+
- amd64
16+
- arm64
17+
ldflags:
18+
- -s -w
19+
- -X main.Version={{ .Tag }}
20+
dockers:
21+
- image_templates:
22+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-amd64
23+
use: buildx
24+
dockerfile: Dockerfile
25+
extra_files:
26+
- go.mod
27+
- go.sum
28+
- cmd
29+
- internal
30+
build_flag_templates:
31+
- --pull
32+
- --platform=linux/amd64
33+
- --build-arg
34+
- LDFLAGS=-s -w -X main.Version={{ .Tag }}
35+
- --label=org.opencontainers.image.title={{ .ProjectName }}
36+
- --label=org.opencontainers.image.description=External gRPC cloud provider for Kubernetes Cluster Autoscaler backed by GitLab and Terraform/OpenTofu
37+
- --label=org.opencontainers.image.url=https://github.com/containeroo/terrascaler
38+
- --label=org.opencontainers.image.source=https://github.com/containeroo/terrascaler
39+
- --label=org.opencontainers.image.version={{ .Version }}
40+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
41+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
42+
- --label=org.opencontainers.image.licenses="GNU General Public License v3.0"
43+
- image_templates:
44+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-arm64
45+
use: buildx
46+
dockerfile: Dockerfile
47+
extra_files:
48+
- go.mod
49+
- go.sum
50+
- cmd
51+
- internal
52+
goarch: arm64
53+
build_flag_templates:
54+
- --pull
55+
- --platform=linux/arm64
56+
- --build-arg
57+
- LDFLAGS=-s -w -X main.Version={{ .Tag }}
58+
- --label=org.opencontainers.image.title={{ .ProjectName }}
59+
- --label=org.opencontainers.image.description=External gRPC cloud provider for Kubernetes Cluster Autoscaler backed by GitLab and Terraform/OpenTofu
60+
- --label=org.opencontainers.image.url=https://github.com/containeroo/terrascaler
61+
- --label=org.opencontainers.image.source=https://github.com/containeroo/terrascaler
62+
- --label=org.opencontainers.image.version={{ .Version }}
63+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
64+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
65+
- --label=org.opencontainers.image.licenses="GNU General Public License v3.0"
66+
docker_manifests:
67+
- name_template: ghcr.io/containeroo/terrascaler:{{ .Tag }}
68+
image_templates:
69+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-amd64
70+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-arm64
71+
- name_template: ghcr.io/containeroo/terrascaler:latest
72+
image_templates:
73+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-amd64
74+
- ghcr.io/containeroo/terrascaler:{{ .Tag }}-arm64
75+
release:
76+
prerelease: auto

0 commit comments

Comments
 (0)