kubes 0.4.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/docs/_docs/config/reference.md +1 -0
- data/docs/_docs/config/skip.md +1 -1
- data/docs/_docs/dsl/multiple-resources.md +3 -3
- data/docs/_docs/dsl/resources/job.md +62 -0
- data/docs/_docs/extra-env/dsl.md +2 -2
- data/docs/_docs/extra-env/yaml.md +1 -1
- data/docs/_docs/generators.md +41 -0
- data/docs/_docs/helpers.md +10 -3
- data/docs/_docs/helpers/aws.md +15 -0
- data/docs/_docs/helpers/aws/iam-role.md +91 -0
- data/docs/_docs/helpers/aws/secrets.md +129 -0
- data/docs/_docs/helpers/aws/ssm.md +76 -0
- data/docs/_docs/helpers/custom.md +40 -0
- data/docs/_docs/helpers/google.md +17 -0
- data/docs/_docs/helpers/google/secrets.md +76 -0
- data/docs/_docs/helpers/google/service-account.md +60 -0
- data/docs/_docs/intro.md +3 -1
- data/docs/_docs/intro/docker-image.md +66 -0
- data/docs/_docs/intro/how-kubes-works.md +7 -11
- data/docs/_docs/layering/merge.md +1 -1
- data/docs/_docs/learn/dsl/delete.md +10 -2
- data/docs/_docs/learn/dsl/review-project.md +2 -2
- data/docs/_docs/learn/yaml/delete.md +10 -2
- data/docs/_docs/learn/yaml/review-project.md +2 -2
- data/docs/_docs/patterns/clock-web-worker.md +3 -3
- data/docs/_docs/patterns/migrations.md +1 -1
- data/docs/_docs/patterns/secrets.md +0 -2
- data/docs/_docs/yaml.md +2 -2
- data/docs/_includes/commands.html +2 -2
- data/docs/_includes/helpers/base64.md +1 -0
- data/docs/_includes/sidebar.html +23 -1
- data/docs/_reference/kubes-delete.md +1 -1
- data/docs/_reference/kubes-exec.md +17 -1
- data/docs/_reference/kubes-init.md +2 -2
- data/docs/_reference/kubes-logs.md +2 -1
- data/docs/_reference/kubes-new.md +58 -0
- data/docs/_reference/kubes-prune.md +22 -0
- data/docs/reference.md +2 -0
- data/kubes.gemspec +1 -0
- data/lib/kubes.rb +2 -0
- data/lib/kubes/autoloader.rb +9 -0
- data/lib/kubes/cli.rb +9 -1
- data/lib/kubes/cli/build.rb +6 -0
- data/lib/kubes/cli/compile.rb +7 -0
- data/lib/kubes/cli/deploy.rb +1 -6
- data/lib/kubes/cli/exec.rb +5 -1
- data/lib/kubes/cli/help/exec.md +15 -0
- data/lib/kubes/cli/help/new.md +30 -0
- data/lib/kubes/cli/init.rb +1 -1
- data/lib/kubes/cli/new.rb +97 -0
- data/lib/kubes/cli/sequence.rb +1 -0
- data/lib/kubes/command.rb +7 -0
- data/lib/kubes/compiler.rb +19 -21
- data/lib/kubes/compiler/dsl/syntax/job.rb +217 -0
- data/lib/kubes/compiler/shared/custom_helpers.rb +17 -0
- data/lib/kubes/compiler/shared/helpers.rb +12 -3
- data/lib/kubes/compiler/shared/helpers/deprecated.rb +37 -0
- data/lib/kubes/compiler/strategy/base.rb +1 -0
- data/lib/kubes/compiler/strategy/dsl.rb +1 -0
- data/lib/kubes/compiler/strategy/erb.rb +2 -0
- data/lib/kubes/config.rb +1 -1
- data/lib/kubes/core.rb +6 -0
- data/lib/kubes/docker/strategy/image_name.rb +1 -1
- data/lib/kubes/kubectl.rb +5 -23
- data/lib/kubes/kubectl/batch.rb +27 -33
- data/lib/kubes/kubectl/ordering.rb +42 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/base/.kubes/config.rb.tt +1 -1
- data/lib/templates/base/.kubes/config/env/dev.rb +1 -1
- data/lib/templates/base/.kubes/config/env/prod.rb +1 -1
- data/lib/templates/dsl/.kubes/resources/web/deployment.rb +1 -1
- data/lib/templates/new/dsl/backend_config.rb +10 -0
- data/lib/templates/new/dsl/config_map.rb +5 -0
- data/lib/templates/new/dsl/daemon_set.rb +11 -0
- data/lib/templates/new/dsl/deployment.rb +4 -0
- data/lib/templates/new/dsl/ingress.rb +3 -0
- data/lib/templates/new/dsl/job.rb +2 -0
- data/lib/templates/new/dsl/managed_certificate.rb +2 -0
- data/lib/templates/new/dsl/namespace.rb +2 -0
- data/lib/templates/new/dsl/network_policy.rb +7 -0
- data/lib/templates/new/dsl/pod.rb +6 -0
- data/lib/templates/new/dsl/role.rb +4 -0
- data/lib/templates/new/dsl/role_binding.rb +7 -0
- data/lib/templates/new/dsl/secret.rb +5 -0
- data/lib/templates/new/dsl/service.rb +2 -0
- data/lib/templates/new/dsl/service_account.rb +1 -0
- data/lib/templates/new/yaml/backend_config.yaml +10 -0
- data/lib/templates/new/yaml/config_map.yaml +9 -0
- data/lib/templates/new/yaml/daemon_set.yaml +11 -0
- data/lib/templates/new/yaml/deployment.yaml +19 -0
- data/lib/templates/new/yaml/ingress.yaml +12 -0
- data/lib/templates/new/yaml/job.yaml +19 -0
- data/lib/templates/new/yaml/managed_certificate.yaml +7 -0
- data/lib/templates/new/yaml/namespace.yaml +6 -0
- data/lib/templates/new/yaml/network_policy.yaml +20 -0
- data/lib/templates/new/yaml/pod.yaml +11 -0
- data/lib/templates/new/yaml/role.yaml +13 -0
- data/lib/templates/new/yaml/role_binding.yaml +11 -0
- data/lib/templates/new/yaml/secret.yaml +9 -0
- data/lib/templates/new/yaml/service.yaml +14 -0
- data/lib/templates/new/yaml/service_account.yaml +4 -0
- data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +1 -1
- data/spec/kubes/cli/prune_spec.rb +1 -0
- data/spec/kubes/compiler_spec.rb +5 -1
- metadata +65 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
$ kubes new ingress
|
|
4
|
+
create .kubes/resources/web/ingress.yaml
|
|
5
|
+
$ kubes new service_account
|
|
6
|
+
create .kubes/resources/shared/service_account.yaml
|
|
7
|
+
$
|
|
8
|
+
|
|
9
|
+
## Supported Resources
|
|
10
|
+
|
|
11
|
+
Here's a list of some of the supported resources.
|
|
12
|
+
|
|
13
|
+
backend_config
|
|
14
|
+
config_map
|
|
15
|
+
daemon_set
|
|
16
|
+
deployment
|
|
17
|
+
ingress
|
|
18
|
+
job
|
|
19
|
+
managed_certificate
|
|
20
|
+
namespace
|
|
21
|
+
network_policy
|
|
22
|
+
pod
|
|
23
|
+
role_binding
|
|
24
|
+
role
|
|
25
|
+
secret
|
|
26
|
+
service_account
|
|
27
|
+
service
|
|
28
|
+
|
|
29
|
+
Refer to the source code to all the resources that the generator supports:
|
|
30
|
+
https://github.com/boltops-tools/kubes/blob/master/lib/templates/new/yaml
|
data/lib/kubes/cli/init.rb
CHANGED
|
@@ -3,7 +3,7 @@ class Kubes::CLI
|
|
|
3
3
|
def self.options
|
|
4
4
|
[
|
|
5
5
|
[:app, aliases: ["a"], required: true, desc: "Docker repo name. Example: web. Generates .kubes/APP/resources folder"],
|
|
6
|
-
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
|
6
|
+
[:force, aliases: ["y"], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
|
7
7
|
[:type, aliases: ["t"], default: "yaml", desc: "Type: dsl or yaml"],
|
|
8
8
|
[:repo, required: true, desc: "Docker repo name. Example: user/repo. Configures .kubes/config.rb"],
|
|
9
9
|
[:namespace, aliases: ["n"], desc: "Namespace to use, defaults to APP-ENV. IE: demo-dev"],
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
class Kubes::CLI
|
|
2
|
+
class New < Sequence
|
|
3
|
+
argument :kind
|
|
4
|
+
|
|
5
|
+
def self.options
|
|
6
|
+
[
|
|
7
|
+
[:app, aliases: ["a"], default: "demo", desc: "App name"],
|
|
8
|
+
[:force, aliases: ["y"], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
|
9
|
+
[:role, aliases: ["r"], desc: "Role. IE: web, clock, worker, migrate, etc. Defaults to convention: web or shared when not set"],
|
|
10
|
+
[:type, aliases: ["t"], default: "yaml", desc: "Type: dsl or yaml"],
|
|
11
|
+
]
|
|
12
|
+
end
|
|
13
|
+
options.each { |args| class_option(*args) }
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
def app
|
|
17
|
+
options[:app]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def role
|
|
21
|
+
role = options[:role]
|
|
22
|
+
return role if role
|
|
23
|
+
shared = %w[
|
|
24
|
+
config_map
|
|
25
|
+
namespace
|
|
26
|
+
network_policy
|
|
27
|
+
persistent_volume
|
|
28
|
+
persistent_volume_claim
|
|
29
|
+
secret
|
|
30
|
+
service_account
|
|
31
|
+
]
|
|
32
|
+
if shared.include?(full_kind)
|
|
33
|
+
"shared"
|
|
34
|
+
elsif full_kind == "job"
|
|
35
|
+
"migrate"
|
|
36
|
+
else
|
|
37
|
+
"web"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def full_kind
|
|
42
|
+
# shorthands
|
|
43
|
+
map = {
|
|
44
|
+
cj: "cron_job",
|
|
45
|
+
cm: "config_map",
|
|
46
|
+
crd: "custom_resource_definition",
|
|
47
|
+
crds: "custom_resource_definition",
|
|
48
|
+
cs: "component_statuses",
|
|
49
|
+
csr: "certificate_signing_request",
|
|
50
|
+
deploy: "deployment",
|
|
51
|
+
ds: "daemonset",
|
|
52
|
+
ep: "endpoints",
|
|
53
|
+
ev: "event",
|
|
54
|
+
hpa: "horizontal_pod_autoscaler",
|
|
55
|
+
ing: "ingress",
|
|
56
|
+
limits: "limit_range",
|
|
57
|
+
netpol: "network_policy",
|
|
58
|
+
no: "node",
|
|
59
|
+
ns: "namespace",
|
|
60
|
+
pc: "priority_class",
|
|
61
|
+
pdb: "pod_disruption_budget",
|
|
62
|
+
po: "pod",
|
|
63
|
+
psp: "pods_ecurity_policy",
|
|
64
|
+
pv: "persistent_volume",
|
|
65
|
+
pvc: "persistent_volume_claim",
|
|
66
|
+
quota: "resource_quota",
|
|
67
|
+
rc: "replication_controller",
|
|
68
|
+
rs: "replica_set",
|
|
69
|
+
sa: "service_account",
|
|
70
|
+
sc: "storage_classes",
|
|
71
|
+
sgp: "security_group_policy",
|
|
72
|
+
sts: "stateful_set",
|
|
73
|
+
svc: "service",
|
|
74
|
+
}.stringify_keys!
|
|
75
|
+
map[kind] || kind
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def file
|
|
79
|
+
ext = options[:type] == "yaml" ? "yaml" : "rb"
|
|
80
|
+
"#{full_kind}.#{ext}"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
public
|
|
84
|
+
def set_template_source
|
|
85
|
+
path = File.expand_path("../../templates/new/#{options[:type]}/#{file}", __dir__)
|
|
86
|
+
unless File.exist?(path)
|
|
87
|
+
logger.info "ERROR: Generator for #{file} not supported".color(:red)
|
|
88
|
+
exit 1
|
|
89
|
+
end
|
|
90
|
+
set_source("new/#{options[:type]}")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def create_resource
|
|
94
|
+
template file, ".kubes/resources/#{role}/#{file}"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
data/lib/kubes/cli/sequence.rb
CHANGED
data/lib/kubes/command.rb
CHANGED
|
@@ -28,6 +28,8 @@ module Kubes
|
|
|
28
28
|
class Command < Thor
|
|
29
29
|
class << self
|
|
30
30
|
def dispatch(m, args, options, config)
|
|
31
|
+
check_project!(args.first)
|
|
32
|
+
|
|
31
33
|
# Allow calling for help via:
|
|
32
34
|
# kubes command help
|
|
33
35
|
# kubes command -h
|
|
@@ -54,6 +56,11 @@ module Kubes
|
|
|
54
56
|
super
|
|
55
57
|
end
|
|
56
58
|
|
|
59
|
+
def check_project!(command_name)
|
|
60
|
+
return if %w[init new].include?(command_name)
|
|
61
|
+
Kubes.check_project!
|
|
62
|
+
end
|
|
63
|
+
|
|
57
64
|
# Override command_help to include the description at the top of the
|
|
58
65
|
# long_description.
|
|
59
66
|
def command_help(shell, command_name)
|
data/lib/kubes/compiler.rb
CHANGED
|
@@ -3,6 +3,7 @@ module Kubes
|
|
|
3
3
|
include Kubes::Hooks::Concern
|
|
4
4
|
include Kubes::Logging
|
|
5
5
|
include Kubes::Util::Consider
|
|
6
|
+
include Kubes::Kubectl::Ordering
|
|
6
7
|
|
|
7
8
|
def initialize(options={})
|
|
8
9
|
@options = options
|
|
@@ -21,7 +22,9 @@ module Kubes
|
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
write_full
|
|
26
|
+
|
|
27
|
+
logger.info "Compiled .kubes/resources files to .kubes/output" if show_compiled_message?
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
def resources
|
|
@@ -34,24 +37,6 @@ module Kubes
|
|
|
34
37
|
paths
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
# Only considering files 2 layers deep. So:
|
|
38
|
-
#
|
|
39
|
-
# Yes = web/deployment.yaml
|
|
40
|
-
# No = web/deployment/dev.yaml
|
|
41
|
-
#
|
|
42
|
-
def process?(path)
|
|
43
|
-
if Kubes.kustomize?
|
|
44
|
-
File.file?(path)
|
|
45
|
-
else
|
|
46
|
-
consider?(path) && two_levels_deep?(path)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def two_levels_deep?(path)
|
|
51
|
-
rel_path = path.sub(%r{.*\.kubes/resources/},'')
|
|
52
|
-
rel_path.split('/').size == 2
|
|
53
|
-
end
|
|
54
|
-
|
|
55
40
|
def write(result)
|
|
56
41
|
result.decorate!(:post)
|
|
57
42
|
filename, content = result.filename, result.content
|
|
@@ -64,12 +49,25 @@ module Kubes
|
|
|
64
49
|
IO.write(dest, content)
|
|
65
50
|
end
|
|
66
51
|
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
logger.debug "Compiled #{pretty(dest)}"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def write_full
|
|
56
|
+
full = sorted_files.inject([]) do |acc, file|
|
|
57
|
+
acc << IO.read(file)
|
|
58
|
+
end
|
|
59
|
+
content = full.join("\n")
|
|
60
|
+
path = "#{Kubes.root}/.kubes/output/full.yaml"
|
|
61
|
+
IO.write(path, content)
|
|
62
|
+
logger.debug "Compiled #{pretty(path)}"
|
|
69
63
|
end
|
|
70
64
|
|
|
71
65
|
def show_compiled_message?
|
|
72
66
|
!%w[g ge get].include?(ARGV.first)
|
|
73
67
|
end
|
|
68
|
+
|
|
69
|
+
def pretty(path)
|
|
70
|
+
path.sub("#{Kubes.root}/",'')
|
|
71
|
+
end
|
|
74
72
|
end
|
|
75
73
|
end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
module Kubes::Compiler::Dsl::Syntax
|
|
2
|
+
class Job < Resource
|
|
3
|
+
fields :container, # <Object>
|
|
4
|
+
"matchLabels:hash", # <map[string]string>
|
|
5
|
+
:sidecar, # <Object>
|
|
6
|
+
:sidecar_name, # <string>
|
|
7
|
+
:sidecar_image, # <string>
|
|
8
|
+
:templateMetadata, # <Object>
|
|
9
|
+
:templateSpec # <Object>
|
|
10
|
+
|
|
11
|
+
# kubectl explain job.spec
|
|
12
|
+
fields :activeDeadlineSeconds, # <integer>
|
|
13
|
+
:backoffLimit, # <integer>
|
|
14
|
+
:completions, # <integer>
|
|
15
|
+
:manualSelector, # <boolean>
|
|
16
|
+
:parallelism, # <integer>
|
|
17
|
+
:selector, # <Object>
|
|
18
|
+
:template, # <Object> -required-
|
|
19
|
+
:ttlSecondsAfterFinished # <integer>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# kubectl explain job.spec.template.spec
|
|
23
|
+
fields :activeDeadlineSeconds, # <integer>
|
|
24
|
+
:affinity, # <Object>
|
|
25
|
+
:automountServiceAccountToken, # <boolean>
|
|
26
|
+
:containers, # <[]Object> -required-
|
|
27
|
+
:dnsConfig, # <Object>
|
|
28
|
+
:dnsPolicy, # <string>
|
|
29
|
+
:enableServiceLinks, # <boolean>
|
|
30
|
+
:ephemeralContainers, # <[]Object>
|
|
31
|
+
:hostAliases, # <[]Object>
|
|
32
|
+
:hostIPC, # <boolean>
|
|
33
|
+
:hostNetwork, # <boolean>
|
|
34
|
+
:hostPID, # <boolean>
|
|
35
|
+
:hostname, # <string>
|
|
36
|
+
:imagePullSecrets, # <[]Object>
|
|
37
|
+
:initContainers, # <[]Object>
|
|
38
|
+
:nodeName, # <string>
|
|
39
|
+
:nodeSelector, # <map[string]string>
|
|
40
|
+
:overhead, # <map[string]string>
|
|
41
|
+
:preemptionPolicy, # <string>
|
|
42
|
+
:priority, # <integer>
|
|
43
|
+
:priorityClassName, # <string>
|
|
44
|
+
:readinessGates, # <[]Object>
|
|
45
|
+
:restartPolicy, # <string>
|
|
46
|
+
:runtimeClassName, # <string>
|
|
47
|
+
:schedulerName, # <string>
|
|
48
|
+
:securityContext, # <Object>
|
|
49
|
+
:serviceAccount, # <string>
|
|
50
|
+
:serviceAccountName, # <string>
|
|
51
|
+
:shareProcessNamespace, # <boolean>
|
|
52
|
+
:subdomain, # <string>
|
|
53
|
+
:terminationGracePeriodSeconds,# <integer>
|
|
54
|
+
:tolerations, # <[]Object>
|
|
55
|
+
:topologySpreadConstraints, # <[]Object>
|
|
56
|
+
:volumes # <[]Object>
|
|
57
|
+
|
|
58
|
+
# kubectl explain deployment.spec.template.spec.containers
|
|
59
|
+
fields :args, # <[]string>
|
|
60
|
+
:command, # <[]string>
|
|
61
|
+
:env, # <[]Object>
|
|
62
|
+
:envFrom, # <[]Object>
|
|
63
|
+
:image, # <string>
|
|
64
|
+
:imagePullPolicy, # <string>
|
|
65
|
+
:lifecycle, # <Object>
|
|
66
|
+
:livenessProbe, # <Object>
|
|
67
|
+
:containerName, # <string> -required- (originally called name)
|
|
68
|
+
:ports, # <[]Object>
|
|
69
|
+
:readinessProbe, # <Object>
|
|
70
|
+
:resources, # <Object>
|
|
71
|
+
:securityContext, # <Object>
|
|
72
|
+
:startupProbe, # <Object>
|
|
73
|
+
:stdin, # <boolean>
|
|
74
|
+
:stdinOnce, # <boolean>
|
|
75
|
+
:terminationMessagePath, # <string>
|
|
76
|
+
:terminationMessagePolicy, # <string>
|
|
77
|
+
:tty, # <boolean>
|
|
78
|
+
:volumeDevices, # <[]Object>
|
|
79
|
+
:volumeMounts, # <[]Object>
|
|
80
|
+
:workingDir # <string>
|
|
81
|
+
|
|
82
|
+
# kubectl explain deployment.spec.template.spec.containers.ports
|
|
83
|
+
fields :containerPort, # <integer> -required-
|
|
84
|
+
:hostIP, # <string>
|
|
85
|
+
:hostPort, # <integer>
|
|
86
|
+
:portName, # <string> (originally called name)
|
|
87
|
+
:protocol # <string>
|
|
88
|
+
|
|
89
|
+
def default_apiVersion
|
|
90
|
+
"batch/v1"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def default_spec
|
|
94
|
+
{
|
|
95
|
+
activeDeadlineSeconds: activeDeadlineSeconds,
|
|
96
|
+
backoffLimit: backoffLimit,
|
|
97
|
+
completions: completions,
|
|
98
|
+
manualSelector: manualSelector,
|
|
99
|
+
parallelism: parallelism,
|
|
100
|
+
selector: selector,
|
|
101
|
+
template: template,
|
|
102
|
+
ttlSecondsAfterFinished: ttlSecondsAfterFinished,
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def default_matchLabels
|
|
107
|
+
labels
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def default_template
|
|
111
|
+
{
|
|
112
|
+
metadata: templateMetadata,
|
|
113
|
+
spec: templateSpec,
|
|
114
|
+
}
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def default_templateSpec
|
|
118
|
+
{
|
|
119
|
+
activeDeadlineSeconds: activeDeadlineSeconds,
|
|
120
|
+
affinity: affinity,
|
|
121
|
+
automountServiceAccountToken: automountServiceAccountToken,
|
|
122
|
+
containers: containers,
|
|
123
|
+
dnsConfig: dnsConfig,
|
|
124
|
+
dnsPolicy: dnsPolicy,
|
|
125
|
+
enableServiceLinks: enableServiceLinks,
|
|
126
|
+
ephemeralContainers: ephemeralContainers,
|
|
127
|
+
hostAliases: hostAliases,
|
|
128
|
+
hostIPC: hostIPC,
|
|
129
|
+
hostNetwork: hostNetwork,
|
|
130
|
+
hostPID: hostPID,
|
|
131
|
+
hostname: hostname,
|
|
132
|
+
imagePullSecrets: imagePullSecrets,
|
|
133
|
+
initContainers: initContainers,
|
|
134
|
+
nodeName: nodeName,
|
|
135
|
+
nodeSelector: nodeSelector,
|
|
136
|
+
overhead: overhead,
|
|
137
|
+
preemptionPolicy: preemptionPolicy,
|
|
138
|
+
priority: priority,
|
|
139
|
+
priorityClassName: priorityClassName,
|
|
140
|
+
readinessGates: readinessGates,
|
|
141
|
+
restartPolicy: restartPolicy,
|
|
142
|
+
runtimeClassName: runtimeClassName,
|
|
143
|
+
schedulerName: schedulerName,
|
|
144
|
+
securityContext: securityContext,
|
|
145
|
+
serviceAccount: serviceAccount,
|
|
146
|
+
serviceAccountName: serviceAccountName,
|
|
147
|
+
shareProcessNamespace: shareProcessNamespace,
|
|
148
|
+
subdomain: subdomain,
|
|
149
|
+
terminationGracePeriodSeconds: terminationGracePeriodSeconds,
|
|
150
|
+
tolerations: tolerations,
|
|
151
|
+
topologySpreadConstraints: topologySpreadConstraints,
|
|
152
|
+
volumes: volumes,
|
|
153
|
+
}
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def default_templateMetadata
|
|
157
|
+
{ labels: labels }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def default_containers
|
|
161
|
+
[container, sidecar].compact
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def default_sidecar
|
|
165
|
+
{
|
|
166
|
+
name: sidecar_name,
|
|
167
|
+
image: sidecar_image,
|
|
168
|
+
}
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def default_sidecar_name
|
|
172
|
+
"sidecar" if sidecar_image # othewise will create invalid sidecar field w/o image
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def default_container
|
|
176
|
+
{
|
|
177
|
+
args: args,
|
|
178
|
+
command: command,
|
|
179
|
+
env: env,
|
|
180
|
+
envFrom: envFrom,
|
|
181
|
+
image: image,
|
|
182
|
+
imagePullPolicy: imagePullPolicy,
|
|
183
|
+
lifecycle: lifecycle,
|
|
184
|
+
livenessProbe: livenessProbe,
|
|
185
|
+
name: containerName || name,
|
|
186
|
+
ports: ports,
|
|
187
|
+
readinessProbe: readinessProbe,
|
|
188
|
+
resources: resources,
|
|
189
|
+
securityContext: securityContext,
|
|
190
|
+
startupProbe: startupProbe,
|
|
191
|
+
stdin: stdin,
|
|
192
|
+
stdinOnce: stdinOnce,
|
|
193
|
+
terminationMessagePath: terminationMessagePath,
|
|
194
|
+
terminationMessagePolicy: terminationMessagePolicy,
|
|
195
|
+
tty: tty,
|
|
196
|
+
volumeDevices: volumeDevices,
|
|
197
|
+
volumeMounts: volumeMounts,
|
|
198
|
+
workingDir: workingDir,
|
|
199
|
+
}
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def default_ports
|
|
203
|
+
[
|
|
204
|
+
containerPort: containerPort,
|
|
205
|
+
hostIP: hostIP,
|
|
206
|
+
hostPort: hostPort,
|
|
207
|
+
name: portName,
|
|
208
|
+
protocol: protocol,
|
|
209
|
+
]
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Override command instead of default_command since we want to change a String to an Array
|
|
213
|
+
def command_reader
|
|
214
|
+
@command.is_a?(String) ? @command.split(' ') : @command # else assume Array
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|