Apply grafana dashboard sidecare
This commit is contained in:
parent
8c30544be7
commit
37fccf13be
|
|
@ -12,6 +12,19 @@ You should regenerate `all-crds.yaml` by running `scripts/update-crds.sh` when:
|
||||||
|
|
||||||
1. **Upgrading the `kube-prometheus-stack` Helm chart**: If you bump the chart version in `k8s/monitoring/Chart.yaml` and update the dependencies, you must also update the CRDs to match the new version.
|
1. **Upgrading the `kube-prometheus-stack` Helm chart**: If you bump the chart version in `k8s/monitoring/Chart.yaml` and update the dependencies, you must also update the CRDs to match the new version.
|
||||||
2. **Missing CRD fields**: If you encounter errors like `field not declared in schema` during ArgoCD syncs, it likely means the installed CRDs are outdated.
|
2. **Missing CRD fields**: If you encounter errors like `field not declared in schema` during ArgoCD syncs, it likely means the installed CRDs are outdated.
|
||||||
|
3. **Apply the CRDs**:
|
||||||
|
Since Helm does not manage CRD upgrades, you must apply the updated CRDs manually. You may need `--force-conflicts` if ArgoCD previously managed these resources:
|
||||||
|
```bash
|
||||||
|
kubectl apply --server-side --force-conflicts -f k8s/all-crds.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Commit and Push**:
|
||||||
|
Commit the updated `k8s/all-crds.yaml` to the repository.
|
||||||
|
```bash
|
||||||
|
git add k8s/all-crds.yaml
|
||||||
|
git commit -m "Update Prometheus CRDs"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
### How to update
|
### How to update
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ kube-prometheus-stack:
|
||||||
root_url: "%(protocol)s://%(domain)s/grafana/"
|
root_url: "%(protocol)s://%(domain)s/grafana/"
|
||||||
enable_gzip: "true"
|
enable_gzip: "true"
|
||||||
serve_from_sub_path: true
|
serve_from_sub_path: true
|
||||||
|
sidecar:
|
||||||
|
dashboards:
|
||||||
|
enabled: true
|
||||||
|
label: grafana_dashboard
|
||||||
|
searchNamespace: ALL
|
||||||
additionalDataSources:
|
additionalDataSources:
|
||||||
- name: Loki
|
- name: Loki
|
||||||
type: loki
|
type: loki
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ kube-prometheus-stack:
|
||||||
root_url: "%(protocol)s://%(domain)s/grafana/"
|
root_url: "%(protocol)s://%(domain)s/grafana/"
|
||||||
enable_gzip: "true"
|
enable_gzip: "true"
|
||||||
serve_from_sub_path: true
|
serve_from_sub_path: true
|
||||||
|
sidecar:
|
||||||
|
dashboards:
|
||||||
|
enabled: true
|
||||||
|
label: grafana_dashboard
|
||||||
|
searchNamespace: ALL
|
||||||
additionalDataSources:
|
additionalDataSources:
|
||||||
- name: Loki
|
- name: Loki
|
||||||
type: loki
|
type: loki
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,23 @@ if [ -z "$ENVIRONMENT" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Define cleanup function to revert changes to applications.yaml
|
||||||
|
cleanup() {
|
||||||
|
if [ -f k8s/argocd/base/applications.yaml.bak ]; then
|
||||||
|
echo "Reverting k8s/argocd/base/applications.yaml..."
|
||||||
|
mv k8s/argocd/base/applications.yaml.bak k8s/argocd/base/applications.yaml
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
if [ "$ENVIRONMENT" == "staging" ]; then
|
if [ "$ENVIRONMENT" == "staging" ]; then
|
||||||
echo "Deploying to STAGING..."
|
echo "Deploying to STAGING..."
|
||||||
|
|
||||||
# Source activation script
|
# Source activation script
|
||||||
if [ -f ~/bin/activate_stg ]; then
|
if [ -f ~/bin/activate-stg ]; then
|
||||||
source ~/bin/activate_stg
|
source ~/bin/activate-stg
|
||||||
else
|
else
|
||||||
echo "Error: ~/bin/activate_stg not found."
|
echo "Error: ~/bin/activate-stg not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -26,10 +35,15 @@ if [ "$ENVIRONMENT" == "staging" ]; then
|
||||||
fi
|
fi
|
||||||
echo "Using branch: $BITBUCKET_BRANCH"
|
echo "Using branch: $BITBUCKET_BRANCH"
|
||||||
|
|
||||||
|
# Template argocd/base/applications.yaml
|
||||||
# Template argocd/base/applications.yaml
|
# Template argocd/base/applications.yaml
|
||||||
echo "Templating k8s/argocd/base/applications.yaml..."
|
echo "Templating k8s/argocd/base/applications.yaml..."
|
||||||
envsubst < k8s/argocd/base/applications.yaml > k8s/argocd/base/applications.yaml.tmp
|
|
||||||
mv k8s/argocd/base/applications.yaml.tmp k8s/argocd/base/applications.yaml
|
# Backup original file
|
||||||
|
cp k8s/argocd/base/applications.yaml k8s/argocd/base/applications.yaml.bak
|
||||||
|
|
||||||
|
# Perform substitution
|
||||||
|
envsubst < k8s/argocd/base/applications.yaml.bak > k8s/argocd/base/applications.yaml
|
||||||
|
|
||||||
# Apply Kustomize
|
# Apply Kustomize
|
||||||
echo "Applying Kustomize for staging..."
|
echo "Applying Kustomize for staging..."
|
||||||
|
|
@ -46,10 +60,10 @@ elif [ "$ENVIRONMENT" == "production" ]; then
|
||||||
echo "Deploying to PRODUCTION..."
|
echo "Deploying to PRODUCTION..."
|
||||||
|
|
||||||
# Source activation script
|
# Source activation script
|
||||||
if [ -f ~/bin/activate_prd ]; then
|
if [ -f ~/bin/activate-prd ]; then
|
||||||
source ~/bin/activate_prd
|
source ~/bin/activate-prd
|
||||||
else
|
else
|
||||||
echo "Error: ~/bin/activate_prd not found."
|
echo "Error: ~/bin/activate-prd not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue