Class: Kubes::Compiler::Dsl::Syntax::Deployment
- Defined in:
- lib/kubes/compiler/dsl/syntax/deployment.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#command_reader ⇒ Object
Override command instead of default_command since we want to change a String to an Array.
- #default_apiVersion ⇒ Object
- #default_container ⇒ Object
- #default_containers ⇒ Object
- #default_matchLabels ⇒ Object
- #default_ports ⇒ Object
- #default_replicas ⇒ Object
- #default_selector ⇒ Object
- #default_sidecar ⇒ Object
- #default_sidecar_name ⇒ Object
- #default_spec ⇒ Object
- #default_strategy ⇒ Object
- #default_template ⇒ Object
- #default_templateMetadata ⇒ Object
- #default_templateSpec ⇒ Object
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
#command_reader ⇒ Object
Override command instead of default_command since we want to change a String to an Array
239 240 241 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 239 def command_reader @command.is_a?(String) ? @command.split(' ') : @command # else assume Array end |
#default_apiVersion ⇒ Object
92 93 94 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 92 def default_apiVersion "apps/v1" end |
#default_container ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 201 def default_container { args: args, command: command, env: env, envFrom: envFrom, image: image, imagePullPolicy: imagePullPolicy, lifecycle: lifecycle, livenessProbe: livenessProbe, name: containerName || name, ports: ports, readinessProbe: readinessProbe, resources: resources, securityContext: securityContext, startupProbe: startupProbe, stdin: stdin, stdinOnce: stdinOnce, terminationMessagePath: terminationMessagePath, terminationMessagePolicy: terminationMessagePolicy, tty: tty, volumeDevices: volumeDevices, volumeMounts: volumeMounts, workingDir: workingDir, } end |
#default_containers ⇒ Object
186 187 188 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 186 def default_containers [container, sidecar].compact end |
#default_matchLabels ⇒ Object
117 118 119 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 117 def default_matchLabels labels end |
#default_ports ⇒ Object
228 229 230 231 232 233 234 235 236 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 228 def default_ports [ containerPort: containerPort, hostIP: hostIP, hostPort: hostPort, name: portName, protocol: protocol, ] end |
#default_replicas ⇒ Object
109 110 111 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 109 def default_replicas 1 end |
#default_selector ⇒ Object
113 114 115 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 113 def default_selector { matchLabels: matchLabels } end |
#default_sidecar ⇒ Object
190 191 192 193 194 195 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 190 def default_sidecar { name: sidecar_name, image: sidecar_image, } end |
#default_sidecar_name ⇒ Object
197 198 199 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 197 def default_sidecar_name "sidecar" if sidecar_image # othewise will create invalid sidecar field w/o image end |
#default_spec ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 96 def default_spec { minReadySeconds: minReadySeconds, paused: paused, progressDeadlineSeconds: progressDeadlineSeconds, replicas: replicas, revisionHistoryLimit: revisionHistoryLimit, selector: selector, strategy: strategy, template: template, } end |
#default_strategy ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 121 def default_strategy return unless maxUnavailable || maxSurge maxSurge = maxUnavailable if maxUnavailable && !maxSurge maxUnavailable = maxSurge if !maxUnavailable && maxSurge { rollingUpdate: { maxSurge: maxSurge, maxUnavailable: maxUnavailable, }, type: "RollingUpdate", } end |
#default_template ⇒ Object
136 137 138 139 140 141 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 136 def default_template { metadata: templateMetadata, spec: templateSpec, } end |
#default_templateMetadata ⇒ Object
182 183 184 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 182 def default_templateMetadata { labels: labels } end |
#default_templateSpec ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/kubes/compiler/dsl/syntax/deployment.rb', line 143 def default_templateSpec { activeDeadlineSeconds: activeDeadlineSeconds, affinity: affinity, automountServiceAccountToken: automountServiceAccountToken, containers: containers, dnsConfig: dnsConfig, dnsPolicy: dnsPolicy, enableServiceLinks: enableServiceLinks, ephemeralContainers: ephemeralContainers, hostAliases: hostAliases, hostIPC: hostIPC, hostNetwork: hostNetwork, hostPID: hostPID, hostname: hostname, imagePullSecrets: imagePullSecrets, initContainers: initContainers, nodeName: nodeName, nodeSelector: nodeSelector, overhead: overhead, preemptionPolicy: preemptionPolicy, priority: priority, priorityClassName: priorityClassName, readinessGates: readinessGates, restartPolicy: restartPolicy, runtimeClassName: runtimeClassName, schedulerName: schedulerName, securityContext: securityContext, serviceAccount: serviceAccount, serviceAccountName: serviceAccountName, shareProcessNamespace: shareProcessNamespace, subdomain: subdomain, terminationGracePeriodSeconds: terminationGracePeriodSeconds, tolerations: tolerations, topologySpreadConstraints: topologySpreadConstraints, volumes: volumes, } end |