Compare commits
2 commits
0b647ed4d8
...
d2bf694e4e
Author | SHA1 | Date | |
---|---|---|---|
d2bf694e4e | |||
dd897c7364 |
3 changed files with 9 additions and 8 deletions
|
@ -31,9 +31,9 @@
|
||||||
[coll cp/map-or-seq?
|
[coll cp/map-or-seq?
|
||||||
match-value string?
|
match-value string?
|
||||||
replace-value cp/str-or-number?]
|
replace-value cp/str-or-number?]
|
||||||
(clojure.walk/postwalk #(if (and (= (type value-to-match) (type %))
|
(clojure.walk/postwalk #(if (and (= (type match-value) (type %))
|
||||||
(= value-to-match %))
|
(= match-value %))
|
||||||
value-to-replace
|
replace-value
|
||||||
%)
|
%)
|
||||||
coll))
|
coll))
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
(s/def ::burst-rate ::int/burst-rate)
|
(s/def ::burst-rate ::int/burst-rate)
|
||||||
|
|
||||||
(def simple-ingress? (s/keys :req-un [::fqdns ::service-name ::service-port]
|
(def simple-ingress? (s/keys :req-un [::fqdns ::service-name ::service-port]
|
||||||
:opt-un [::issuer ::average-rate ::ns/namespace]))
|
:opt-un [::issuer ::average-rate ::burst-rate ::ns/namespace]))
|
||||||
|
|
||||||
(def ingress? (s/keys :req-un [::fqdns ::app-name ::ingress-name ::service-name ::service-port]
|
(def ingress? (s/keys :req-un [::fqdns ::app-name ::ingress-name ::service-name ::service-port]
|
||||||
:opt-un [::issuer ::cert-name ::rate-limit-name ::ns/namespace]))
|
:opt-un [::issuer ::cert-name ::rate-limit-name ::ns/namespace]))
|
||||||
|
@ -32,7 +32,8 @@
|
||||||
(def default-config
|
(def default-config
|
||||||
(merge ns/default-config
|
(merge ns/default-config
|
||||||
{:issuer "staging"
|
{:issuer "staging"
|
||||||
:average-rate 10}))
|
:average-rate 10
|
||||||
|
:burst-rate 20}))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-certificate map?
|
(defn-spec generate-certificate map?
|
||||||
|
@ -70,10 +71,10 @@
|
||||||
:rate-limit-name service-name}
|
:rate-limit-name service-name}
|
||||||
default-config
|
default-config
|
||||||
config)
|
config)
|
||||||
{:keys [average-rate]} final-config]
|
{:keys [average-rate burst-rate]} final-config]
|
||||||
[(int/generate-certificate final-config)
|
[(int/generate-certificate final-config)
|
||||||
(int/generate-rate-limit-middleware {:rate-limit-name service-name
|
(int/generate-rate-limit-middleware {:rate-limit-name service-name
|
||||||
:namespace (:namespace final-config)
|
:namespace (:namespace final-config)
|
||||||
:average-rate average-rate
|
:average-rate average-rate
|
||||||
:burst-rate average-rate})
|
:burst-rate burst-rate})
|
||||||
(int/generate-ingress final-config)]))
|
(int/generate-ingress final-config)]))
|
|
@ -101,7 +101,7 @@
|
||||||
:kind "Middleware",
|
:kind "Middleware",
|
||||||
:metadata {:name "web-ratelimit"
|
:metadata {:name "web-ratelimit"
|
||||||
:namespace "default"},
|
:namespace "default"},
|
||||||
:spec {:rateLimit {:average 10, :burst 10}}}
|
:spec {:rateLimit {:average 10, :burst 20}}}
|
||||||
{:apiVersion "networking.k8s.io/v1",
|
{:apiVersion "networking.k8s.io/v1",
|
||||||
:kind "Ingress",
|
:kind "Ingress",
|
||||||
:metadata
|
:metadata
|
||||||
|
|
Loading…
Reference in a new issue