Class: Kube::Cluster::Standard::DaemonSet
- Inherits:
-
Object
- Object
- Kube::Cluster::Standard::DaemonSet
- Defined in:
- lib/kube/cluster/standard/daemon_set.rb
Instance Method Summary collapse
-
#initialize(name:, image:, env: {}, volume_mounts: {}, command: nil, service_account: nil, node_selector: nil, tolerations: nil, host_pid: false, &block) ⇒ DaemonSet
constructor
A new instance of DaemonSet.
Constructor Details
#initialize(name:, image:, env: {}, volume_mounts: {}, command: nil, service_account: nil, node_selector: nil, tolerations: nil, host_pid: false, &block) ⇒ DaemonSet
Returns a new instance of DaemonSet.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/kube/cluster/standard/daemon_set.rb', line 11 def initialize( name:, image:, env: {}, volume_mounts: {}, command: nil, service_account: nil, node_selector: nil, tolerations: nil, host_pid: false, &block ) processed_env = EnvProcessing.process(env) processed_volumes = VolumeProcessing.process(volume_mounts) super() { .name = name .labels = { 'app' => name } spec.selector.matchLabels = { 'app' => name } spec.template..labels = { 'app' => name } spec.template.spec.serviceAccountName = service_account || name container = { name: name, image: image, env: processed_env } container[:command] = command if command container[:volumeMounts] = processed_volumes[:volume_mounts] unless processed_volumes[:volume_mounts].empty? spec.template.spec.containers = [container] spec.template.spec.volumes = processed_volumes[:volumes] unless processed_volumes[:volumes].empty? spec.template.spec.hostPID = true if host_pid spec.template.spec.nodeSelector = node_selector if node_selector spec.template.spec.tolerations = tolerations if tolerations instance_exec(&block) if block } end |