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

Code sync with upstream - April 29th, 2024 #288

Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ jobs:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
cat "$GITHUB_ENV"

- name: Build and push developer image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: env.DEV_IMAGE_EXISTS == 'false'
with:
platforms: linux/amd64
Expand All @@ -136,7 +136,7 @@ jobs:
run: ./scripts/develop.sh make test

- name: Build and push controller image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
context: .
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -64,7 +64,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -77,6 +77,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
12 changes: 6 additions & 6 deletions .github/workflows/fvt-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
df -h

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'

- name: Start Minikube
uses: medyagh/[email protected].13
uses: medyagh/[email protected].14
id: minikube
with:
minikube-version: 1.31.0
minikube-version: 1.32.0
container-runtime: docker
kubernetes-version: v1.26.1
cpus: max
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
echo -e '\n disabled: true' >> config/runtimes/torchserve-0.x.yaml

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build Controller image
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
DOCKER_BUILDKIT: 1
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build develop image
run: make build.develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
DOCKER_BUILDKIT: 1
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build developer image
run: make build.develop
Expand Down
6 changes: 6 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ issues:
- lll
source: "^//go:generate "

# Exclude typecheck "undeclared name"/"undefined" errors for . imports in fvt package
- linters:
- typecheck
text: "undefined: "
path: fvt/

# Independent of option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
64 changes: 55 additions & 9 deletions Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,59 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: for syntax, either use "experimental" or "1.3" (or later) to enable multi-arch build with mount option
# see https://hub.docker.com/r/docker/dockerfile (https://github.com/moby/buildkit/releases/tag/dockerfile%2F1.3.0)
# NOTE: for syntax, either use "experimental" or "1.3" (or later) to enable
# multi-arch build with mount option, see https://hub.docker.com/r/docker/dockerfile
# (https://github.com/moby/buildkit/releases/tag/dockerfile%2F1.3.0)

###############################################################################
# Create the develop, test, and build environment
###############################################################################
FROM registry.access.redhat.com/ubi8/go-toolset:1.20

# TODO: replace the "go_toolset" build stage once ubi8/go-toolset:1.21 is available
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 as go-toolset

# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
# We need TARGETOS and TARGETARCH (not BUILDOS and BUILDARCH) since the developer
# image should be built for the OS of the developer using it (this is not a "builder image")
ARG TARGETOS
ARG TARGETARCH

ARG GOLANG_VERSION=1.21.6

USER root

ENV HOME=/root \
PATH=/usr/local/go/bin:$PATH:

WORKDIR /workspace

# install necessary tools that are included in the ubi/go-toolset image that we are temporarily replacing
RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
microdnf --setopt=cachedir=/root/.cache/microdnf --nodocs install \
diffutils \
gcc-c++ \
make \
wget \
tar \
git \
which \
&& microdnf update --nodocs \
&& true

# install go
RUN true \
&& wget -qO go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" \
&& tar -C /usr/local -xzf go.tgz \
&& go version \
&& rm go.tgz \
&& true


####################################################################################
# TODO: replace "go-toolset" build stage with ubi/go-toolset:1.21 once available #
# and swap `microdnf` commands for `dnf` #
####################################################################################
FROM go-toolset

# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
# don't provide "default" values (e.g. 'ARG TARGETARCH=amd64') for non-buildx environments,
Expand All @@ -43,7 +89,7 @@ WORKDIR /workspace
# Install build and dev tools
# NOTE: Require python38 to install pre-commit
RUN --mount=type=cache,target=/root/.cache/dnf:rw \
dnf install --setopt=cachedir=/root/.cache/dnf -y --nodocs \
microdnf install --setopt=cachedir=/root/.cache/dnf -y --nodocs \
nodejs \
jq \
python38 \
Expand All @@ -59,14 +105,14 @@ RUN --mount=type=cache,target=/root/.cache/pip \
# First download and extract older dist of kubebuilder which includes required etcd, kube-apiserver and kubectl binaries
# Then download and overwrite kubebuilder binary with desired/latest version
RUN true \
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_${TARGETOS}_${TARGETARCH}.tar.gz | tar -xz -C /tmp/ \
&& mv /tmp/kubebuilder_*_${TARGETOS}_${TARGETARCH} /usr/local/kubebuilder \
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/${KUBEBUILDER_VERSION}/kubebuilder_${TARGETOS}_${TARGETARCH} -o /usr/local/kubebuilder/bin/kubebuilder \
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_${TARGETOS:-linux}_${TARGETARCH:-amd64}.tar.gz | tar -xz -C /tmp/ \
&& mv /tmp/kubebuilder_*_${TARGETOS:-linux}_${TARGETARCH:-amd64} /usr/local/kubebuilder \
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/${KUBEBUILDER_VERSION}/kubebuilder_${TARGETOS:-linux}_${TARGETARCH:-amd64} -o /usr/local/kubebuilder/bin/kubebuilder \
&& true

# Download openshift-cli
RUN true \
&& curl -sSLf --output /tmp/oc_client.tar.gz https://mirror.openshift.com/pub/openshift-v4/${TARGETARCH}/clients/ocp/latest-${OPENSHIFT_VERSION}/openshift-client-${TARGETOS}.tar.gz \
&& curl -sSLf --output /tmp/oc_client.tar.gz https://mirror.openshift.com/pub/openshift-v4/${TARGETARCH:-amd64}/clients/ocp/latest-${OPENSHIFT_VERSION}/openshift-client-${TARGETOS:-linux}.tar.gz \
&& tar -xvf /tmp/oc_client.tar.gz -C /tmp \
&& mv /tmp/oc /usr/local/bin \
&& mv /tmp/kubectl /usr/local/bin \
Expand All @@ -76,7 +122,7 @@ RUN true \

# Download kustomize
RUN true \
&& curl -sSLf --output /tmp/kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz \
&& curl -sSLf --output /tmp/kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${TARGETOS:-linux}_${TARGETARCH:-amd64}.tar.gz \
&& tar -xvf /tmp/kustomize.tar.gz -C /tmp \
&& mv /tmp/kustomize /usr/local/bin \
&& chmod a+x /usr/local/bin/kustomize \
Expand Down
12 changes: 3 additions & 9 deletions apis/serving/v1alpha1/servingruntime_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// +kubebuilder:webhook:path=/validate-serving-modelmesh-io-v1alpha1-servingruntime,mutating=false,failurePolicy=fail,sideEffects=None,groups=serving.kserve.io,resources=servingruntimes;clusterservingruntimes,verbs=create;update,versions=v1alpha1,name=servingruntime.modelmesh-webhook-server.default,admissionReviewVersions=v1
type ServingRuntimeWebhook struct {
Client client.Client
decoder *admission.Decoder
Decoder *admission.Decoder
}

func (s *ServingRuntimeWebhook) Handle(ctx context.Context, req admission.Request) admission.Response {
Expand All @@ -42,7 +42,7 @@ func (s *ServingRuntimeWebhook) Handle(ctx context.Context, req admission.Reques

if req.Kind.Kind == "ServingRuntime" {
servingRuntime := &kservev1alpha.ServingRuntime{}
err := s.decoder.Decode(req, servingRuntime)
err := s.Decoder.Decode(req, servingRuntime)
if err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
Expand All @@ -58,7 +58,7 @@ func (s *ServingRuntimeWebhook) Handle(ctx context.Context, req admission.Reques

} else {
clusterServingRuntime := &kservev1alpha.ClusterServingRuntime{}
err := s.decoder.Decode(req, clusterServingRuntime)
err := s.Decoder.Decode(req, clusterServingRuntime)
if err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
Expand Down Expand Up @@ -92,12 +92,6 @@ func (s *ServingRuntimeWebhook) Handle(ctx context.Context, req admission.Reques
return admission.Allowed("Passed all validation checks for ServingRuntime")
}

// InjectDecoder injects the decoder.
func (s *ServingRuntimeWebhook) InjectDecoder(d *admission.Decoder) error {
s.decoder = d
return nil
}

// Validation of servingruntime autoscaler class
func validateServingRuntimeAutoscaler(annotations map[string]string) error {
value, ok := annotations[constants.AutoscalerClass]
Expand Down
17 changes: 16 additions & 1 deletion config/crd/bases/serving.kserve.io_clusterservingruntimes.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copied from https://github.com/kserve/kserve/blob/v0.11.2/config/crd/serving.kserve.io_clusterservingruntimes.yaml
# Copied from https://github.com/kserve/kserve/blob/v0.12.0/config/crd/serving.kserve.io_clusterservingruntimes.yaml
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -871,6 +871,19 @@ spec:
format: int32
type: integer
type: object
resizePolicy:
items:
properties:
resourceName:
type: string
restartPolicy:
type: string
required:
- resourceName
- restartPolicy
type: object
type: array
x-kubernetes-list-type: atomic
resources:
properties:
claims:
Expand Down Expand Up @@ -902,6 +915,8 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
restartPolicy:
type: string
securityContext:
properties:
allowPrivilegeEscalation:
Expand Down
Loading