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

Rename run-config to deployer-config #1721

Merged
merged 2 commits into from
Sep 13, 2019
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ docs/html/*

# ignore deployer files
hack/deployer/deployer
hack/deployer/config/run-config.yml
hack/deployer/config/deployer-config.yml

# ignore CI config files
run-config.yml
deployer-config.yml
.env
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ ifndef GCLOUD_PROJECT
$(error GCLOUD_PROJECT not set)
endif

DEPLOYER=./hack/deployer/deployer --plans-file=hack/deployer/config/plans.yml --run-config-file=hack/deployer/config/run-config.yml
DEPLOYER=./hack/deployer/deployer --plans-file=hack/deployer/config/plans.yml --config-file=hack/deployer/config/deployer-config.yml

build-deployer:
@ go build -o ./hack/deployer/deployer ./hack/deployer/main.go

setup-deployer-for-gke-once: require-gcloud-project build-deployer
ifeq (,$(wildcard hack/deployer/config/run-config.yml))
@ ./hack/deployer/deployer create defaultConfig --path=hack/deployer/config/run-config.yml
ifeq (,$(wildcard hack/deployer/config/deployer-config.yml))
@ ./hack/deployer/deployer create defaultConfig --path=hack/deployer/config/deployer-config.yml
endif

credentials: setup-deployer-for-gke-once
Expand Down Expand Up @@ -344,7 +344,7 @@ ci: dep-vendor-only check-fmt lint generate check-local-changes unit integration
ci-e2e: dep-vendor-only run-deployer install-crds apply-psp e2e

run-deployer: dep-vendor-only build-deployer
./hack/deployer/deployer execute --plans-file hack/deployer/config/plans.yml --run-config-file run-config.yml
./hack/deployer/deployer execute --plans-file hack/deployer/config/plans.yml --config-file deployer-config.yml

ci-release: clean dep-vendor-only generate build-operator-image
@ echo $(OPERATOR_IMAGE) was pushed!
Expand Down
2 changes: 1 addition & 1 deletion build/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VAULT_TOKEN = $(shell vault write -address=$(VAULT_ADDR) -field=token auth/appro
else
VAULT_TOKEN = $(shell vault write -address=$(VAULT_ADDR) -field=token auth/github/login token=$(GITHUB_TOKEN))
# we use roleId as a string that has to be there for authn/z for CI, but it's empty and not needed for local execution
NOT_USED = $(shell test -e ../../run-config.yml && sed -i -e "s;roleId:;token: $(GITHUB_TOKEN);g" ../../run-config.yml)
NOT_USED = $(shell test -e ../../deployer-config.yml && sed -i -e "s;roleId:;token: $(GITHUB_TOKEN);g" ../../deployer-config.yml)
endif

CI_IMAGE ?= docker.elastic.co/eck/eck-ci:$(shell md5sum $(ROOT_DIR)/Gopkg.lock $(ROOT_DIR)/build/ci/Dockerfile | awk '{print $$1}' | md5sum | awk '{print $$1}')
Expand Down
8 changes: 4 additions & 4 deletions build/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export VAULT_ADDR=YOUR_VAULT_INSTANCE_ADDRESS
export GITHUB_TOKEN=YOUR_PERSONAL_ACCESS_TOKEN
```

Per repro, depending on the job, set up .env and run-config.yml files. E.g.: to repro e2e tests run, look at its [Jenkinsfile](e2e/Jenkinsfile) and rerun the script locally in repo root:
Per repro, depending on the job, set up .env and deployer-config.yml files. E.g.: to repro e2e tests run, look at its [Jenkinsfile](e2e/Jenkinsfile) and rerun the script locally in repo root:
```
cat >.env <<EOF
GCLOUD_PROJECT = "$GCLOUD_PROJECT"
Expand All @@ -36,7 +36,7 @@ SKIP_DOCKER_COMMAND = false
IMG_SUFFIX = -ci
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "1.12"
Expand All @@ -49,10 +49,10 @@ overrides:
gCloudProject: $GCLOUD_PROJECT
EOF
make -C build/ci COMMAND=ci-e2e ci
make -C build/ci TARGET=ci-e2e ci
```

CI makefile will take care of setting up correct credentials in the .env and run-config.yml file.
CI makefile will take care of setting up correct credentials in the .env and deployer-config.yml file.

This will run e2e test using the same:
1. container
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/GKE_k8s_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ REGISTRY = eu.gcr.io
REPOSITORY = "$GCLOUD_PROJECT"
SKIP_DOCKER_COMMAND = true
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
operation: create
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ REPOSITORY = "$GCLOUD_PROJECT"
SKIP_DOCKER_COMMAND = false
IMG_SUFFIX = -ci
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "1.12"
Expand Down
4 changes: 2 additions & 2 deletions build/ci/e2e/Jenkinsfile-aks
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ REGISTRY = cloudonk8s.azurecr.io
REPOSITORY = operators
IMG_SUFFIX = -ci
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: aks-ci
overrides:
kubernetesVersion: "1.12.8"
Expand All @@ -48,7 +48,7 @@ EOF
cleanup {
script {
sh """
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: aks-ci
overrides:
operation: delete
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/custom_operator_image.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ REPOSITORY = "$GCLOUD_PROJECT"
IMG_SUFFIX = -ci
SKIP_DOCKER_COMMAND = true
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "1.12"
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/stack_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ SKIP_DOCKER_COMMAND = true
REGISTRY = eu.gcr.io
REPOSITORY = "$GCLOUD_PROJECT"
EOF
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
operation: create
Expand Down
2 changes: 1 addition & 1 deletion build/ci/pr/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pipeline {
steps {
createConfig()
sh """
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "1.12"
Expand Down
2 changes: 1 addition & 1 deletion build/ci/support/cleanup.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
}
steps {
sh """
cat >run-config.yml <<EOF
cat >deployer-config.yml <<EOF
id: gke-ci
overrides:
operation: delete
Expand Down
10 changes: 5 additions & 5 deletions hack/deployer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Deployer is the provisioning tool that aims to be the interface to multiple Kube

At the moment it support GKE and AKS.

Default values for settings are kept in config/plans.yml file. More settings and setting overrides are provided via run-config.yml file.
Default values for settings are kept in config/plans.yml file. More settings and setting overrides are provided via deployer-config.yml file.

## Typical usage

Expand All @@ -19,7 +19,7 @@ Run once with your GCLOUD_PROJECT:
make dep-vendor-only
cd hack/deployer
go build
cat > run-config.yml << EOF
cat > deployer-config.yml << EOF
id: gke-ci
overrides:
clusterName: dkowalski-dev-cluster
Expand All @@ -40,18 +40,18 @@ overrides:
operation: delete
...
```
to your run-config.yml and run `./deployer` again.
to your deployer-config.yml and run `./deployer` again.


## CI usage

CI will populate run-config with vault login information and deployer will fetch the needed secrets. Secrets will differ depending on the provider chosen.
CI will populate deployer-config with vault login information and deployer will fetch the needed secrets. Secrets will differ depending on the provider chosen.

## CI impersonation

To facilitate testing locally, developers can run "as CI". While the credentials and vault login method are different it does allow fetching the same credentials and logging in as the same service account as CI would. This aims to shorten the dev cycle for CI related work and debugging.

To achieve the above, add the following to your run-config.yml, where TOKEN is your GitHub personal access token.
To achieve the above, add the following to your deployer-config.yml, where TOKEN is your GitHub personal access token.

```
overrides:
Expand Down
2 changes: 1 addition & 1 deletion hack/deployer/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func CreateCommand() *cobra.Command{
},
}

createDefaultConfigCommand.Flags().StringVar(&path, "path", "config/run-config.yml", "Path where file should be created.")
createDefaultConfigCommand.Flags().StringVar(&path, "path", "config/deployer-config.yml", "Path where file should be created.")
createCommand.AddCommand(createDefaultConfigCommand)

return createCommand
Expand Down
2 changes: 1 addition & 1 deletion hack/deployer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ func Execute() {
func registerFileFlags(cmd *cobra.Command) (*string, *string){
var plansFile, configFile string
cmd.PersistentFlags().StringVar(&plansFile, "plans-file", "config/plans.yml", "File containing execution plans.")
cmd.PersistentFlags().StringVar(&configFile, "run-config-file", "config/run-config.yml", "File containing run config.")
cmd.PersistentFlags().StringVar(&configFile, "config-file", "config/deployer-config.yml", "File containing run config.")
return &plansFile, &configFile
}