Skip to content

Commit 739273a

Browse files
authored
Configure Env variables for Functions (#780)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent c49b24f commit 739273a

26 files changed

+1088
-453
lines changed

api/crds/v1beta1/backupconfiguration.yaml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,180 @@ spec:
393393
properties:
394394
container:
395395
properties:
396+
env:
397+
description: List of environment variables to set in the container.
398+
Cannot be updated.
399+
items:
400+
description: EnvVar represents an environment variable present
401+
in a Container.
402+
properties:
403+
name:
404+
description: Name of the environment variable. Must be
405+
a C_IDENTIFIER.
406+
type: string
407+
value:
408+
description: 'Variable references $(VAR_NAME) are expanded
409+
using the previous defined environment variables in
410+
the container and any service environment variables.
411+
If a variable cannot be resolved, the reference in the
412+
input string will be unchanged. The $(VAR_NAME) syntax
413+
can be escaped with a double $$, ie: $$(VAR_NAME). Escaped
414+
references will never be expanded, regardless of whether
415+
the variable exists or not. Defaults to "".'
416+
type: string
417+
valueFrom:
418+
description: EnvVarSource represents a source for the
419+
value of an EnvVar.
420+
properties:
421+
configMapKeyRef:
422+
description: Selects a key from a ConfigMap.
423+
properties:
424+
key:
425+
description: The key to select.
426+
type: string
427+
name:
428+
description: 'Name of the referent. More info:
429+
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
430+
type: string
431+
optional:
432+
description: Specify whether the ConfigMap or
433+
it's key must be defined
434+
type: boolean
435+
required:
436+
- key
437+
type: object
438+
fieldRef:
439+
description: ObjectFieldSelector selects an APIVersioned
440+
field of an object.
441+
properties:
442+
apiVersion:
443+
description: Version of the schema the FieldPath
444+
is written in terms of, defaults to "v1".
445+
type: string
446+
fieldPath:
447+
description: Path of the field to select in the
448+
specified API version.
449+
type: string
450+
required:
451+
- fieldPath
452+
type: object
453+
resourceFieldRef:
454+
description: ResourceFieldSelector represents container
455+
resources (cpu, memory) and their output format
456+
properties:
457+
containerName:
458+
description: 'Container name: required for volumes,
459+
optional for env vars'
460+
type: string
461+
divisor:
462+
description: |-
463+
Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and Int64() accessors.
464+
465+
The serialization format is:
466+
467+
<quantity> ::= <signedNumber><suffix>
468+
(Note that <suffix> may be empty, from the "" case in <decimalSI>.)
469+
<digit> ::= 0 | 1 | ... | 9 <digits> ::= <digit> | <digit><digits> <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits> <sign> ::= "+" | "-" <signedNumber> ::= <number> | <sign><number> <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI> <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
470+
(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
471+
<decimalSI> ::= m | "" | k | M | G | T | P | E
472+
(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
473+
<decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
474+
475+
No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
476+
477+
When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.
478+
479+
Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:
480+
a. No precision is lost
481+
b. No fractional digits will be emitted
482+
c. The exponent (or suffix) is as large as possible.
483+
The sign will be omitted unless the number is negative.
484+
485+
Examples:
486+
1.5 will be serialized as "1500m"
487+
1.5Gi will be serialized as "1536Mi"
488+
489+
Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.
490+
491+
Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)
492+
493+
This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.
494+
type: string
495+
resource:
496+
description: 'Required: resource to select'
497+
type: string
498+
required:
499+
- resource
500+
type: object
501+
secretKeyRef:
502+
description: SecretKeySelector selects a key of a
503+
Secret.
504+
properties:
505+
key:
506+
description: The key of the secret to select from. Must
507+
be a valid secret key.
508+
type: string
509+
name:
510+
description: 'Name of the referent. More info:
511+
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
512+
type: string
513+
optional:
514+
description: Specify whether the Secret or it's
515+
key must be defined
516+
type: boolean
517+
required:
518+
- key
519+
type: object
520+
type: object
521+
required:
522+
- name
523+
type: object
524+
type: array
525+
envFrom:
526+
description: List of sources to populate environment variables
527+
in the container. The keys defined within a source must be
528+
a C_IDENTIFIER. All invalid keys will be reported as an event
529+
when the container is starting. When a key exists in multiple
530+
sources, the value associated with the last source will take
531+
precedence. Values defined by an Env with a duplicate key
532+
will take precedence. Cannot be updated.
533+
items:
534+
description: EnvFromSource represents the source of a set
535+
of ConfigMaps
536+
properties:
537+
configMapRef:
538+
description: |-
539+
ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.
540+
541+
The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.
542+
properties:
543+
name:
544+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
545+
type: string
546+
optional:
547+
description: Specify whether the ConfigMap must be
548+
defined
549+
type: boolean
550+
type: object
551+
prefix:
552+
description: An optional identifier to prepend to each
553+
key in the ConfigMap. Must be a C_IDENTIFIER.
554+
type: string
555+
secretRef:
556+
description: |-
557+
SecretEnvSource selects a Secret to populate the environment variables with.
558+
559+
The contents of the target Secret's Data field will represent the key-value pairs as environment variables.
560+
properties:
561+
name:
562+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
563+
type: string
564+
optional:
565+
description: Specify whether the Secret must be defined
566+
type: boolean
567+
type: object
568+
type: object
569+
type: array
396570
ionice:
397571
description: https://linux.die.net/man/1/ionice
398572
properties:

0 commit comments

Comments
 (0)