Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

version: 2

updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
23 changes: 23 additions & 0 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

# https://github.com/actions/go-dependency-submission
name: Dependency Submission
on:
push:
branches:
- master

permissions:
contents: write

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
- uses: actions/go-dependency-submission@v2
with:
go-mod-path: go.mod
55 changes: 55 additions & 0 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---

name: Go Matrix

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
cross:
name: Go
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 0

strategy:
matrix:
go-version: [ "stable", "oldstable", "1.x" ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false

- name: Checkout code
uses: actions/checkout@v4

- name: Cache Go modules
uses: actions/cache@v4
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-

- name: Test
run: go test -v -cover ./...

- name: Build
run: go build -ldflags "-s -w" -trimpath ./...
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---

name: Main

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:

main:
name: Main Process
runs-on: ubuntu-latest
env:
GO_VERSION: "stable"
GOLANGCI_LINT_VERSION: v2.2.1
CGO_ENABLED: 0

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false

- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Check and get dependencies
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum

- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
golangci-lint --version

- name: Lint
run: golangci-lint run
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

name: goreleaser

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:

jobs:
goreleaser:
name: Release ec_check
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# === Go ===

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
ec_check

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

dist/
10 changes: 10 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

version: "2"

linters:
exclusions:
rules:
- linters:
- errcheck
source: cmd.Writer
33 changes: 33 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

before:
hooks:
- go mod tidy
builds:
- main: .
binary: ec_check
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- name_template: >-
{{- .Binary }}_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end -}}
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
disable: true
release:
github:
owner: SwissLife-OSS
name: ec_check
gomod:
proxy: false
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

`ec_check` is a tool to check Elastic Cloud deployments.

As of now, the main function is to evaluate, if downscaling of an Elasticsearch
data tier within an Elastic Cloud deployment is possible based on the current
disk usage.

## Usage

### Downscale Check

By default, for downscaling, only strict vertical downscaling is proposed.

By providing the extra flag `--recommend-zone-change`, `ec_check` will also
propose a combination of changing the instance size and the number of used zones
at the same time.
**CAUTION**: This mode is not recommended by Elastic. If you strictly require 3
zones, this feature can not be used.

```bash
$ ec_check downscale --region <region> --profile <profile> --deployment <name> --username <username> --password <password>
```

By default, a headroom of 25% is required after downscaling for `ec_check` to
propose downscaling of a data tier. This can be changed by flag: `--headroom-pct`
and the respective percentage, e.g.: `--headroom-pct 27.5`

### Elasticsearch Regions

Get the supported list of regions:

```bash
$ ec_check regions
```

### Elasticsearch Profiles

Get the supported list of hardware profiles for a given region:

```bash
$ ec_check profiles --region <region>
```

## Community

This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org/)
Expand Down
Loading