-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change how the thanos configuration is obtained
There seems to be a problem with the stringdata updating of a secret when the lookup isn't initially working. I haven't found a clear cause but switching away from stringdata does not cause this issue. Signed-off-by: Gus Parvin <[email protected]>
- Loading branch information
1 parent
aad1706
commit 906671e
Showing
3 changed files
with
41 additions
and
20 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
...r/policy-sets/stable/openshift-plus/input-acm-observability/policy-ocm-observability.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
policygenerator/policy-sets/stable/openshift-plus/input-acm-observability/thanos-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: ConfigurationPolicy | ||
metadata: | ||
name: thanos-secret | ||
spec: | ||
remediationAction: enforce | ||
severity: high | ||
object-templates-raw: | | ||
{{- /* read the bucket data and noobaa endpoint access data */ -}} | ||
{{- $objBucket := (lookup "objectbucket.io/v1alpha1" "ObjectBucket" "" "obc-openshift-storage-obc-observability") }} | ||
{{- $awsAccess := (lookup "v1" "Secret" "openshift-storage" "noobaa-admin") }} | ||
{{- /* create the thanos config file as a template */ -}} | ||
{{- $thanosConfig := ` | ||
type: s3 | ||
config: | ||
bucket: %[1]s | ||
endpoint: %[2]s | ||
insecure: true | ||
access_key: %[3]s | ||
secret_key: %[4]s` | ||
}} | ||
{{- /* create the secret using the thanos configuration template created above. */ -}} | ||
- complianceType: mustonlyhave | ||
objectDefinition: | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: thanos-object-storage | ||
namespace: open-cluster-management-observability | ||
type: Opaque | ||
data: | ||
thanos.yaml: {{ (printf $thanosConfig $objBucket.spec.endpoint.bucketName | ||
$objBucket.spec.endpoint.bucketHost | ||
($awsAccess.data.AWS_ACCESS_KEY_ID | base64dec) | ||
($awsAccess.data.AWS_SECRET_ACCESS_KEY | base64dec) | ||
) | base64enc }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters