From: hoejoo.lee Date: Fri, 26 May 2023 01:39:17 +0000 (-0400) Subject: Add Docker file and user-guide, fix build error X-Git-Tag: 1.0.0~9 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F11239%2F9;p=aiml-fw%2Faihp%2Fips%2Fkserve-adapter.git Add Docker file and user-guide, fix build error Change-Id: Iecb54a2f7b294aa1a09bba92ff83e282b3234d42 Signed-off-by: hoejoo.lee --- diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..72ea1b5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +# ==================================================================================# +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#================================================================================== + + +FROM golang:1.19.8-bullseye as builder + +WORKDIR /kserve-adapter + +ENV GO111MODULE=on GOOS=linux GOARCH=amd64 + +COPY . . + +RUN go install github.com/golang/mock/mockgen@v1.6.0 && go generate ./... +RUN go mod tidy +RUN go build -o kserve-adapter main.go + +FROM golang:1.19.8-bullseye + +WORKDIR /root/ + +COPY --from=builder /kserve-adapter/kserve-adapter . + +EXPOSE 48099 + +ENV KUBECONFIG=/home/.kube/config \ + API_SERVER_PORT=48099 \ + CHART_WORKSPACE_PATH="/kserve-adapter/pkg/helm/data" \ + RIC_DMS_IP=127.0.0.1 \ + RIC_DMS_PORT=8000 + +ENTRYPOINT ["./kserve-adapter"] + + diff --git a/docs/user-guide.rst b/docs/user-guide.rst old mode 100644 new mode 100755 index 222c0b0..9eb2641 --- a/docs/user-guide.rst +++ b/docs/user-guide.rst @@ -4,4 +4,63 @@ .. Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. User-Guide -========== \ No newline at end of file +========== + +.. contents:: + :depth: 3 + :local: + + +Overview +-------- +- Kserve Adapter works with the AIML Framework and is used to deploy, delete and update kserve-based apps. + +Build Image +----------- +Use the `docker build` command for docker image build. + +.. code-block:: none + + kserve-adapter $ docker build -f Dockerfile . + + Sending build context to Docker daemon 93.74MB + Step 1/11 : FROM golang:1.19.8-bullseye as builder + ---> b47c7dfaaa93 + Step 2/11 : WORKDIR /kserve-adapter + ---> Using cache + ---> 6b397a834cc2 + Step 3/11 : COPY . . + ---> Using cache + ---> 6a155a20fbde + Step 4/11 : ENV GO111MODULE=on GOOS=linux GOARCH=amd64 + ---> Using cache + ---> f5be56bd7555 + Step 5/11 : RUN go mod download + ---> Using cache + ---> 97862b975561 + Step 6/11 : RUN go build -o kserve-adapter main.go + ---> Using cache + ---> 52a6ce04c444 + Step 7/11 : FROM golang:1.19.8-bullseye + ---> b47c7dfaaa93 + Step 8/11 : WORKDIR /root/ + ---> Using cache + ---> c7870d2fbeba + Step 9/11 : COPY --from=builder /kserve-adapter/kserve-adapter . + ---> Using cache + ---> 4a2f88d946d6 + Step 10/11 : EXPOSE 48099 + ---> Using cache + ---> 8fbc694241e8 + Step 11/11 : ENTRYPOINT ["./kserve-adapter"] + ---> Using cache + ---> d279266b588c + Successfully built d279266b588c + +Environments of Kserver Adapter +--------------------------------------- ++-----------------+---------------------------------+ +| KUBE_CONFIG | ex) ~/.kube/config | ++-----------------+---------------------------------+ +| API_SERVER_PORT | ex) "48099" | ++-----------------+---------------------------------+ \ No newline at end of file diff --git a/go.mod b/go.mod index d290dd0..b6f4a79 100755 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( ) require ( - github.com/golang/mock v1.4.4 + github.com/golang/mock v1.6.0 github.com/spf13/viper v1.7.0 github.com/xeipuuv/gojsonschema v1.2.0 ) diff --git a/pkg/controller/v1/adapter/controller_test.go b/pkg/controller/v1/adapter/controller_test.go old mode 100644 new mode 100755 index ad80a73..7d031ee --- a/pkg/controller/v1/adapter/controller_test.go +++ b/pkg/controller/v1/adapter/controller_test.go @@ -27,8 +27,6 @@ import ( "github.com/kserve/kserve/pkg/apis/serving/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - kservemock "gerrit.o-ran-sc.org/r/aiml-fw/aihp/ips/kserve-adapter/pkg/client/kserve/mock" - onboardmock "gerrit.o-ran-sc.org/r/aiml-fw/aihp/ips/kserve-adapter/pkg/client/onboard/mock" "gerrit.o-ran-sc.org/r/aiml-fw/aihp/ips/kserve-adapter/pkg/commons/errors" ) diff --git a/pkg/helm/chart_builder.go b/pkg/helm/chart_builder.go index 0dc6e57..5909145 100755 --- a/pkg/helm/chart_builder.go +++ b/pkg/helm/chart_builder.go @@ -26,10 +26,11 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" - "github.com/xeipuuv/gojsonschema" "gerrit.o-ran-sc.org/r/aiml-fw/aihp/ips/kserve-adapter/pkg/commons/logger" "gerrit.o-ran-sc.org/r/aiml-fw/aihp/ips/kserve-adapter/pkg/util" + "github.com/xeipuuv/gojsonschema" "gopkg.in/yaml.v1" ) diff --git a/tox.ini b/tox.ini old mode 100644 new mode 100755 index 577b565..3608185 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,7 @@ deps = sphinxcontrib-httpdomain recommonmark lfdocs-conf + urllib3~=1.26.15 commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html @@ -34,4 +35,5 @@ deps = sphinx sphinxcontrib-httpdomain recommonmark lfdocs-conf + urllib3~=1.26.15 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck