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
59 changes: 44 additions & 15 deletions test/canary/Dockerfile.canary
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
FROM public.ecr.aws/ubuntu/ubuntu:18.04
FROM public.ecr.aws/ubuntu/ubuntu:22.04

# Build time parameters
# Build time parameters
ARG SERVICE=sagemaker

# Python parameters
ARG PYTHON=python3
ARG PYTHON_VERSION=3.12.8
ARG PYTHON_SHORT_VERSION=3.12
# Python won’t try to write .pyc or .pyo files on the import of source modules
# Force stdin, stdout and stderr to be totally unbuffered. Good for logging
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8

RUN apt-get update && apt-get install -y curl \
wget \
git \
python3.8 \
python3-pip \
python3.8-dev \
vim \
sudo \
jq \
unzip
unzip \
zlib1g-dev \
cmake \
libssl-dev

# Install python
RUN cd /tmp/ \
&& wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \
&& tar xzf Python-${PYTHON_VERSION}.tgz \
&& cd Python-${PYTHON_VERSION} \
&& ./configure --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi \
&& make -j "$(nproc)" \
&& make altinstall \
&& cd .. \
&& rm -rf Python-${PYTHON_VERSION} \
&& rm Python-${PYTHON_VERSION}.tgz \
&& ln -s /usr/local/bin/python${PYTHON_SHORT_VERSION} /usr/local/bin/python \
&& ln -s /usr/local/bin/python${PYTHON_SHORT_VERSION} /usr/local/bin/python3 \
&& rm -f /root/.python_history

# Python Path
ENV PATH="/usr/local/bin:${PATH}"

RUN python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
RUN pip install --no-cache-dir \
setuptools

# Install awscli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.6.3.zip" -o "awscliv2.zip" \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip -qq awscliv2.zip \
&& ./aws/install

Expand All @@ -25,26 +57,23 @@ RUN apt-get update && apt install -y software-properties-common \
&& apt update && apt install -y yq

# Install kubectl
RUN curl -LO "https://dl.k8s.io/release/v1.24.0/bin/linux/amd64/kubectl" \
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& chmod +x ./kubectl \
&& cp ./kubectl /bin

# Install eksctl
RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && mv /tmp/eksctl /bin

# Install Helm
RUN curl -q -L "https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz" | tar zxf - -C /usr/local/bin/ \
# Install Helm
RUN curl -q -L "https://get.helm.sh/helm-v4.0.0-linux-amd64.tar.gz" | tar zxf - -C /usr/local/bin/ \
&& mv /usr/local/bin/linux-amd64/helm /usr/local/bin/helm \
&& rm -r /usr/local/bin/linux-amd64 \
&& chmod +x /usr/local/bin/helm
&& chmod +x /usr/local/bin/helm

ENV SERVICE_REPO_PATH=/$SERVICE-controller
COPY ./test/e2e/requirements.txt requirements.txt

RUN ln -s /usr/bin/python3.8 /usr/bin/python \
&& python -m pip install --upgrade pip

RUN python -m pip install -r requirements.txt

WORKDIR /$SERVICE_REPO_PATH
CMD ["./test/canary/scripts/run_test.sh"]
CMD ["./test/canary/scripts/run_test.sh"]
6 changes: 3 additions & 3 deletions test/canary/canary.buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ phases:
commands:
# Run tests
- docker run --name ack-canary $(env | cut -f1 -d= | sed 's/^/-e /') --mount type=bind,source="$(pwd)/",target="/${SERVICE}-controller/" ${ECR_CACHE_URI}:latest

post_build:
commands:
- docker cp ack-canary:/sagemaker-controller/test/canary/integration_tests.xml /tmp/results.xml || true
# Push test image to cache ECR repo
- docker push ${ECR_CACHE_URI}:latest || true

reports:
IntegrationTestReport:
files:
- "results.xml"
base-directory: "/tmp"
base-directory: "/tmp"
13 changes: 6 additions & 7 deletions test/canary/scripts/install_controller_helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ function install_helm_chart() {
local region="$3"
local namespace="$4"

yq w -i helm/values.yaml "serviceAccount.annotations" ""
yq w -i helm/values.yaml 'serviceAccount.annotations."eks.amazonaws.com/role-arn"' "$oidc_role_arn"
yq w -i helm/values.yaml "aws.region" $region
yq w -i helm/values.yaml "log.level" "debug"
yq w -i helm/values.yaml "log.enable_development_logging" "true"

yq eval ".serviceAccount.annotations = {}" -i helm/values.yaml
yq eval ".serviceAccount.annotations.\"eks.amazonaws.com/role-arn\" = \"$oidc_role_arn\"" -i helm/values.yaml
yq eval ".aws.region = \"$region\"" -i helm/values.yaml
yq eval '.log.level = "debug"' -i helm/values.yaml
yq eval '.log.enable_development_logging = true' -i helm/values.yaml

kubectl apply -f helm/crds
helm install -n $namespace --create-namespace ack-$service-controller --skip-crds helm
}
}
7 changes: 3 additions & 4 deletions test/canary/scripts/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# cleanup on EXIT regardles of error
# cleanup on EXIT regardles of error

# Inputs to this file as environment variables
# SERVICE
Expand All @@ -12,7 +12,7 @@

set -euo pipefail
export NAMESPACE=${NAMESPACE:-"ack-system"}
export AWS_DEFAULT_REGION=$SERVICE_REGION
export AWS_DEFAULT_REGION=$SERVICE_REGION
export E2E_DIR=$SERVICE_REPO_PATH/test/e2e/
SCRIPTS_DIR=${SERVICE_REPO_PATH}/test/canary/scripts

Expand Down Expand Up @@ -47,7 +47,6 @@ function cleanup {
kubectl delete modelbiasjobdefinitions --all
kubectl delete modelexplainabilityjobdefinitions --all
kubectl delete modelqualityjobdefinitions --all
kubectl delete adoptedresources --all
kubectl delete featuregroups --all
kubectl delete modelpackages --all
kubectl delete modelpackagegroups --all
Expand All @@ -65,7 +64,7 @@ function cleanup {
kubectl delete namespace $NAMESPACE

cd $E2E_DIR
export PYTHONPATH=..
export PYTHONPATH=..
python service_cleanup.py

}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@c91073f388b3b42192aac300762fca2542fa39f0
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@b9fd0d31598f7cc9e2952d9513501c6c2464b059
pytest==8.0.2
black==20.8b1
black>=24.3.0
flaky==3.7.0
11 changes: 0 additions & 11 deletions test/e2e/tests/test_inference_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,6 @@ def update_inference_component_failed_test(self, inference_component, faulty_mod
resource = k8s.wait_resource_consumed_by_controller(reference)
assert resource is not None

# inference component transitions Updating -> InService state
assert_inference_component_status_in_sync(
reference.name,
reference,
cfg.INFERENCE_COMPONENT_STATUS_UPDATING,
)

assert k8s.wait_on_condition(
reference, ack_condition.CONDITION_TYPE_RESOURCE_SYNCED, "False"
)
assert k8s.get_resource_condition(reference, ack_condition.CONDITION_TYPE_TERMINAL) is None
Comment on lines -251 to -261
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, SM hosting released a change where Updating -> InService status is fast tracked when failed artifacts are used

resource = k8s.get_resource(reference)

assert_inference_component_status_in_sync(
Expand Down
Loading