예제 #1
0
    def env_vars(self):
        """Returns a mutable, dict-like object to manage env vars.

    The returned object can be used like a dictionary, and any modifications to
    the returned object (i.e. setting and deleting keys) modify the underlying
    nested env vars fields.
    """
        return k8s_object.ListAsDictionaryWrapper(self.container.env,
                                                  self._messages.EnvVar)
예제 #2
0
 def resource_limits(self):
     """The resource limits as a dictionary { resource name: limit}."""
     self._EnsureResources()
     return k8s_object.ListAsDictionaryWrapper(
         self.container.resources.limits.additionalProperties,
         self._messages.ResourceRequirements.LimitsValue.AdditionalProperty,
         key_field='key',
         value_field='value',
     )
예제 #3
0
 def revision_labels(self):
     revision_meta = self.spec.revisionTemplate.metadata
     if revision_meta.labels is None:
         revision_meta.labels = self._messages.ObjectMeta.LabelsValue()
     return k8s_object.ListAsDictionaryWrapper(
         revision_meta.labels.additionalProperties,
         self._messages.ObjectMeta.LabelsValue.AdditionalProperty,
         key_field='key',
         value_field='value',
     )
예제 #4
0
    def build_template_arguments(self):
        """Returns a mutable, dict-like object to manage build template args.

    The returned object can be used like a dictionary, and any modifications to
    the returned object (i.e. setting and deleting keys) modify the underlying
    nested build template arguments fields.
    """
        self._AssertSupportsBuild()

        def create():
            self._EnsureBuild()
            return self._m.spec.build.template.arguments

        if self._m.spec.build and self._m.spec.build.template:
            return k8s_object.ListAsDictionaryWrapper(
                self._m.spec.build.template.arguments,
                self._messages.ArgumentSpec)
        else:
            return k8s_object.ListAsDictionaryWrapper(
                k8s_object.LazyListWrapper(create),
                self._messages.ArgumentSpec)