Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c7159d5
WIP on removing local support
RobertLucian Dec 29, 2020
17d9492
WIP on removing local support
RobertLucian Dec 30, 2020
26cc7b2
WIP on removing local support
RobertLucian Dec 30, 2020
768d926
WIP on removing local support
RobertLucian Dec 30, 2020
2f0de16
Remove AWS region from CLI (was only required for local)
RobertLucian Dec 30, 2020
1a8491f
WIP on removing local support
RobertLucian Dec 31, 2020
4e019e9
Merge branch 'master' into feature/remove-local-support
RobertLucian Jan 4, 2021
3373a76
Fix gcp-cluster info when creds file not set
RobertLucian Jan 4, 2021
fab8d17
Remove monitoring from examples
RobertLucian Jan 4, 2021
8bbbe65
Merge branch 'master' into feature/remove-local-support
RobertLucian Jan 4, 2021
9dae0b5
Remove command types
RobertLucian Jan 4, 2021
1b9de94
Merge branch 'master' into feature/remove-local-support
RobertLucian Jan 4, 2021
dba4f35
Merge branch 'master' into feature/remove-local-support
RobertLucian Jan 4, 2021
33ed014
Merge branch 'master' into feature/remove-local-support
RobertLucian Jan 4, 2021
d4f24dc
Update default env values for cluster ups
RobertLucian Jan 4, 2021
3c5e543
Rename envName to _flagClusterUpEnv
RobertLucian Jan 4, 2021
a97f025
Address PR comments
RobertLucian Jan 5, 2021
ee5e82d
Add comment explaining instruction
RobertLucian Jan 5, 2021
9dcb971
Change when "set the default env" message gets printed
RobertLucian Jan 5, 2021
f8698f5
Code style change
RobertLucian Jan 5, 2021
12556c5
Revert Makefile
deliahu Jan 5, 2021
2adf513
Add env helper
deliahu Jan 5, 2021
11bed16
Update env.go
deliahu Jan 5, 2021
15637ba
Update error messages
deliahu Jan 5, 2021
63a85a6
Update cli.md
deliahu Jan 5, 2021
0c415fc
Misc
deliahu Jan 5, 2021
f1e5244
Remove more local references
deliahu Jan 5, 2021
4f6e480
Merge conflicts from 'master' into feature/remove-local-support
RobertLucian Jan 5, 2021
252d38a
Remove ProjectDir function
RobertLucian Jan 5, 2021
5788114
Further removals for local provider
RobertLucian Jan 5, 2021
722b932
Return error message if legacy provider when used
RobertLucian Jan 5, 2021
4e7e395
Update registry.sh
deliahu Jan 5, 2021
799efd4
Update errors.go
deliahu Jan 5, 2021
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: 1 addition & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,12 @@ If you want to switch back to the in-cluster operator:
1. `<ctrl+c>` to stop your local operator
2. `make operator-start-aws` to restart the operator in your cluster

If you only want to test Cortex's local environment, here is the common workflow:

1. `make cli-watch` (builds the CLI and re-builds it when files are changed)
2. Make your changes
3. `make images-dev-local` (only necessary if API images or the manager are modified)
4. Test your changes e.g. via `cortex deploy` (and repeat steps 2 and 3 as necessary)

### Dev workflow optimizations

If you are only modifying the CLI, `make cli-watch` will build the CLI and re-build it when files are changed. When doing this, you can leave the operator running in the cluster instead of running it locally.

If you are only modifying the operator, `make operator-local-aws` will build and start the operator locally, and build/restart it when files are changed.

If you are modifying code in the API images (i.e. any of the Python serving code), `make images-dev-aws` may build more images than you need during testing. For example, if you are only testing using the `python-predictor-cpu` image, you can run `./dev/registry.sh update-single python-predictor-cpu --provider aws` (or use `--provider local` if testing locally).
If you are modifying code in the API images (i.e. any of the Python serving code), `make images-dev-aws` may build more images than you need during testing. For example, if you are only testing using the `python-predictor-cpu` image, you can run `./dev/registry.sh update-single python-predictor-cpu --provider aws`.

See `Makefile` for additional dev commands.
44 changes: 20 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,33 @@ cluster-up-gcp-y:
@$(MAKE) kubectl-gcp

cluster-down-aws:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@kill $(shell pgrep -f rerun) >/dev/null 2>&1 || true
@./bin/cortex cluster down --config=./dev/config/cluster-aws.yaml --aws-key="$$AWS_ACCESS_KEY_ID" --aws-secret=$$AWS_SECRET_ACCESS_KEY
cluster-down-gcp:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@kill $(shell pgrep -f rerun) >/dev/null 2>&1 || true
@./bin/cortex cluster-gcp down --config=./dev/config/cluster-gcp.yaml

cluster-down-aws-y:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@kill $(shell pgrep -f rerun) >/dev/null 2>&1 || true
@./bin/cortex cluster down --config=./dev/config/cluster-aws.yaml --aws-key="$$AWS_ACCESS_KEY_ID" --aws-secret="$$AWS_SECRET_ACCESS_KEY" --yes
cluster-down-gcp-y:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@kill $(shell pgrep -f rerun) >/dev/null 2>&1 || true
@./bin/cortex cluster-gcp down --config=./dev/config/cluster-gcp.yaml --yes

cluster-info-aws:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@eval $$(python3 ./manager/cluster_config_env.py ./dev/config/cluster-aws.yaml) && ./bin/cortex cluster info --config=./dev/config/cluster-aws.yaml --configure-env="$$CORTEX_CLUSTER_NAME-aws" --aws-key="$$AWS_ACCESS_KEY_ID" --aws-secret="$$AWS_SECRET_ACCESS_KEY" --yes
cluster-info-gcp:
@$(MAKE) images-manager-local
@$(MAKE) images-manager-skip-push
@$(MAKE) cli
@eval $$(python3 ./manager/cluster_config_env.py ./dev/config/cluster-gcp.yaml) && ./bin/cortex cluster-gcp info --config=./dev/config/cluster-gcp.yaml --configure-env="$$CORTEX_CLUSTER_NAME-gcp" --yes

Expand Down Expand Up @@ -181,49 +181,47 @@ operator-update-gcp:

# Docker images

images-all-skip-push:
@./dev/registry.sh update all
images-all-aws:
@./dev/registry.sh update all -p aws
images-all-gcp:
@./dev/registry.sh update all -p gcp
images-all-local:
@./dev/registry.sh update all -p local
images-all-slim-skip-push:
@./dev/registry.sh update all --include-slim
images-all-slim-aws:
@./dev/registry.sh update all -p aws --include-slim
images-all-slim-gcp:
@./dev/registry.sh update all -p gcp --include-slim
images-all-slim-local:
@./dev/registry.sh update all -p local --include-slim

images-dev-skip-push:
@./dev/registry.sh update dev
images-dev-aws:
@./dev/registry.sh update dev -p aws
images-dev-gcp:
@./dev/registry.sh update dev -p gcp
images-dev-local:
@./dev/registry.sh update dev -p local
images-dev-slim-skip-push:
@./dev/registry.sh update dev --include-slim
images-dev-slim-aws:
@./dev/registry.sh update dev -p aws --include-slim
images-dev-slim-gcp:
@./dev/registry.sh update dev -p gcp --include-slim
images-dev-slim-local:
@./dev/registry.sh update dev -p local --include-slim

images-api-skip-push:
@./dev/registry.sh update api
images-api-aws:
@./dev/registry.sh update api -p aws
images-api-gcp:
@./dev/registry.sh update api -p gcp
images-api-local:
@./dev/registry.sh update api -p local
images-api-slim-skip-push:
@./dev/registry.sh update api --include-slim
images-api-slim-aws:
@./dev/registry.sh update api -p aws --include-slim
images-api-slim-gcp:
@./dev/registry.sh update api -p gcp --include-slim
images-api-slim-local:
@./dev/registry.sh update api -p local --include-slim

images-manager-local:
@./dev/registry.sh update-single manager -p local
images-iris-local:
@./dev/registry.sh update-single python-predictor-cpu -p local
images-manager-skip-push:
@./dev/registry.sh update-single manager
images-iris-aws:
@./dev/registry.sh update-single python-predictor-cpu -p aws
images-iris-gcp:
Expand All @@ -234,8 +232,6 @@ registry-create-aws:

registry-clean-aws:
@./dev/registry.sh clean -p aws
registry-clean-local:
@./dev/registry.sh clean -p local

# Misc

Expand Down
48 changes: 12 additions & 36 deletions build/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,57 @@

set -euo pipefail

api_images_local=(
api_images_cluster=(
"python-predictor-cpu"
"python-predictor-gpu"
"tensorflow-predictor"
"onnx-predictor-cpu"
"onnx-predictor-gpu"
)
api_images_cluster=(
# includes api_images_local
)
api_images_aws=(
# includes api_images_local and api_images_cluster
# includes api_images_cluster
"python-predictor-inf"
)
api_images_gcp=(
# includes api_images_local and api_images_cluster
# includes api_images_cluster
)

api_slim_images_local=(
api_slim_images_cluster=(
"python-predictor-cpu-slim"
"python-predictor-gpu-slim"
"tensorflow-predictor-slim"
"onnx-predictor-cpu-slim"
"onnx-predictor-gpu-slim"
)
api_slim_images_cluster=(
# includes api_slim_images_local
)
api_slim_images_aws=(
# includes api_slim_images_local and api_slim_images_cluster
# includes api_slim_images_cluster
"python-predictor-inf-slim"
)
api_slim_images_gcp=(
# includes api_slim_images_local and api_slim_images_cluster
# includes api_slim_images_cluster
)

dev_images_local=(
"downloader"
)
dev_images_cluster=(
# includes dev_images_local
"downloader"
"manager"
)
dev_images_aws=(
# includes dev_images_local and dev_images_cluster
# includes dev_images_cluster
"request-monitor"
)
dev_images_gcp=(
# includes dev_images_local and dev_images_cluster
# includes dev_images_cluster
)

non_dev_images_local=(
non_dev_images_cluster=(
"tensorflow-serving-cpu"
"tensorflow-serving-gpu"
)
non_dev_images_cluster=(
# includes non_dev_images_local
"operator"
"istio-proxy"
"istio-pilot"
)
non_dev_images_aws=(
# includes non_dev_images_local and non_dev_images_cluster
# includes non_dev_images_cluster
"tensorflow-serving-inf"
"cluster-autoscaler"
"metrics-server"
Expand All @@ -92,55 +80,43 @@ non_dev_images_aws=(
"statsd"
)
non_dev_images_gcp=(
# includes non_dev_images_local and non_dev_images_cluster
# includes non_dev_images_cluster
"google-pause"
)

all_images=(
"${api_images_local[@]}"
"${api_images_cluster[@]}"
"${api_images_aws[@]}"
"${api_images_gcp[@]}"
"${api_slim_images_local[@]}"
"${api_slim_images_cluster[@]}"
"${api_slim_images_aws[@]}"
"${api_slim_images_gcp[@]}"
"${dev_images_local[@]}"
"${dev_images_cluster[@]}"
"${dev_images_aws[@]}"
"${dev_images_gcp[@]}"
"${non_dev_images_local[@]}"
"${non_dev_images_cluster[@]}"
"${non_dev_images_aws[@]}"
"${non_dev_images_gcp[@]}"
)

aws_images=(
"${api_images_local[@]}"
"${api_images_cluster[@]}"
"${api_images_aws[@]}"
"${api_slim_images_local[@]}"
"${api_slim_images_cluster[@]}"
"${api_slim_images_aws[@]}"
"${dev_images_local[@]}"
"${dev_images_cluster[@]}"
"${dev_images_aws[@]}"
"${non_dev_images_local[@]}"
"${non_dev_images_cluster[@]}"
"${non_dev_images_aws[@]}"
)

gcp_images=(
"${api_images_local[@]}"
"${api_images_cluster[@]}"
"${api_images_gcp[@]}"
"${api_slim_images_local[@]}"
"${api_slim_images_cluster[@]}"
"${api_slim_images_gcp[@]}"
"${dev_images_local[@]}"
"${dev_images_cluster[@]}"
"${dev_images_gcp[@]}"
"${non_dev_images_local[@]}"
"${non_dev_images_cluster[@]}"
"${non_dev_images_gcp[@]}"
)
28 changes: 12 additions & 16 deletions cli/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func clusterInit() {
addClusterConfigFlag(_clusterUpCmd)
addAWSCredentialsFlags(_clusterUpCmd)
addClusterAWSCredentialsFlags(_clusterUpCmd)
defaultEnv := getDefaultEnv(_clusterCommandType)
_clusterUpCmd.Flags().StringVarP(&_flagClusterUpEnv, "configure-env", "e", defaultEnv, "name of environment to configure")
_clusterUpCmd.Flags().StringVarP(&_flagClusterUpEnv, "configure-env", "e", "aws", "name of environment to configure")
_clusterUpCmd.Flags().BoolVarP(&_flagClusterDisallowPrompt, "yes", "y", false, "skip prompts")
_clusterCmd.AddCommand(_clusterUpCmd)

Expand Down Expand Up @@ -144,10 +143,6 @@ var _clusterUpCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
telemetry.EventNotify("cli.cluster.up", map[string]interface{}{"provider": types.AWSProviderType})

if _flagClusterUpEnv == "local" {
exit.Error(ErrorLocalEnvironmentCantUseClusterProvider(types.AWSProviderType))
}

envExists, err := isEnvConfigured(_flagClusterUpEnv)
if err != nil {
exit.Error(err)
Expand Down Expand Up @@ -322,10 +317,6 @@ var _clusterConfigureCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
telemetry.Event("cli.cluster.configure", map[string]interface{}{"provider": types.AWSProviderType})

if _flagClusterConfigureEnv == "local" {
exit.Error(ErrorLocalEnvironmentCantUseClusterProvider(types.AWSProviderType))
}

if _, err := docker.GetDockerClient(); err != nil {
exit.Error(err)
}
Expand Down Expand Up @@ -403,10 +394,6 @@ var _clusterInfoCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
telemetry.Event("cli.cluster.info", map[string]interface{}{"provider": types.AWSProviderType})

if _flagClusterInfoEnv == "local" {
exit.Error(ErrorLocalEnvironmentCantUseClusterProvider(types.AWSProviderType))
}

if _, err := docker.GetDockerClient(); err != nil {
exit.Error(err)
}
Expand Down Expand Up @@ -532,11 +519,20 @@ var _clusterDownCmd = &cobra.Command{
envNames, isDefaultEnv, _ := getEnvNamesByOperatorEndpoint(*loadBalancer.DNSName)
if len(envNames) > 0 {
for _, envName := range envNames {
removeEnvFromCLIConfig(envName)
err := removeEnvFromCLIConfig(envName)
if err != nil {
exit.Error(err)
}
}
fmt.Printf("✓ deleted the %s environment configuration%s\n", s.StrsAnd(envNames), s.SIfPlural(len(envNames)))
if isDefaultEnv {
fmt.Println("✓ set the default environment to local")
newDefaultEnv, err := getDefaultEnv()
if err != nil {
exit.Error(err)
}
if newDefaultEnv != nil {
fmt.Println(fmt.Sprintf("✓ set the default environment to %s", *newDefaultEnv))
}
}
}
}
Expand Down
Loading