def add_liveness_probe(self, **kwargs): if not isinstance(kwargs, dict): raise SyntaxError( 'K8sContainer: could not add liveness_probe: [ {} ]'.format( kwargs)) probe = Probe(kwargs) self.liveness_probe = probe
def _build_with_model(self, model=None): if 'args' in model: self.args = model['args'] if 'command' in model: self.command = model['command'] if 'env' in model: envs = [] for e in model['env']: env = EnvVar(e) envs.append(env) self.env = envs if 'image' in model: self.image = model['image'] if 'imagePullPolicy' in model: self.image_pull_policy = model['imagePullPolicy'] if 'livenessProbe' in model: self.liveness_probe = Probe(model['livenessProbe']) if 'name' in model: self.name = model['name'] if 'ports' in model: ports = [] for p in model['ports']: port = ContainerPort(p) ports.append(port) self.ports = ports if 'readinessProbe' in model: self.readiness_probe = Probe(model['readinessProbe']) if 'resources' in model: r = ResourceRequirements(model['resources']) self.resources = r if 'securityContext' in model: self.security_context = SecurityContext(model['securityContext']) if 'terminationMessagePath' in model: self.termination_message_path = model['terminationMessagePath'] if 'volumeMounts' in model: mounts = [] for v in model['volumeMounts']: mount = VolumeMount(v) mounts.append(mount) self.volume_mounts = mounts if 'workingDir' in model: self.working_dir = model['workingDir']