Skip to content

Commit

Permalink
Merge pull request observatorium#37 from open-cluster-management/supp…
Browse files Browse the repository at this point in the history
…ort_proxy

Support configure common environment variables
  • Loading branch information
openshift-merge-robot authored Jun 30, 2021
2 parents 2d1c249 + 6e5eab1 commit 5eab9bc
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/observatorium_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type ObservatoriumSpec struct {
ObjectStorageConfig ObjectStorageConfig `json:"objectStorageConfig"`
// Hashrings describes a list of Hashrings
Hashrings []*Hashring `json:"hashrings"`
// EnvVars define the common environment variables.
// EnvVars apply to thanos compact/receive/rule/store components
// +optional
EnvVars map[string]string `json:"envVars,omitempty"`
// Thanos Spec
// +optional
Thanos ThanosSpec `json:"thanos"`
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions jsonnet/obs-operator.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,27 @@ local operatorObs = obs {
for vct in v.spec.volumeClaimTemplates
]
} else {}
) + (
if (std.objectHas(cr.spec, 'envVars') && (v.kind == 'StatefulSet' && (
std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-compact') ||
std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-receive') ||
std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-rule') ||
std.startsWith(v.metadata.name, cr.metadata.name + '-thanos-store-shard')))) then {
template+: {
spec+: {
containers: [
if std.startsWith(c.name, 'thanos-') then c {
env+:
[
{ name: envName, value: cr.spec.envVars[envName] }
for envName in std.objectFields(cr.spec.envVars)
]
} else c
for c in super.containers
],
},
},
} else {}
) + (
if (std.objectHas(cr.spec, 'affinity') && (v.kind == 'StatefulSet' || v.kind == 'Deployment')) then {
template+: {
Expand Down
5 changes: 5 additions & 0 deletions manifests/crds/core.observatorium.io_observatoria.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ spec:
- rbac
- tenants
type: object
envVars:
additionalProperties:
type: string
description: EnvVars define the common environment variables. EnvVars apply to thanos compact/receive/rule/store components
type: object
hashrings:
description: Hashrings describes a list of Hashrings
items:
Expand Down

0 comments on commit 5eab9bc

Please sign in to comment.