Skip to content

Commit

Permalink
updated replace in go mod files/krm functions (#262)
Browse files Browse the repository at this point in the history
updated replace in arm fn go mod file now that the lib is merged into
main.
  • Loading branch information
henderiw authored Jun 6, 2023
1 parent a1e470f commit 986a943
Show file tree
Hide file tree
Showing 32 changed files with 328 additions and 119 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.so
*.dylib
bin
vendor

# Test binary, built with `go test -c`
*.test
Expand Down
6 changes: 2 additions & 4 deletions krm-functions/dnn-fn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
FROM golang:1.20-alpine
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
COPY fn/*.go ./fn/
COPY . .
RUN go install
RUN go build -o /usr/local/bin/function ./

FROM gcr.io/distroless/static:latest
Expand Down
24 changes: 19 additions & 5 deletions krm-functions/dnn-fn/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
IMG_VERSION ?= latest
IMG_REGISTRY ?= docker.io/nephio
IMG ?= $(IMG_REGISTRY)/dnn-fn:${IMG_VERSION}
IMAGE_TAG ?= latest
REGISTRY ?= docker.io/nephio
IMAGE_NAME ?= dnn-fn
IMG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)

include ../../default-all.mk

.PHONY: all
all: fmt test docker-build
all: modsync fmt test docker-build docker-push

include ../../default-all.mk
.PHONY: modsync
modsync:
go mod tidy
go mod vendor

.PHONY: docker-build
build-image:
docker buildx build --load --tag $(IMG) -f Dockerfile .

.PHONY: docker-push
push-image:
docker buildx build --push --tag $(IMG) -f Dockerfile .
6 changes: 3 additions & 3 deletions krm-functions/dnn-fn/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ replace github.com/nephio-project/nephio/krm-functions/lib => ../lib

require (
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230512102733-a986c2cde4d1
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230605213956-a1e470f419a4
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
)

require (
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 // indirect
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa // indirect
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions krm-functions/dnn-fn/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 h1:mRxFelUoCQ21PC714qOQaOt/aCHsF4hDiVp0I0XohaQ=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35/go.mod h1:2rrgRi/j1NdK7F5dmYzIrPBaqn8K3/IPY/nEnCEquXE=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa h1:NoMxs7zUBrf6ZL8aUE/gj7oPlQzYm7JQwcsJ2EJtvJY=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa/go.mod h1:eAERMIKb67/4uZU56CULVA8Pc/OQ/YWsha0ja/sFHHM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d h1:NQFVnLXevDG7Ht9B/46X3FWHg+gEQc8Q68PlAnY0XsM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d/go.mod h1:prNhhUAODrB2VqHVead9tB8nLU9ffY4e4jjBwLMNO1M=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d h1:kgC/R6Kl+tBjsRvcPr4Beae1MiHumNMtbmUTy7qlPZI=
Expand Down Expand Up @@ -120,8 +120,8 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2 h1:QlMAzrAKwMcbclHBMN0bc7f+aqOxRlxhN4BJMw9t/d0=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2 h1:foAYeSwPoC2mYbuGPtCelscPg+o5nzo52vBvKaTXYM0=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe h1:KuWS+MkomN13rhQpvHF2dbZXBv2Bbxexy95srGlsv/0=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe/go.mod h1:puHYNVuWM77mFqVgwJkq2NePTVScWDlZZPB45sCN21g=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
Expand Down
17 changes: 15 additions & 2 deletions krm-functions/interface-fn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Copyright 2023 The Nephio Authors.
#
# 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.20-alpine
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install
RUN go build -o /usr/local/bin/function ./

FROM gcr.io/distroless/static:latest
Expand Down
22 changes: 18 additions & 4 deletions krm-functions/interface-fn/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
VERSION ?= latest
IMAGE_TAG ?= latest
REGISTRY ?= docker.io/nephio
IMG ?= $(REGISTRY)/interface-fn:${VERSION}
IMAGE_NAME ?= interface-fn
IMG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)

include ../../default-all.mk

.PHONY: all
all: fmt test docker-build
all: modsync fmt test docker-build docker-push

include ../../default-all.mk
.PHONY: modsync
modsync:
go mod tidy
go mod vendor

.PHONY: docker-build
build-image:
docker buildx build --load --tag $(IMG) -f Dockerfile .

.PHONY: docker-push
push-image:
docker buildx build --push --tag $(IMG) -f Dockerfile .
6 changes: 3 additions & 3 deletions krm-functions/interface-fn/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ replace github.com/nephio-project/nephio/krm-functions/lib => ../lib
require (
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230510004232-e627a450f230
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230605213956-a1e470f419a4
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
)

require (
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 // indirect
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa // indirect
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions krm-functions/interface-fn/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 h1:mRxFelUoCQ21PC714qOQaOt/aCHsF4hDiVp0I0XohaQ=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35/go.mod h1:2rrgRi/j1NdK7F5dmYzIrPBaqn8K3/IPY/nEnCEquXE=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa h1:NoMxs7zUBrf6ZL8aUE/gj7oPlQzYm7JQwcsJ2EJtvJY=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa/go.mod h1:eAERMIKb67/4uZU56CULVA8Pc/OQ/YWsha0ja/sFHHM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d h1:NQFVnLXevDG7Ht9B/46X3FWHg+gEQc8Q68PlAnY0XsM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d/go.mod h1:prNhhUAODrB2VqHVead9tB8nLU9ffY4e4jjBwLMNO1M=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d h1:kgC/R6Kl+tBjsRvcPr4Beae1MiHumNMtbmUTy7qlPZI=
Expand Down Expand Up @@ -121,8 +121,8 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2 h1:QlMAzrAKwMcbclHBMN0bc7f+aqOxRlxhN4BJMw9t/d0=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2 h1:foAYeSwPoC2mYbuGPtCelscPg+o5nzo52vBvKaTXYM0=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe h1:KuWS+MkomN13rhQpvHF2dbZXBv2Bbxexy95srGlsv/0=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe/go.mod h1:puHYNVuWM77mFqVgwJkq2NePTVScWDlZZPB45sCN21g=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
Expand Down
19 changes: 16 additions & 3 deletions krm-functions/ipam-fn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Copyright 2023 The Nephio Authors.
#
# 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.20-alpine
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install
RUN go build -o /usr/local/bin/function ./

FROM gcr.io/distroless/static:latest
COPY --from=0 /usr/local/bin/function /usr/local/bin/function
ENTRYPOINT ["function"]
ENTRYPOINT ["function"]
22 changes: 18 additions & 4 deletions krm-functions/ipam-fn/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
VERSION ?= latest
IMAGE_TAG ?= latest
REGISTRY ?= docker.io/nephio
IMG ?= $(REGISTRY)/ipam-fn:${VERSION}
IMAGE_NAME ?= ipam-fn
IMG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)

include ../../default-all.mk

.PHONY: all
all: fmt test docker-build
all: modsync fmt test docker-build docker-push

include ../../default-all.mk
.PHONY: modsync
modsync:
go mod tidy
go mod vendor

.PHONY: docker-build
build-image:
docker buildx build --load --tag $(IMG) -f Dockerfile .

.PHONY: docker-push
push-image:
docker buildx build --push --tag $(IMG) -f Dockerfile .
4 changes: 2 additions & 2 deletions krm-functions/ipam-fn/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ replace github.com/nephio-project/nephio/krm-functions/lib => ../lib

require (
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230505152827-3d240775bc79
github.com/nephio-project/nephio/krm-functions/lib v0.0.0-20230605213956-a1e470f419a4
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe
k8s.io/api v0.27.2
)

require (
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 // indirect
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa // indirect
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions krm-functions/ipam-fn/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 h1:mRxFelUoCQ21PC714qOQaOt/aCHsF4hDiVp0I0XohaQ=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35/go.mod h1:2rrgRi/j1NdK7F5dmYzIrPBaqn8K3/IPY/nEnCEquXE=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa h1:NoMxs7zUBrf6ZL8aUE/gj7oPlQzYm7JQwcsJ2EJtvJY=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa/go.mod h1:eAERMIKb67/4uZU56CULVA8Pc/OQ/YWsha0ja/sFHHM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d h1:NQFVnLXevDG7Ht9B/46X3FWHg+gEQc8Q68PlAnY0XsM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d/go.mod h1:prNhhUAODrB2VqHVead9tB8nLU9ffY4e4jjBwLMNO1M=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d h1:kgC/R6Kl+tBjsRvcPr4Beae1MiHumNMtbmUTy7qlPZI=
Expand Down
4 changes: 2 additions & 2 deletions krm-functions/lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/nephio-project/nephio/krm-functions/lib
go 1.20

require (
github.com/GoogleContainerTools/kpt v1.0.0-beta.35
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d
github.com/google/go-cmp v0.5.9
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe
github.com/stretchr/testify v1.8.2
k8s.io/api v0.27.2
Expand Down
8 changes: 4 additions & 4 deletions krm-functions/lib/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35 h1:mRxFelUoCQ21PC714qOQaOt/aCHsF4hDiVp0I0XohaQ=
github.com/GoogleContainerTools/kpt v1.0.0-beta.35/go.mod h1:2rrgRi/j1NdK7F5dmYzIrPBaqn8K3/IPY/nEnCEquXE=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa h1:NoMxs7zUBrf6ZL8aUE/gj7oPlQzYm7JQwcsJ2EJtvJY=
github.com/GoogleContainerTools/kpt v1.0.0-beta.29.0.20230327202912-01513604feaa/go.mod h1:eAERMIKb67/4uZU56CULVA8Pc/OQ/YWsha0ja/sFHHM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d h1:NQFVnLXevDG7Ht9B/46X3FWHg+gEQc8Q68PlAnY0XsM=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d/go.mod h1:prNhhUAODrB2VqHVead9tB8nLU9ffY4e4jjBwLMNO1M=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20230427202446-3255accc518d h1:kgC/R6Kl+tBjsRvcPr4Beae1MiHumNMtbmUTy7qlPZI=
Expand Down Expand Up @@ -122,8 +122,8 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2 h1:QlMAzrAKwMcbclHBMN0bc7f+aqOxRlxhN4BJMw9t/d0=
github.com/nephio-project/api v0.0.0-20230603150309-96ef6e574ad2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2 h1:foAYeSwPoC2mYbuGPtCelscPg+o5nzo52vBvKaTXYM0=
github.com/nephio-project/api v0.0.0-20230605215709-2e793ab3e7f2/go.mod h1:9YrjM1dilFEywCsTxjYFJNbdirfuOTIe5B8pOouIo9A=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe h1:KuWS+MkomN13rhQpvHF2dbZXBv2Bbxexy95srGlsv/0=
github.com/nokia/k8s-ipam v0.0.4-0.20230604044109-366c07a61afe/go.mod h1:puHYNVuWM77mFqVgwJkq2NePTVScWDlZZPB45sCN21g=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
Expand Down
56 changes: 45 additions & 11 deletions krm-functions/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,27 @@
# 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.

.SHELLFLAGS = -ec

GO_VERSION ?= 1.20.2
IMG_REGISTRY ?= docker.io/nephio
VERSION ?= latest
REGISTRY ?= docker.io/nephio
ITFIMG ?= $(REGISTRY)/interface-fn:${VERSION}
DNNIMG ?= $(REGISTRY)/dnn-fn:${VERSION}
NADIMG ?= $(REGISTRY)/nad-fn:${VERSION}
IPAMIMG ?= $(REGISTRY)/ipam-fn:${VERSION}
VLANIMG ?= $(REGISTRY)/vlan-fn:${VERSION}
UPFIMG ?= $(REGISTRY)/upf-deploy-fn:${VERSION}
AMFIMG ?= $(REGISTRY)/amf-deploy-fn:${VERSION}
SMFIMG ?= $(REGISTRY)/smf-deploy-fn:${VERSION}

ITFCE_DIR ?= ./interface-fn
DNN_DIR ?= ./dnn-fn
NAD_DIR ?= ./nad-fn
IPAM_DIR ?= ./ipam-fn
VLAN_DIR ?= ./vlan-fn
UPF_DIR ?= ./nfdeploy-fn/upfdeployfn
SMF_DIR ?= ./nfdeploy-fn/smfdeployfn
AMF_DIR ?= ./nfdeploy-fn/amfdeployfn
NFD_DIR ?= ./nfdeploy-fn

# find all subdirectories with a go.mod file in them
GO_MOD_DIRS = $(shell find . -name 'go.mod' -exec sh -c 'echo \"$$(dirname "{}")\" ' \; )
Expand All @@ -36,10 +52,28 @@ test fmt vet:
$(MAKE) -C "$$dir" $@ ; \
done

.PHONY: docker-build docker-push
# delegate these targets to the Makefiles of individual go modules,
# but skip the module if the target doesn't exists, or an error happened
docker-build docker-push:
for dir in $(GO_MOD_DIRS); do \
$(MAKE) -C "$$dir" $@ || true ; \
done
include ../default-go-test.mk
include ../default-go-lint.mk
include ../default-gosec.mk
include ../default-go-misc.mk

docker-build: ## Build docker images.
docker buildx build --load --tag ${ITFIMG} -f $(ITFCE_DIR)/Dockerfile $(ITFCE_DIR)
docker buildx build --load --tag ${DNNIMG} -f $(DNN_DIR)/Dockerfile $(DNN_DIR)
docker buildx build --load --tag ${NADIMG} -f $(NAD_DIR)/Dockerfile $(NAD_DIR)
docker buildx build --load --tag ${IPAMIMG} -f $(IPAM_DIR)/Dockerfile $(IPAM_DIR)
docker buildx build --load --tag ${VLANIMG} -f $(VLAN_DIR)/Dockerfile $(VLAN_DIR)
docker buildx build --load --tag ${UPFIMG} -f $(UPF_DIR)/Dockerfile $(NFD_DIR)
docker buildx build --load --tag ${AMFIMG} -f $(AMF_DIR)/Dockerfile $(NFD_DIR)
docker buildx build --push --tag ${SMFIMG} -f $(SMF_DIR)/Dockerfile $(NFD_DIR)

docker-push: ## Build docker images.
docker buildx build --push --tag ${ITFIMG} -f $(ITFCE_DIR)/Dockerfile $(ITFCE_DIR)
docker buildx build --push --tag ${DNNIMG} -f $(DNN_DIR)/Dockerfile $(DNN_DIR)
docker buildx build --push --tag ${NADIMG} -f $(NAD_DIR)/Dockerfile $(NAD_DIR)
docker buildx build --push --tag ${IPAMIMG} -f $(IPAM_DIR)/Dockerfile $(IPAM_DIR)
docker buildx build --push --tag ${VLANIMG} -f $(VLAN_DIR)/Dockerfile $(VLAN_DIR)
docker buildx build --push --tag ${UPFIMG} -f $(UPF_DIR)/Dockerfile $(NFD_DIR)
docker buildx build --push --tag ${AMFIMG} -f $(AMF_DIR)/Dockerfile $(NFD_DIR)
docker buildx build --push --tag ${SMFIMG} -f $(SMF_DIR)/Dockerfile $(NFD_DIR)

17 changes: 15 additions & 2 deletions krm-functions/nad-fn/DockerFile
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Copyright 2023 The Nephio Authors.
#
# 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.20-alpine
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install
RUN go build -o /usr/local/bin/function ./

FROM gcr.io/distroless/static:latest
Expand Down
Loading

0 comments on commit 986a943

Please sign in to comment.