Skip to content

Instantly share code, notes, and snippets.

@cdoan1
Last active April 23, 2021 13:59
Show Gist options
  • Save cdoan1/c48f3c10cf0b88d7d473dcfb83d95ffd to your computer and use it in GitHub Desktop.
Save cdoan1/c48f3c10cf0b88d7d473dcfb83d95ffd to your computer and use it in GitHub Desktop.
Deploy Observability
#!/bin/bash
NS=${NS:-open-cluster-management-observability}
# step 1
oc create namespace $NS
# step 2
# NOTE: the warning for export is just a warning, not an error
oc get secret multiclusterhub-operator-pull-secret -n open-cluster-management --export -o yaml | oc apply -n $NS -f -
# step 3
MCO_BUCKET=${MCO_BUCKET:-""}
MCO_S3_ENDPOINT=${MCO_S3_ENDPOINT:-"s3.amazonaws.com"}
MCO_S3_ACCESSKEY=${MCO_S3_ACCESSKEY:-""}
MCO_S3_SECRETKEY=${MCO_S3_SECRETKEY:-""}
if [ ! -f object-storage-data.txt ]; then
cat > object-storage-data.txt <<EOF
type: s3
config:
bucket: ${MCO_BUCKET}
endpoint: ${MCO_S3_ENDPOINT}
insecure: false
access_key: ${MCO_S3_ACCESSKEY}
secret_key: ${MCO_S3_SECRETKEY}
EOF
fi
cat object-storage-data.txt
oc delete secret thanos-object-storage -n $NS
oc create secret generic thanos-object-storage --from-file=thanos.yaml=./object-storage-data.txt -n $NS
oc get secret thanos-object-storage -n $NS -o yaml
# step 4
cat > multiclusterobservability_cr.yaml <<EOF
apiVersion: observability.open-cluster-management.io/v1beta1
kind: MultiClusterObservability
metadata:
name: observability
spec:
availabilityConfig: High
enableDownSampling: false
imagePullPolicy: Always
imagePullSecret: multiclusterhub-operator-pull-secret
observabilityAddonSpec:
enableMetrics: true
interval: 60
retentionResolution1h: 30d
retentionResolution5m: 14d
retentionResolutionRaw: 5d
storageConfigObject:
metricObjectStorage:
name: thanos-object-storage
key: thanos.yaml
statefulSetSize: 10Gi
statefulSetStorageClass: gp2
EOF
# step 5
oc project $NS
oc apply -f multiclusterobservability_cr.yaml
@cdoan1
Copy link
Author

cdoan1 commented Feb 23, 2021

Installing

Deploy Observability on a HUB, using s3 as storage

export MCO_BUCKET="bucketname"
export MCO_S3_ACCESSKEY=$AWS_ACCESS_KEY_ID
export MCO_S3_SECRETKEY=$AWS_SECRET_ACCESS_KEY

./install-observability.sh

@cdoan1
Copy link
Author

cdoan1 commented Apr 23, 2021

Updated CR to include all the configuration options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment