Skip to content

Commit f1b05ef

Browse files
committed
Misc cleanup
1 parent 90d7e90 commit f1b05ef

File tree

5 files changed

+13
-64
lines changed

5 files changed

+13
-64
lines changed

dev/registry.sh

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
2323
source $ROOT/build/images.sh
2424
source $ROOT/dev/util.sh
2525

26+
images_with_builders="operator proxy async-gateway enqueuer dequeuer controller-manager"
27+
2628
if [ -f "$ROOT/dev/config/env.sh" ]; then
2729
source $ROOT/dev/config/env.sh
2830
fi
@@ -216,7 +218,7 @@ elif [ "$cmd" = "create" ]; then
216218
# usage: registry.sh update-single IMAGE
217219
elif [ "$cmd" = "update-single" ]; then
218220
image=$sub_cmd
219-
if [ "$image" = "operator" ] || [ "$image" = "proxy" ]; then
221+
if [[ " $images_with_builders " =~ " $image " ]]; then
220222
cache_builder $image
221223
fi
222224
build_and_push $image
@@ -234,24 +236,11 @@ elif [ "$cmd" = "update" ]; then
234236
images_to_build+=( "${dev_images[@]}" )
235237
fi
236238

237-
if [[ " ${images_to_build[@]} " =~ " operator " ]]; then
238-
cache_builder operator
239-
fi
240-
if [[ " ${images_to_build[@]} " =~ " proxy " ]]; then
241-
cache_builder proxy
242-
fi
243-
if [[ " ${images_to_build[@]} " =~ " async-gateway " ]]; then
244-
cache_builder async-gateway
245-
fi
246-
if [[ " ${images_to_build[@]} " =~ " enqueuer " ]]; then
247-
cache_builder enqueuer
248-
fi
249-
if [[ " ${images_to_build[@]} " =~ " dequeuer " ]]; then
250-
cache_builder dequeuer
251-
fi
252-
if [[ " ${images_to_build[@]} " =~ " controller-manager " ]]; then
253-
cache_builder controller-manager
254-
fi
239+
for image in $images_with_builders; do
240+
if [[ " ${images_to_build[@]} " =~ " $image " ]]; then
241+
cache_builder $image
242+
fi
243+
done
255244

256245
if command -v parallel &> /dev/null && [ -n "${NUM_BUILD_PROCS+set}" ] && [ "$NUM_BUILD_PROCS" != "1" ]; then
257246
is_registry_logged_in=$is_registry_logged_in ROOT=$ROOT registry_push_url=$registry_push_url SHELL=$(type -p /bin/bash) parallel --will-cite --halt now,fail=1 --eta --jobs $NUM_BUILD_PROCS build_and_push "{}" ::: "${images_to_build[@]}"

docs/clusters/advanced/self-hosted-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Self-hosted Docker images
22

3-
Self-hosting the Cortex cluster's internal Docker images can be useful for reducing the ingress costs, for accelerating image pulls, or for eliminating the dependency on Cortex's public container registry.
3+
Self-hosting the Cortex cluster's system Docker images can be useful for reducing the ingress costs, for accelerating image pulls, or for eliminating the dependency on Cortex's public container registry.
44

55
In this guide, we'll use [ECR](https://aws.amazon.com/ecr/) as the destination container registry. When an ECR repository resides in the same region as your Cortex cluster, there are no costs incurred when pulling images.
66

pkg/lib/docker/docker.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
dockerclient "github.com/docker/docker/client"
4242
"github.com/docker/docker/pkg/jsonmessage"
4343
"github.com/docker/docker/pkg/term"
44-
"github.com/opencontainers/go-digest"
4544
)
4645

4746
var NoAuth string
@@ -322,14 +321,6 @@ func CheckImageAccessible(dockerClient *Client, dockerImage, authConfig string)
322321
return nil
323322
}
324323

325-
func GetDistributionDigest(dockerClient *Client, dockerImage, authConfig string) (digest.Digest, error) {
326-
inspect, err := dockerClient.DistributionInspect(context.Background(), dockerImage, authConfig)
327-
if err != nil {
328-
return digest.Digest(""), errors.WithStack(err)
329-
}
330-
return inspect.Descriptor.Digest, nil
331-
}
332-
333324
func CheckImageExistsLocally(dockerClient *Client, dockerImage string) error {
334325
images, err := dockerClient.ImageList(context.Background(), dockertypes.ImageListOptions{})
335326
if err != nil {

pkg/types/spec/validations.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
"github.com/cortexlabs/cortex/pkg/lib/urls"
3939
"github.com/cortexlabs/cortex/pkg/types/userconfig"
4040
dockertypes "github.com/docker/docker/api/types"
41-
"github.com/opencontainers/go-digest"
4241
kresource "k8s.io/apimachinery/pkg/api/resource"
4342
)
4443

@@ -950,34 +949,3 @@ func getDockerAuthStrFromK8s(dockerClient *docker.Client, k8sClient *k8s.Client)
950949

951950
return dockerAuthStr, nil
952951
}
953-
954-
func getDockerImageDigest(
955-
image string,
956-
awsClient *aws.Client,
957-
k8sClient *k8s.Client,
958-
) (digest.Digest, error) {
959-
dockerClient, err := docker.GetDockerClient()
960-
if err != nil {
961-
return digest.Digest(""), err
962-
}
963-
964-
dockerAuthStr := docker.NoAuth
965-
966-
if regex.IsValidECRURL(image) {
967-
dockerAuthStr, err = docker.AWSAuthConfig(awsClient)
968-
if err != nil {
969-
return digest.Digest(""), err
970-
}
971-
} else if k8sClient != nil {
972-
dockerAuthStr, err = getDockerAuthStrFromK8s(dockerClient, k8sClient)
973-
if err != nil {
974-
return digest.Digest(""), err
975-
}
976-
}
977-
978-
distributionDigest, err := docker.GetDistributionDigest(dockerClient, image, dockerAuthStr)
979-
if err != nil {
980-
return digest.Digest(""), err
981-
}
982-
return distributionDigest, err
983-
}

pkg/types/userconfig/api.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,6 @@ func (api *API) TelemetryEvent() map[string]interface{} {
535535

536536
if api.Pod != nil {
537537
event["pod._is_defined"] = true
538-
event["pod.node_groups._is_defined"] = len(api.Pod.NodeGroups) > 0
539538
event["pod.node_groups._len"] = len(api.Pod.NodeGroups)
540539
if api.Pod.Port != nil {
541540
event["pod.port"] = *api.Pod.Port
@@ -560,7 +559,6 @@ func (api *API) TelemetryEvent() map[string]interface{} {
560559
event["pod.containers._num_readiness_probes"] = numReadinessProbes
561560
event["pod.containers._num_liveness_probes"] = numLivenessProbes
562561

563-
event["pod.containers.compute._is_defined"] = true
564562
totalCompute := GetTotalComputeFromContainers(api.Pod.Containers)
565563
if totalCompute.CPU != nil {
566564
event["pod.containers.compute.cpu._is_defined"] = true
@@ -589,7 +587,10 @@ func (api *API) TelemetryEvent() map[string]interface{} {
589587
event["autoscaling.min_replicas"] = api.Autoscaling.MinReplicas
590588
event["autoscaling.max_replicas"] = api.Autoscaling.MaxReplicas
591589
event["autoscaling.init_replicas"] = api.Autoscaling.InitReplicas
592-
event["autoscaling.target_in_flight"] = *api.Autoscaling.TargetInFlight
590+
if api.Autoscaling.TargetInFlight != nil {
591+
event["autoscaling.target_in_flight._is_defined"] = true
592+
event["autoscaling.target_in_flight"] = *api.Autoscaling.TargetInFlight
593+
}
593594
event["autoscaling.window"] = api.Autoscaling.Window.Seconds()
594595
event["autoscaling.downscale_stabilization_period"] = api.Autoscaling.DownscaleStabilizationPeriod.Seconds()
595596
event["autoscaling.upscale_stabilization_period"] = api.Autoscaling.UpscaleStabilizationPeriod.Seconds()

0 commit comments

Comments
 (0)