metatron 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/metatron/templates/cluster_role.rb +3 -1
- data/lib/metatron/templates/role.rb +33 -0
- data/lib/metatron/templates/role_binding.rb +40 -0
- data/lib/metatron/version.rb +1 -1
- data/lib/metatron.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f342d1873c69021096bb8c70ac712de9f2584c8e67898a62d42cd4336257ccb
|
4
|
+
data.tar.gz: c06caf4e8b626a1762ab872ab5b63b2c7a970fc62087e4df42c86bef051dc76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab60f4188c7c8c58990f3f275813763343b5c56e123885537732f64d66183005a25194f68034fe7f1c2f85ff51f4d42c6a9766557adda875d5ecdbe5f290137f
|
7
|
+
data.tar.gz: '08c3dfea5cb6ea36a31a7a848ff95e3dfc282ea0cee946fc4646d034bdfad696a2b5910a883ce425fa8bd2b52a65e09cb65fa3f7c3545e3db14783a6898ed9b2'
|
data/Gemfile.lock
CHANGED
@@ -25,9 +25,11 @@ module Metatron
|
|
25
25
|
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
26
26
|
}.merge(formatted_annotations).compact,
|
27
27
|
aggregationRule:,
|
28
|
-
rules:
|
28
|
+
rules: formatted_rules
|
29
29
|
}.compact
|
30
30
|
end
|
31
|
+
|
32
|
+
def formatted_rules = rules.map { _1.respond_to?(:render) ? _1.render : _1 }
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Metatron
|
4
|
+
module Templates
|
5
|
+
# Template for basic Role k8s resource
|
6
|
+
class Role < Template
|
7
|
+
include Concerns::Annotated
|
8
|
+
include Concerns::Namespaced
|
9
|
+
|
10
|
+
attr_accessor :rules
|
11
|
+
|
12
|
+
def initialize(name)
|
13
|
+
super(name)
|
14
|
+
@api_version = "rbac.authorization.k8s.io/v1"
|
15
|
+
@rules = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def render
|
19
|
+
{
|
20
|
+
apiVersion:,
|
21
|
+
kind:,
|
22
|
+
metadata: {
|
23
|
+
name:,
|
24
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
25
|
+
}.merge(formatted_annotations).merge(formatted_namespace).compact,
|
26
|
+
rules: formatted_rules
|
27
|
+
}.compact
|
28
|
+
end
|
29
|
+
|
30
|
+
def formatted_rules = rules.map { _1.respond_to?(:render) ? _1.render : _1 }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Metatron
|
4
|
+
module Templates
|
5
|
+
# Template for basic RoleBinding k8s resource
|
6
|
+
class RoleBinding < Template
|
7
|
+
include Concerns::Annotated
|
8
|
+
include Concerns::Namespaced
|
9
|
+
|
10
|
+
attr_accessor :role_ref, :subjects, :role
|
11
|
+
|
12
|
+
alias roleRef role_ref
|
13
|
+
|
14
|
+
def initialize(name, role)
|
15
|
+
super(name)
|
16
|
+
@api_version = "rbac.authorization.k8s.io/v1"
|
17
|
+
@role = role
|
18
|
+
@role_ref = {
|
19
|
+
kind: "Role",
|
20
|
+
name: role.respond_to?(:name) ? role.name : role,
|
21
|
+
apiGroup: "rbac.authorization.k8s.io"
|
22
|
+
}
|
23
|
+
@subjects = []
|
24
|
+
end
|
25
|
+
|
26
|
+
def render
|
27
|
+
{
|
28
|
+
apiVersion:,
|
29
|
+
kind:,
|
30
|
+
metadata: {
|
31
|
+
name:,
|
32
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
33
|
+
}.merge(formatted_annotations).merge(formatted_namespace).compact,
|
34
|
+
roleRef:,
|
35
|
+
subjects:
|
36
|
+
}.compact
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/metatron/version.rb
CHANGED
data/lib/metatron.rb
CHANGED
@@ -41,6 +41,8 @@ require "metatron/templates/ingress"
|
|
41
41
|
require "metatron/templates/namespace"
|
42
42
|
require "metatron/templates/persistent_volume_claim"
|
43
43
|
require "metatron/templates/replica_set"
|
44
|
+
require "metatron/templates/role"
|
45
|
+
require "metatron/templates/role_binding"
|
44
46
|
require "metatron/templates/secret"
|
45
47
|
require "metatron/templates/service"
|
46
48
|
require "metatron/templates/service_account"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Gnagy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -272,6 +272,8 @@ files:
|
|
272
272
|
- lib/metatron/templates/persistent_volume_claim.rb
|
273
273
|
- lib/metatron/templates/pod.rb
|
274
274
|
- lib/metatron/templates/replica_set.rb
|
275
|
+
- lib/metatron/templates/role.rb
|
276
|
+
- lib/metatron/templates/role_binding.rb
|
275
277
|
- lib/metatron/templates/secret.rb
|
276
278
|
- lib/metatron/templates/service.rb
|
277
279
|
- lib/metatron/templates/service_account.rb
|