Skip to content

Commit

Permalink
Remove vendor and fix code generation
Browse files Browse the repository at this point in the history
Mimic the `update-codegen.sh` implementation from Flagger, this
implementation handles modules correctly.

The controlle code-generator is not compatible with modules and vendor,
so this removes the vendor folder and all of the go flags that set the
vendor mode.

Update to client-go 0.21.3, which is the latest version with v1beta1
networking support.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
  • Loading branch information
LucasRoesler authored and alexellis committed Aug 18, 2021
1 parent b19b539 commit ed81a7b
Show file tree
Hide file tree
Showing 2,282 changed files with 213 additions and 849,183 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"appsv",
"corev",
"faas",
"faasclientset",
"faasscheme",
"faasv",
"handler",
Expand All @@ -15,7 +16,10 @@
"kubeinformers",
"logtostderr",
"metav",
"netv",
"networkingv",
"sync",
"syncer",
"threadiness",
"traefik"
]
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ARG TARGETARCH

ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOFLAGS=-mod=vendor

COPY --from=license-check /license-check /usr/bin/

Expand All @@ -21,10 +20,10 @@ ARG OPTS
# RUN go mod download

RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*")
RUN go test -mod=vendor -v ./...
RUN go test -v ./...
RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') && \
GIT_COMMIT=$(git rev-list -1 HEAD) && \
env ${OPTS} GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=${CGO_ENABLED} GOOS=linux go build -mod=vendor -ldflags "-s -w \
env ${OPTS} GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=${CGO_ENABLED} GOOS=linux go build -ldflags "-s -w \
-X github.com/openfaas-incubator/ingress-operator/pkg/version.Release=${VERSION} \
-X github.com/openfaas-incubator/ingress-operator/pkg/version.SHA=${GIT_COMMIT}" \
-a -installsuffix cgo -o ingress-operator . && \
Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ TAG?=latest
# but for now it's still experimental feature so we need to enable that
export DOCKER_CLI_EXPERIMENTAL=enabled


CODEGEN_VERSION=v0.21.3
CODEGEN_PKG=$(shell echo `go env GOPATH`"/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}")

build:
docker build -t ghcr.io/openfaas/ingress-operator:$(TAG)-amd64 . -f Dockerfile
docker build --build-arg OPTS="GOARCH=arm64" -t ghcr.io/openfaas/ingress-operator:$(TAG)-arm64 . -f Dockerfile
Expand All @@ -25,12 +29,18 @@ manifest:
docker manifest push -p ghcr.io/openfaas/ingress-operator:$(TAG)

test:
go test -mod=vendor -v ./...
go test -v ./...


verify-codegen:
go get -u -d k8s.io/code-generator@v0.19.0
${CODEGEN_PKG}:
go get k8s.io/code-generator@${CODEGEN_VERSION}

verify-codegen: ${CODEGEN_PKG}
./hack/verify-codegen.sh

update-codegen: ${CODEGEN_PKG}
./hack/update-codegen.sh

charts:
cd chart && helm package ingress-operator/
mv chart/*.tgz docs/
Expand Down
122 changes: 57 additions & 65 deletions artifacts/crds/openfaas.com_functioningresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: functioningresses.openfaas.com
spec:
Expand All @@ -14,70 +14,62 @@ spec:
singular: functioningress
scope: Namespaced
versions:
- name: v1alpha2
schema:
openAPIV3Schema:
description: FunctionIngress describes an OpenFaaS function
type: object
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: FunctionIngressSpec is the spec for a FunctionIngress resource.
It must be created in the same namespace as the gateway, i.e. openfaas.
type: object
required:
- domain
- function
properties:
bypassGateway:
description: BypassGateway, when true creates an Ingress record directly
for the Function name without using the gateway in the hot path
type: boolean
domain:
description: Domain such as "api.example.com"
type: string
function:
description: Function such as "nodeinfo"
type: string
ingressType:
description: IngressType such as "nginx"
type: string
path:
description: Path such as "/v1/profiles/view/(.*)", or leave empty
for default
type: string
tls:
description: Enable TLS via cert-manager
type: object
properties:
enabled:
type: boolean
issuerRef:
description: ObjectReference is a reference to an object with
a given name and kind.
type: object
required:
- name
properties:
kind:
type: string
name:
type: string
served: true
storage: true
- name: v1alpha2
schema:
openAPIV3Schema:
description: FunctionIngress describes an OpenFaaS function
type: object
required:
- spec
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: FunctionIngressSpec is the spec for a FunctionIngress resource. It must be created in the same namespace as the gateway, i.e. openfaas.
type: object
required:
- domain
- function
properties:
bypassGateway:
description: BypassGateway, when true creates an Ingress record directly for the Function name without using the gateway in the hot path
type: boolean
domain:
description: Domain such as "api.example.com"
type: string
function:
description: Function such as "nodeinfo"
type: string
ingressType:
description: IngressType such as "nginx"
type: string
path:
description: Path such as "/v1/profiles/view/(.*)", or leave empty for default
type: string
tls:
description: Enable TLS via cert-manager
type: object
properties:
enabled:
type: boolean
issuerRef:
description: ObjectReference is a reference to an object with a given name and kind.
type: object
required:
- name
properties:
kind:
type: string
name:
type: string
served: true
storage: true
status:
acceptedNames:
kind: ""
Expand Down
18 changes: 6 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@ module github.com/openfaas-incubator/ingress-operator
go 1.16

require (
github.com/go-logr/logr v0.4.0 // indirect
github.com/google/go-cmp v0.4.0
github.com/google/go-cmp v0.5.4
github.com/json-iterator/go v1.1.11 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/tools v0.1.5 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/client-go v0.19.0
k8s.io/code-generator v0.19.0
k8s.io/api v0.21.3
k8s.io/apimachinery v0.21.3
k8s.io/client-go v0.21.3
k8s.io/code-generator v0.21.3
k8s.io/gengo v0.0.0-20210707163844-888f71863374 // indirect
k8s.io/klog/v2 v2.10.0
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20210527164424-3c818078ee3d // indirect
)
Loading

0 comments on commit ed81a7b

Please sign in to comment.