Compare commits
No commits in common. "d2bf694e4e8b44f8a7de0372b81ce04dd1726c3e" and "0b647ed4d8eb2ce828ee0b353fc3e08d70b76456" have entirely different histories.
d2bf694e4e
...
0b647ed4d8
3 changed files with 8 additions and 9 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 match-value) (type %))
|
(clojure.walk/postwalk #(if (and (= (type value-to-match) (type %))
|
||||||
(= match-value %))
|
(= value-to-match %))
|
||||||
replace-value
|
value-to-replace
|
||||||
%)
|
%)
|
||||||
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 ::burst-rate ::ns/namespace]))
|
:opt-un [::issuer ::average-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,8 +32,7 @@
|
||||||
(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?
|
||||||
|
@ -71,10 +70,10 @@
|
||||||
:rate-limit-name service-name}
|
:rate-limit-name service-name}
|
||||||
default-config
|
default-config
|
||||||
config)
|
config)
|
||||||
{:keys [average-rate burst-rate]} final-config]
|
{:keys [average-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 burst-rate})
|
:burst-rate average-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 20}}}
|
:spec {:rateLimit {:average 10, :burst 10}}}
|
||||||
{:apiVersion "networking.k8s.io/v1",
|
{:apiVersion "networking.k8s.io/v1",
|
||||||
:kind "Ingress",
|
:kind "Ingress",
|
||||||
:metadata
|
:metadata
|
||||||
|
|
Loading…
Reference in a new issue