Class: Gitlab::Kubernetes::Ingress
- Inherits:
-
Object
- Object
- Gitlab::Kubernetes::Ingress
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/kubernetes/ingress.rb
Constant Summary collapse
- ANNOTATION_KEY_CANARY =
Canary Ingress Annotations kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#canary
'nginx.ingress.kubernetes.io/canary'
- ANNOTATION_KEY_CANARY_WEIGHT =
'nginx.ingress.kubernetes.io/canary-weight'
Instance Method Summary collapse
- #canary? ⇒ Boolean
- #canary_weight ⇒ Object
-
#initialize(attributes = {}) ⇒ Ingress
constructor
A new instance of Ingress.
- #name ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Ingress
Returns a new instance of Ingress.
12 13 14 |
# File 'lib/gitlab/kubernetes/ingress.rb', line 12 def initialize(attributes = {}) @attributes = attributes end |
Instance Method Details
#canary? ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/gitlab/kubernetes/ingress.rb', line 16 def canary? strong_memoize(:is_canary) do annotations.any? do |key, value| key == ANNOTATION_KEY_CANARY && value == 'true' end end end |
#canary_weight ⇒ Object
24 25 26 27 28 29 |
# File 'lib/gitlab/kubernetes/ingress.rb', line 24 def canary_weight return unless canary? return unless annotations.key?(ANNOTATION_KEY_CANARY_WEIGHT) annotations[ANNOTATION_KEY_CANARY_WEIGHT].to_i end |
#name ⇒ Object
31 32 33 |
# File 'lib/gitlab/kubernetes/ingress.rb', line 31 def name ['name'] end |