Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit 5fcbd4e

Browse files
committed
#patch: bump deps
1 parent af82150 commit 5fcbd4e

File tree

8 files changed

+82
-91
lines changed

8 files changed

+82
-91
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

api/docs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var doc = `{
2424
},
2525
"license": {
2626
"name": "MIT",
27-
"url": "https://github.com/circa10a/k8s-label-rules-webhook/blob/master/LICENSE"
27+
"url": "https://github.com/circa10a/k8s-label-rules-webhook/blob/main/LICENSE"
2828
},
2929
"version": "{{.Version}}"
3030
},
@@ -230,7 +230,7 @@ type swaggerInfo struct {
230230

231231
// SwaggerInfo holds exported Swagger Info so clients can modify it
232232
var SwaggerInfo = swaggerInfo{
233-
Version: "0.2.16",
233+
Version: "",
234234
Host: "",
235235
BasePath: "",
236236
Schemes: []string{},

api/swagger.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
},
1010
"license": {
1111
"name": "MIT",
12-
"url": "https://github.com/circa10a/k8s-label-rules-webhook/blob/master/LICENSE"
13-
},
14-
"version": "0.2.16"
12+
"url": "https://github.com/circa10a/k8s-label-rules-webhook/blob/main/LICENSE"
13+
}
1514
},
1615
"paths": {
1716
"//": {

api/swagger.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ info:
7676
description: A kubernetes webhook to standardize labels on resources
7777
license:
7878
name: MIT
79-
url: https://github.com/circa10a/k8s-label-rules-webhook/blob/master/LICENSE
79+
url: https://github.com/circa10a/k8s-label-rules-webhook/blob/main/LICENSE
8080
title: k8s-label-rules-webhook
81-
version: 0.2.16
8281
paths:
8382
//:
8483
post:

go.mod

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,41 @@ go 1.13
55
require (
66
github.com/ajg/form v1.5.1 // indirect
77
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
8-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
98
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
109
github.com/fatih/structs v1.1.0 // indirect
1110
github.com/gavv/httpexpect v2.0.0+incompatible
1211
github.com/gin-gonic/gin v1.7.7
13-
github.com/go-openapi/spec v0.20.4 // indirect
14-
github.com/go-playground/validator/v10 v10.9.0 // indirect
15-
github.com/golang/protobuf v1.5.2 // indirect
12+
github.com/go-openapi/swag v0.21.1 // indirect
13+
github.com/go-playground/validator/v10 v10.10.0 // indirect
1614
github.com/google/go-querystring v1.0.0 // indirect
1715
github.com/gorilla/websocket v1.4.1 // indirect
1816
github.com/imkira/go-interpol v1.1.0 // indirect
19-
github.com/json-iterator/go v1.1.12 // indirect
2017
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
2118
github.com/mailru/easyjson v0.7.7 // indirect
2219
github.com/mattn/go-colorable v0.1.6 // indirect
2320
github.com/mattn/go-isatty v0.0.14 // indirect
2421
github.com/moul/http2curl v1.0.0 // indirect
2522
github.com/onsi/ginkgo v1.12.0 // indirect
2623
github.com/onsi/gomega v1.9.0 // indirect
27-
github.com/prometheus/common v0.32.1 // indirect
28-
github.com/prometheus/procfs v0.7.3 // indirect
24+
github.com/prometheus/client_golang v1.12.1 // indirect
2925
github.com/sergi/go-diff v1.0.0 // indirect
3026
github.com/sirupsen/logrus v1.8.1
31-
github.com/smartystreets/goconvey v1.6.4 // indirect
3227
github.com/stretchr/testify v1.7.0
3328
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2
34-
github.com/swaggo/gin-swagger v1.3.3
35-
github.com/swaggo/swag v1.7.4
36-
github.com/ugorji/go v1.2.6 // indirect
29+
github.com/swaggo/gin-swagger v1.4.1
30+
github.com/swaggo/swag v1.8.0
31+
github.com/ugorji/go v1.2.7 // indirect
3732
github.com/valyala/fasthttp v1.7.0 // indirect
3833
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
3934
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
4035
github.com/yudai/gojsondiff v1.0.0 // indirect
4136
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
4237
github.com/yudai/pp v2.0.1+incompatible // indirect
4338
github.com/zsais/go-gin-prometheus v0.1.0
44-
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
45-
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 // indirect
46-
golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect
47-
golang.org/x/tools v0.1.7 // indirect
39+
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
40+
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
41+
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
42+
golang.org/x/tools v0.1.9 // indirect
4843
google.golang.org/protobuf v1.27.1 // indirect
4944
gopkg.in/yaml.v2 v2.4.0
5045
)

go.sum

Lines changed: 42 additions & 35 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ func flags() {
6767
}
6868

6969
// @title k8s-label-rules-webhook
70-
// @version 0.2.16
7170
// @description A kubernetes webhook to standardize labels on resources
7271

7372
// @contact.name GitHub
7473
// @contact.url https://github.com/circa10a/k8s-label-rules-webhook/
7574

7675
// @license.name MIT
77-
// @license.url https://github.com/circa10a/k8s-label-rules-webhook/blob/master/LICENSE
76+
// @license.url https://github.com/circa10a/k8s-label-rules-webhook/blob/main/LICENSE
7877
func main() {
7978
// Output version of application
8079
log.Infof("Version: %v", Version)

routes.go

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,6 @@ import (
99
ginSwagger "github.com/swaggo/gin-swagger"
1010
)
1111

12-
// Generate response to return to k8s
13-
func sendResponse(c *gin.Context, k8sRequest *k8sRequest, uid string, allowed bool, code int, message string) {
14-
r := &webhookResponse{
15-
APIVersion: k8sRequest.APIVersion,
16-
Kind: k8sRequest.Kind,
17-
Response: response{
18-
UID: uid,
19-
Allowed: allowed,
20-
Status: status{
21-
Code: code,
22-
Message: message,
23-
},
24-
},
25-
}
26-
c.JSON(http.StatusOK, &r)
27-
}
28-
2912
// K8s webhook context godoc
3013
// @Summary Respond to k8s with approval or rejection of labels compared against the ruleset
3114
// @Description Respond to k8s with approval or rejection of labels compared against the ruleset
@@ -44,11 +27,32 @@ func labelValidationHandler() gin.HandlerFunc {
4427
matchLabelErr := R.ensureLabelsMatchRules(labels)
4528
// Reject request if not
4629
if matchLabelErr != nil {
47-
sendResponse(c, k8sData, uid, false, http.StatusForbidden, matchLabelErr.Error())
30+
c.JSON(http.StatusOK, &webhookResponse{
31+
APIVersion: k8sData.APIVersion,
32+
Kind: k8sData.Kind,
33+
Response: response{
34+
UID: uid,
35+
Allowed: false,
36+
Status: status{
37+
Code: http.StatusForbidden,
38+
Message: matchLabelErr.Error(),
39+
},
40+
},
41+
})
4842
return
4943
}
50-
// All constraints passed
51-
sendResponse(c, k8sData, uid, true, http.StatusOK, "Labels conform to ruleset")
44+
c.JSON(http.StatusOK, &webhookResponse{
45+
APIVersion: k8sData.APIVersion,
46+
Kind: k8sData.Kind,
47+
Response: response{
48+
UID: uid,
49+
Allowed: true,
50+
Status: status{
51+
Code: http.StatusOK,
52+
Message: "Labels conform to ruleset",
53+
},
54+
},
55+
})
5256
return
5357
}
5458
// In the event, nothing to bind to

0 commit comments

Comments
 (0)