Skip to content

Commit 9c00300

Browse files
authored
Merge pull request #68 from jfrog/PTRENG-6164
PTRENG-6164 - Update Prometheus service discovery due to metrics API changes
2 parents 1339d0e + b1fbe9e commit 9c00300

8 files changed

+1075
-677
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All changes to the log analytics integration will be documented in this file.
44

5+
## [1.0.11] - August 27, 2024
6+
7+
* Update kubernetes services and service moniotors definitions to align with new metrics API changes in Artifactory and Xray
8+
* Update Grafana dashboards to reflect the above changes
9+
* Update Reamde with 2-phased Helm deployments - first to deploy product and generate kubernetes secret; second to deploy additional kubernetes resources with the generated secret
10+
* Remove JFrog platform charts (alignment with the other observability integrations)
11+
512
## [1.0.10] - August 8, 2024
613

714
* Fix metrics configuration due to deprication of `artifactory.openMetrics` as part of Artifactory 7.87.x charts and renaming it to `artifactory.metrics`

README.md

Lines changed: 85 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ The JFrog Log Analytics and Metrics solution using Prometheus consists of three
2323
1. For Installation and usage refer [HELM Guide](https://helm.sh/docs/intro/install/)
2424
4. Versions supported and Tested:
2525

26-
Jfrog Platform: 10.17.3
26+
Artifactory: 7.90.8
2727

28-
Artifactory: 7.77.8
29-
30-
Xray: 3.92.7
28+
Xray: 3.103.6
3129

3230
Prometheus: 2.51.0
3331

@@ -60,7 +58,7 @@ The Grafana Community [grafana](https://github.com/prometheus-community/helm-cha
6058

6159
Once the Pre-Requisites are met, to install Prometheus Kubernetes stack:
6260

63-
#### Create the Namespace required for Prometheus Stack deployment
61+
#### Create the namespace required for the kubernetes deployment
6462

6563
```bash
6664
export INST_NAMESPACE=jfrog-plg
@@ -127,81 +125,126 @@ helm upgrade --install "loki" --values helm/loki-values.yaml grafana/loki --vers
127125

128126
```
129127

130-
## JFrog Platform + Metrics via Helm ⎈
128+
## Artifactory / Artifactory HA + Metrics via Helm ⎈
131129

132-
Ensure Jfrog repo is added to helm.
130+
Before starting Artifactory or Artifactory HA installtion generate join and master keys for the installation:
133131

134132
```bash
135-
helm repo add jfrog https://charts.jfrog.io
136-
helm repo update
133+
export JOIN_KEY=$(openssl rand -hex 32)
134+
export MASTER_KEY=$(openssl rand -hex 32)
137135
```
138136

139-
To configure and install JFrog Platform with Prometheus metrics being exposed use our file `helm/jfrog-platform-values.yaml` to expose a metrics and new service monitor to Prometheus.
137+
Then helm install the Artifactory or Artifactory HA charts:
138+
139+
Artifactory ⎈:
140140

141-
JFrog Platform ⎈:
141+
1. helm install `artifactory` chart (using the above generated join and master keys).
142142

143143
```bash
144-
helm upgrade --install jfrog-platform jfrog/jfrog-platform \
145-
-f helm/jfrog-platform-values.yaml \
144+
helm upgrade --install artifactory jfrog/artifactory \
145+
--set artifactory.masterKey=$MASTER_KEY \
146+
--set artifactory.joinKey=$JOIN_KEY \
146147
-n $INST_NAMESPACE
147148
```
148149

149-
**If you are installing in the same cluster with the deprecated solution, Use the same namespace as the previous one instead of jfrog-plg above.**
150+
**If you are installing in the same cluster with the deprecated solution, use the same namespace as the previous one instead of jfrog-plg above.**
150151

151-
## Artifactory / Artifactory HA + Metrics via Helm ⎈
152+
:bulb: Metrics collection is disabled by default in Artifactory. Please make sure that you are enabling them in Artifactory by setting `artifactory.metrics.enabled` to `true` in your [helm values file](helm/artifactory-values.yaml). For Artifactory versions <=7.86.x, please instead set the flag `artifactory.openMetrics.enabled` to `true
152153

153-
For configuring and installing Artifactory Pro/Pro-x use the `artifactory-values.yaml` file.
154+
2. Follow the instructions how to get your new Artifactory URL from the helm install output
154155

155-
For configuring and installing Enterprise/Ent+ use the `artifactory-ha-values.yaml` file.
156+
```bash
157+
export SERVICE_IP=$(kubectl get svc --namespace $INST_NAMESPACE artifactory-artifactory-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
158+
echo http://$SERVICE_IP/
159+
```
156160

157-
Before starting Artifactory or Artifactory HA installtion generate join and master keys for the installation:
161+
3. Using the Artifactory UI generate JFrog's admin [Access Token](https://jfrog.com/help/r/how-to-generate-an-access-token-video/artifactory-creating-access-tokens-in-artifactory). Using that fetched token, create a kubernetes generic secret for JFrog's admin token - using any of the following methods
158162

159163
```bash
160-
export JOIN_KEY=$(openssl rand -hex 32)
161-
export MASTER_KEY=$(openssl rand -hex 32)
164+
kubectl create secret generic jfrog-admin-token --from-file=token=<path_to_token_file>
162165
```
163166

164-
Then helm install the Artifactory or Artifactory HA charts:
167+
OR
165168

166-
Artifactory ⎈:
169+
```bash
170+
kubectl create secret generic jfrog-admin-token --from-literal=token=<JFROG_ADMN_TOKEN>
171+
172+
```
173+
174+
4. Postgres password is required to upgrade Artifactory. Run the following command to get the current Postgres password
167175

168-
helm install `artifactory` chart (using the above generated join and master keys).
176+
```bash
177+
POSTGRES_PASSWORD=$(kubectl get secret artifactory-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
178+
```
179+
5. Upgrade Artifactory and apply Helm chart to create additional kubernetes resources, which are required for Prometheus service discovery process:
180+
181+
```bash
182+
helm upgrade --install artifactory jfrog/artifactory \
183+
--set artifactory.joinKey=$JOIN_KEY \
184+
--set databaseUpgradeReady=true --set postgresql.postgresqlPassword=$POSTGRES_PASSWORD \
185+
-f helm/artifactory-values.yaml \
186+
-n $INST_NAMESPACE
187+
```
169188

170189
**💡Note: You need to be at the root of this repository folder to have `helm/artifactory-values.yaml` file available for the following command**
171190

191+
This will complete the necessary configuration for Artifactory and expose new service monitors `servicemonitor-artifactory` and `servicemonitor-observability` to expose metrics to Prometheus
192+
193+
Artifactory-HA ⎈:
194+
195+
1. helm install `artifactory-ha` chart (using the above generated join and master keys).
196+
172197
```bash
173-
helm upgrade --install artifactory jfrog/artifactory \
198+
helm upgrade --install artifactory jfrog/artifactory-ha \
174199
--set artifactory.masterKey=$MASTER_KEY \
175200
--set artifactory.joinKey=$JOIN_KEY \
176-
-f helm/artifactory-values.yaml \
177201
-n $INST_NAMESPACE
178202
```
179203

180204
**If you are installing in the same cluster with the deprecated solution, use the same namespace as the previous one instead of jfrog-plg above.**
181205

182-
:bulb: Metrics collection is disabled by default in Artifactory. Please make sure that you are enabling them in Artifactory by setting `artifactory.metrics.enabled` to `true` in your [helm values file](helm/artifactory-values.yaml). For Artifactory versions <=7.86.x, please instead set the flag `artifactory.openMetrics.enabled` to `true`
206+
:bulb: Metrics collection is disabled by default in Artifactory-HA. Please make sure that you are enabling them in Artifactory-HA by setting `artifactory.metrics.enabled` to `true` in your [helm values file](helm/artifactory-ha-values.yaml). For Artifactory versions <=7.86.x, please instead set the flag `artifactory.openMetrics.enabled` to `true
183207

184-
Artifactory-HA ⎈:
208+
2. Follow the instructions how to get your new Artifactory URL from the helm install output
185209

186-
helm install `artifactory-ha` chart (using the above generated join and master keys).
210+
```bash
211+
export SERVICE_IP=$(kubectl get svc --namespace $INST_NAMESPACE artifactory-artifactory-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
212+
echo http://$SERVICE_IP/
213+
```
187214

188-
**💡Note: You need to be at the root of this repository folder to have `helm/artifactory-ha-values.yaml` file available for the following command**
215+
3. Using the Artifactory UI generate JFrog's admin [Access Token](https://jfrog.com/help/r/how-to-generate-an-access-token-video/artifactory-creating-access-tokens-in-artifactory). Using that fetched token, create a kubernetes generic secret for JFrog's admin token - using any of the following methods
189216

190217
```bash
191-
helm upgrade --install artifactory-ha jfrog/artifactory-ha \
192-
--set artifactory.masterKey=$MASTER_KEY \
193-
--set artifactory.joinKey=$JOIN_KEY \
194-
-f helm/artifactory-ha-values.yaml \
195-
-n $INST_NAMESPACE
218+
kubectl create secret generic jfrog-admin-token --from-file=token=<path_to_token_file>
196219
```
197220

198-
**💡Note: If you are installing in the same cluster with the deprecated solution, Use the same namespace as the previous one instead of jfrog-plg above.**
221+
OR
222+
223+
```bash
224+
kubectl create secret generic jfrog-admin-token --from-literal=token=<JFROG_ADMN_TOKEN>
225+
226+
```
199227

200-
:bulb: Metrics collection is disabled by default in Artifactory-HA. Please make sure that you are enabling them in Artifactory by setting `artifactory.metrics.enabled` to `true` in your [helm values file](helm/artifactory-ha-values.yaml). For Artifactory versions <=7.86.x, please instead set the flag `artifactory.openMetrics.enabled` to `true`
228+
4. Postgres password is required to upgrade Artifactory. Run the following command to get the current Postgres password
229+
230+
```bash
231+
POSTGRES_PASSWORD=$(kubectl get secret artifactory-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
232+
```
233+
5. Upgrade Artifactory and helm upgrade the `artifactory-ha` chart to create additional kubernetes resources, which are required for Prometheus service discovery process:
234+
235+
You need to be at the root of this repository folder to have `helm/artifactory-ha-values.yaml` file available for the following command:
236+
237+
```bash
238+
helm upgrade --install artifactory jfrog/artifactory-ha \
239+
--set artifactory.joinKey=$JOIN_KEY \
240+
--set databaseUpgradeReady=true --set postgresql.postgresqlPassword=$POSTGRES_PASSWORD \
241+
-f helm/artifactory-ha-values.yaml \
242+
-n $INST_NAMESPACE
243+
```
201244

202-
Note the above examples are only references you will need additional parameters to configure TLS, binary blob storage, or other common Artifactory features.
245+
**💡Note: The above examples are only references you will need additional parameters to configure TLS, binary blob storage, or other common Artifactory features.**
203246

204-
This will complete the necessary configuration for Artifactory and expose a new service monitor `servicemonitor-artifactory` to expose metrics to Prometheus.
247+
This will complete the necessary configuration for Artifactory-HA and expose new service monitors `servicemonitor-artifactory-ha` and `servicemonitor-observability` to expose metrics to Prometheus
205248

206249
## Xray + Metrics via Helm ⎈
207250

@@ -215,16 +258,16 @@ Generate master keys for the Xray installation:
215258
export XRAY_MASTER_KEY=$(openssl rand -hex 32)
216259
````
217260

218-
Use the same `JOIN_KEY` from the Artifactory installation, in order to connect Xray to Artifactory.
261+
Use the same `JOIN_KEY` from the Artifactory installation, in order to connect Xray to Artifactory. You'll also be using the `jfrog-admin-token` kubernetes secret, that was created early as part of Artifactory/Artifactory-HA installation
219262

220263
**💡Note: You need to be at the root of this repository folder to have `helm/xray-values.yaml` file available for the following command**
221264

222265
```bash
223266
# getting Artifactory URL
224-
export RT_SERVICE_IP=$(kubectl get svc -n $INST_NAMESPACE artifactory-artifactory-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
267+
export JFROG_JPD=$(kubectl get svc -n $INST_NAMESPACE artifactory-artifactory-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
225268

226269
# helm install xray
227-
helm upgrade --install xray jfrog/xray --set xray.jfrogUrl=http://$RT_SERVICE_IP \
270+
helm upgrade --install xray jfrog/xray --set xray.jfrogUrl=http://$JFROG_JPD \
228271
--set xray.masterKey=$XRAY_MASTER_KEY \
229272
--set xray.joinKey=$JOIN_KEY \
230273
-f helm/xray-values.yaml \
@@ -295,4 +338,4 @@ Import the Dashboards and select the appropriate sources (Loki and Prometheus)
295338

296339
* [Grafana Dashboards](https://grafana.com/docs/grafana/latest/features/dashboard/dashboards/)
297340
* [Grafana Queries](https://prometheus.io/docs/prometheus/latest/querying/basics/)
298-
* [Loki Queries](https://grafana.com/docs/loki/latest/logql/)
341+
* [Loki Queries](https://grafana.com/docs/loki/latest/query/)

0 commit comments

Comments
 (0)