Class: Kubes::Compiler::Dsl::Syntax::NetworkPolicy

Inherits:
Resource
  • Object
show all
Defined in:
lib/kubes/compiler/dsl/syntax/network_policy.rb

Instance Attribute Summary

Attributes inherited from Resource

#kind_from_block

Instance Method Summary collapse

Methods inherited from Resource

#default_kind, #default_metadata, #default_result, #default_result_append, #default_top, #field, #top

Methods included from Util::Normalize

#extract_type, #normalize_kind

Instance Method Details

#default_apiVersionObject



19
20
21
# File 'lib/kubes/compiler/dsl/syntax/network_policy.rb', line 19

def default_apiVersion
  "networking.k8s.io/v1"
end

#default_fromObject



31
32
33
34
35
36
37
# File 'lib/kubes/compiler/dsl/syntax/network_policy.rb', line 31

def default_from
  [
    { namespaceSelector: { matchLabels: fromNamespace } },
    { podSelector: { matchLabels: fromPod } },
    { ipBlock: fromIpBlock }
  ]
end

#default_specObject



23
24
25
26
27
28
29
# File 'lib/kubes/compiler/dsl/syntax/network_policy.rb', line 23

def default_spec
  {
    podSelector: { matchLabels: matchLabels },
    ingress: [from: from],
    egress: [to: to],
  }
end

#default_toObject



39
40
41
42
43
44
45
# File 'lib/kubes/compiler/dsl/syntax/network_policy.rb', line 39

def default_to
  [
    { namespaceSelector: { matchLabels: toNamespace } },
    { podSelector: { matchLabels: toPod } },
    { ipBlock: toIpBlock }
  ]
end