Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure procs retries (on failure) #26

Merged
merged 1 commit into from
Oct 10, 2018
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: trusty
sudo: required
language: go
go:
- "1.8"
- "1.10"

env:
global:
Expand All @@ -14,6 +14,7 @@ env:
- PROCTOR_REDIS_ADDRESS="localhost:6379"
- PROCTOR_REDIS_MAX_ACTIVE_CONNECTIONS="10"
- PROCTOR_KUBE_JOB_ACTIVE_DEADLINE_SECONDS="60"
- PROCTOR_KUBE_JOB_RETRIES="0"
- PROCTOR_LOGS_STREAM_READ_BUFFER_SIZE="140"
- PROCTOR_LOGS_STREAM_WRITE_BUFFER_SIZE="4096"
- PROCTOR_KUBE_CLUSTER_HOST_NAME="localhost:8001"
Expand Down
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Changelog
# Changelog
All notable changes to this project will be documented in this file.

### v0.1.0
## [WIP: v0.2.0] - 2018-10-10
### Added
- Configurable kubernetes job retries (on failure)
### Modified
- Changelog format
- CI golang version. Reason: [kubernetes client-go issue](https://github.com/kubernetes/client-go/issues/449)

## v0.1.0 - 2018-10-08
### Added
- Add Authentication Headers: Email-Id and Access-Token
- Add Job success and failure metrics

[WIP: v0.2.0]: https://github.com/gojektech/proctor/compare/v0.1.0...v0.2.0
1 change: 1 addition & 0 deletions proctord/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export PROCTOR_DEFAULT_NAMESPACE="default"
export PROCTOR_REDIS_ADDRESS="localhost:6379"
export PROCTOR_REDIS_MAX_ACTIVE_CONNECTIONS="10"
export PROCTOR_KUBE_JOB_ACTIVE_DEADLINE_SECONDS="60"
export PROCTOR_KUBE_JOB_RETRIES="0"
export PROCTOR_LOGS_STREAM_READ_BUFFER_SIZE="140"
export PROCTOR_LOGS_STREAM_WRITE_BUFFER_SIZE="4096"
export PROCTOR_KUBE_CLUSTER_HOST_NAME="localhost:8001"
Expand Down
1 change: 1 addition & 0 deletions proctord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* If unset, service will execute jobs in the same kubernetes cluster where it is run
* When set to "out-of-cluster", service will fetch kube config based on current-context from `.kube/config` file in home directory
* If a job doesn't reach completion, it is terminated after `PROCTOR_KUBE_JOB_ACTIVE_DEADLINE_SECONDS`
* `PROCTOR_KUBE_JOB_RETRIES` is the number of retries for a kubernetes job (on failure)
* `PROCTOR_DEFAULT_NAMESPACE` is the namespace under which jobs will be run in kubernetes cluster. By default, K8s has namespace "default". If you set another value, please create namespace in K8s before deploying `proctord`
* `PROCTOR_KUBE_CLUSTER_HOST_NAME` is address/ip address to api-server of kube cluster. It is used for fetching logs of a pod using https
* `PROCTOR_KUBE_CA_CERT_ENCODED` is the CA cert file encoded in base64. This is used for establishing authority while talking to kubernetes api-server on a public https call
Expand Down
9 changes: 7 additions & 2 deletions proctord/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ func KubePodsListWaitTime() int {
}

func KubeJobActiveDeadlineSeconds() *int64 {
tmp := viper.GetInt64("KUBE_JOB_ACTIVE_DEADLINE_SECONDS")
return &tmp
kubeJobActiveDeadlineSeconds := viper.GetInt64("KUBE_JOB_ACTIVE_DEADLINE_SECONDS")
return &kubeJobActiveDeadlineSeconds
}

func KubeJobRetries() *int32 {
kubeJobRetries := int32(viper.GetInt("KUBE_JOB_RETRIES"))
return &kubeJobRetries
}

func PostgresUser() string {
Expand Down
9 changes: 9 additions & 0 deletions proctord/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ func TestKubeJobActiveDeadlineSeconds(t *testing.T) {
assert.Equal(t, &expectedValue, KubeJobActiveDeadlineSeconds())
}

func TestKubeJobRetries(t *testing.T) {
os.Setenv("PROCTOR_KUBE_JOB_RETRIES", "0")

viper.AutomaticEnv()

expectedValue := int32(0)
assert.Equal(t, &expectedValue, KubeJobRetries())
}

func TestPostgresUser(t *testing.T) {
os.Setenv("PROCTOR_POSTGRES_USER", "postgres")

Expand Down
Loading