Skip to content

Commit b9e465b

Browse files
committed
feat: HTTPSO-based routing table
Signed-off-by: Pedro Tôrres <[email protected]>
1 parent c87b1b8 commit b9e465b

File tree

84 files changed

+2210
-2593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2210
-2593
lines changed

.dockerignore

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
/target
1+
*.md
2+
*.yaml
3+
*.yml
4+
.*
5+
/LICENSE
26
/bin
3-
.git
4-
.gitignore
57
/charts
6-
/.vscode
7-
/bin
88
/cli
9-
/examples
9+
/config
1010
/docs
11-
/.envrc
12-
/.github
13-
/README.md
14-
/RELEASE_PROCESS.md
15-
CONTRIBUTING.md
11+
/examples
12+
/target
13+
/tests
1614
Dockerfile

.github/workflows/tests.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
- name: Manifests
5454
run: make verify-manifests
5555

56+
- name: Mockgen
57+
run: make verify-mockgen
58+
5659
- name: Build
5760
run: ARCH=${{ matrix.name }} make build
5861

@@ -71,5 +74,5 @@ jobs:
7174
with:
7275
go-version: 1.19
7376
- name: Get golangci
74-
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
77+
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
7578
- uses: pre-commit/[email protected]

.golangci.yml

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ issues:
4949
- gomnd
5050
- dupl
5151
- unparam
52+
# Exclude gci check for //+kubebuilder:scaffold:imports comments. Waiting to
53+
# resolve https://github.com/kedacore/keda/issues/4379
54+
- path: operator/main.go
55+
linters:
56+
- gci
57+
- path: operator/suite_test.go
58+
linters:
59+
- gci
5260
linters-settings:
5361
funlen:
5462
lines: 80

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This changelog keeps track of work items that have been completed and are ready
2424
- **General**: Automatically tag Docker image with commit SHA ([#567](https://github.com/kedacore/http-add-on/issues/567))
2525
- **RBAC**: Introduce fine-grained permissions per component and reduce required permissions ([#612](https://github.com/kedacore/http-add-on/issues/612))
2626
- **Operator**: Migrate project to Kubebuilder v3 ([#625](https://github.com/kedacore/http-add-on/issues/625))
27+
- **Routing**: New HTTPSO-based Routing Table ([#605](https://github.com/kedacore/http-add-on/issues/605))
2728

2829
### Fixes
2930

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ publish-multiarch: publish-operator-multiarch publish-interceptor-multiarch publ
8585

8686
# Development
8787

88-
generate: codegen manifests ## Generate code and manifests.
88+
generate: codegen manifests mockgen ## Generate code, manifests, and mocks.
8989

90-
verify: verify-codegen verify-manifests ## Verify code and manifests.
90+
verify: verify-codegen verify-manifests verify-mockgen ## Verify code, manifests, and mocks.
9191

9292
codegen: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
9393
$(CONTROLLER_GEN) object:headerFile='hack/boilerplate.go.txt' paths='./...'
@@ -104,6 +104,12 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
104104
verify-manifests: ## Verify manifests are up to date.
105105
./hack/verify-codegen.sh
106106

107+
mockgen: ## Generate mock implementations of Go interfaces.
108+
./hack/update-mockgen.sh
109+
110+
verify-mockgen: ## Verify mocks are up to date.
111+
./hack/verify-mockgen.sh
112+
107113
fmt: ## Run go fmt against code.
108114
go fmt ./...
109115

config/interceptor/deployment.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ spec:
6969
securityContext:
7070
allowPrivilegeEscalation: false
7171
readOnlyRootFilesystem: true
72-
runAsNonRoot: true
7372
capabilities:
7473
drop:
75-
- ALL
76-
seccompProfile:
77-
type: RuntimeDefault
74+
- ALL
75+
securityContext:
76+
runAsNonRoot: true
77+
seccompProfile:
78+
type: RuntimeDefault
7879
serviceAccountName: interceptor
7980
terminationGracePeriodSeconds: 10

config/interceptor/role.yaml

+2-10
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,10 @@ rules:
1313
- get
1414
- list
1515
- watch
16-
---
17-
apiVersion: rbac.authorization.k8s.io/v1
18-
kind: Role
19-
metadata:
20-
creationTimestamp: null
21-
name: interceptor
22-
namespace: keda
23-
rules:
2416
- apiGroups:
25-
- ""
17+
- http.keda.sh
2618
resources:
27-
- configmaps
19+
- httpscaledobjects
2820
verbs:
2921
- get
3022
- list

config/interceptor/role_binding.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,3 @@ roleRef:
1010
subjects:
1111
- kind: ServiceAccount
1212
name: interceptor
13-
---
14-
apiVersion: rbac.authorization.k8s.io/v1
15-
kind: RoleBinding
16-
metadata:
17-
name: interceptor
18-
roleRef:
19-
apiGroup: rbac.authorization.k8s.io
20-
kind: Role
21-
name: interceptor
22-
subjects:
23-
- kind: ServiceAccount
24-
name: interceptor

config/operator/deployment.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ spec:
5757
securityContext:
5858
allowPrivilegeEscalation: false
5959
readOnlyRootFilesystem: true
60-
runAsNonRoot: true
6160
capabilities:
6261
drop:
63-
- ALL
64-
seccompProfile:
65-
type: RuntimeDefault
62+
- ALL
63+
securityContext:
64+
runAsNonRoot: true
65+
seccompProfile:
66+
type: RuntimeDefault
6667
serviceAccountName: operator
6768
terminationGracePeriodSeconds: 10

config/scaler/deployment.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ spec:
5656
securityContext:
5757
allowPrivilegeEscalation: false
5858
readOnlyRootFilesystem: true
59-
runAsNonRoot: true
6059
capabilities:
6160
drop:
6261
- ALL
63-
seccompProfile:
64-
type: RuntimeDefault
62+
securityContext:
63+
runAsNonRoot: true
64+
seccompProfile:
65+
type: RuntimeDefault
6566
serviceAccountName: scaler
6667
terminationGracePeriodSeconds: 10

config/scaler/role.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ rules:
2121
- get
2222
- list
2323
- watch
24+
- apiGroups:
25+
- http.keda.sh
26+
resources:
27+
- httpscaledobjects
28+
verbs:
29+
- get
30+
- list
31+
- watch
2432
---
2533
apiVersion: rbac.authorization.k8s.io/v1
2634
kind: Role

e2e/k8s.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"k8s.io/client-go/rest"
1010
"sigs.k8s.io/controller-runtime/pkg/client"
1111
clientconfig "sigs.k8s.io/controller-runtime/pkg/client/config"
12-
13-
"github.com/kedacore/http-add-on/pkg/k8s"
1412
)
1513

1614
func getClient() (
@@ -35,5 +33,5 @@ func deleteNS(ns string) error {
3533

3634
func getScaledObject(ctx context.Context, cl client.Client, ns string, name string) error {
3735
var scaledObject kedav1alpha1.ScaledObject
38-
return cl.Get(ctx, k8s.ObjKey(ns, name), &scaledObject)
36+
return cl.Get(ctx, client.ObjectKey{Namespace: ns, Name: name}, &scaledObject)
3937
}

e2e/wait_deployment.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"golang.org/x/sync/errgroup"
99
appsv1 "k8s.io/api/apps/v1"
1010
"sigs.k8s.io/controller-runtime/pkg/client"
11-
12-
"github.com/kedacore/http-add-on/pkg/k8s"
1311
)
1412

1513
func waitUntilDeployment(
@@ -23,7 +21,7 @@ func waitUntilDeployment(
2321
depl := &appsv1.Deployment{}
2422
if err := cl.Get(
2523
ctx,
26-
k8s.ObjKey(ns, name),
24+
client.ObjectKey{Namespace: ns, Name: name},
2725
depl,
2826
); err != nil {
2927
return err

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ require (
66
github.com/codeskyblue/go-sh v0.0.0-20200712050446-30169cf553fe
77
github.com/go-logr/logr v1.2.4
88
github.com/go-logr/zapr v1.2.3
9+
github.com/golang/mock v1.7.0-rc.1.0.20220812172401-5b455625bd2c
10+
github.com/hashicorp/go-immutable-radix/v2 v2.0.0
911
github.com/kedacore/keda/v2 v2.10.0
1012
github.com/kelseyhightower/envconfig v1.4.0
1113
github.com/onsi/ginkgo/v2 v2.9.4
@@ -45,6 +47,7 @@ require (
4547
github.com/google/gofuzz v1.2.0 // indirect
4648
github.com/google/pprof v0.0.0-20230309165930-d61513b1440d // indirect
4749
github.com/google/uuid v1.3.0 // indirect
50+
github.com/hashicorp/golang-lru/v2 v2.0.0 // indirect
4851
github.com/imdario/mergo v0.3.14 // indirect
4952
github.com/josharian/intern v1.0.0 // indirect
5053
github.com/json-iterator/go v1.1.12 // indirect

go.sum

+15
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
6363
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
6464
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
6565
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
66+
github.com/golang/mock v1.7.0-rc.1.0.20220812172401-5b455625bd2c h1:8AzxBXzXPCzl8EEsgWirPPDA5ru+bm5dVEV/KkpAKnE=
67+
github.com/golang/mock v1.7.0-rc.1.0.20220812172401-5b455625bd2c/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs=
6668
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
6769
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
6870
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -100,6 +102,11 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
100102
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
101103
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
102104
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
105+
github.com/hashicorp/go-immutable-radix/v2 v2.0.0 h1:nq9lQ5I71Heg2lRb2/+szuIWKY3Y73d8YKyXyN91WzU=
106+
github.com/hashicorp/go-immutable-radix/v2 v2.0.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw=
107+
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
108+
github.com/hashicorp/golang-lru/v2 v2.0.0 h1:Lf+9eD8m5pncvHAOCQj49GSN6aQI8XGfI5OpXNkoWaA=
109+
github.com/hashicorp/golang-lru/v2 v2.0.0/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
103110
github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo=
104111
github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
105112
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -173,6 +180,7 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:
173180
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
174181
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
175182
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
183+
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
176184
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
177185
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
178186
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
@@ -190,12 +198,14 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
190198
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
191199
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
192200
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
201+
golang.org/x/exp v0.0.0-20221215174704-0915cd710c24 h1:6w3iSY8IIkp5OQtbYj8NeuKG1jS9d+kYaubXqsoOiQ8=
193202
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
194203
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
195204
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
196205
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
197206
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
198207
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
208+
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
199209
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
200210
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
201211
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -211,6 +221,7 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R
211221
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
212222
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
213223
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
224+
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
214225
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
215226
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
216227
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -223,6 +234,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
223234
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
224235
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
225236
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
237+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
226238
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
227239
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
228240
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -234,6 +246,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
234246
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
235247
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
236248
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
249+
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
237250
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
238251
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
239252
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -245,6 +258,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
245258
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
246259
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
247260
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
261+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
248262
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
249263
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
250264
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
@@ -259,6 +273,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
259273
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
260274
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
261275
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
276+
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
262277
golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
263278
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
264279
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

hack/tools.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ limitations under the License.
2222
package hack
2323

2424
import (
25+
_ "github.com/golang/mock/mockgen"
2526
_ "k8s.io/code-generator"
2627
)

hack/update-codegen.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ SCRIPT_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."
2424
OUTPUT_BASE="$(mktemp -d)"
2525

2626
GO_PACKAGE='github.com/kedacore/http-add-on'
27-
GEN_SUFFIX="operator/generated"
28-
API_SUFFIX="operator/apis"
27+
GEN_SUFFIX='operator/generated'
28+
API_SUFFIX='operator/apis'
2929

3030
. "${CODEGEN_PKG}/generate-groups.sh" \
3131
'client,informer,lister' \

hack/update-mockgen.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2017 The Kubernetes Authors.
4+
# Copyright 2023 The KEDA Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -o errexit
19+
set -o nounset
20+
set -o pipefail
21+
22+
OUTPUT="$(mktemp -d)"
23+
24+
GEN='operator/generated'
25+
CPY='hack/boilerplate.go.txt'
26+
PKG='mock'
27+
28+
MOCKGEN_PKG="${MOCKGEN_PKG:-$(go list -f '{{ .Dir }}' -m github.com/golang/mock 2>/dev/null)/mockgen}"
29+
MOCKGEN="${OUTPUT}/mockgen"
30+
go build -o "${MOCKGEN}" "${MOCKGEN_PKG}"
31+
32+
for SRC in $(find "${GEN}" -type 'f' -name '*.go' | grep -v '/fake/' | grep -v "/${PKG}/")
33+
do
34+
DIR="$(dirname "${SRC}")/${PKG}"
35+
mkdir -p "${DIR}"
36+
DST="${DIR}/$(basename "${SRC}")"
37+
"${MOCKGEN}" -copyright_file="${CPY}" -destination="${DST}" -package="${PKG}" -source="${SRC}"
38+
done
39+
40+
rm -fR "${OUTPUT}"

0 commit comments

Comments
 (0)