Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update prometheus-stack (prometheus 3.0.1, operator 0.79.2) #949

Merged
merged 8 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lint Codespell configurations
[codespell]
skip = .codespellrc,.git,node_modules,build,dist,*.zst,CHANGELOG.md,.playwright,.terraform,*.svg
skip = .codespellrc,.git,node_modules,build,dist,*.zst,CHANGELOG.md,.playwright,.terraform,*.svg,**/pepr/operator/crd/generated/*.ts
ignore-words-list = NotIn,AKS,LICENS,aks,afterAll
enable-colors =
check-hidden =
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tableOfContents:
</tr>
</thead>
<tbody>
<tr><td style="white-space: nowrap;">authorization</td><td style="white-space: nowrap;"><a href="#Authorization">Authorization</a></td><td>Authorization settings.</td></tr><tr><td style="white-space: nowrap;">description</td><td style="white-space: nowrap;">string</td><td>A description of this monitor entry, this will become part of the ServiceMonitor name</td></tr><tr><td style="white-space: nowrap;">kind</td><td style="white-space: nowrap;">string (enum):<ul><li><code>PodMonitor</code></li><li><code>ServiceMonitor</code></li></ul></td><td>The type of monitor to create; PodMonitor or ServiceMonitor. ServiceMonitor is the default.</td></tr><tr><td style="white-space: nowrap;">path</td><td style="white-space: nowrap;">string</td><td>HTTP path from which to scrape for metrics, defaults to `/metrics`</td></tr><tr><td style="white-space: nowrap;">podSelector</td><td style="white-space: nowrap;"></td><td>Labels to match pods in the namespace to apply the policy to. Leave empty to apply to all pods in the namespace</td></tr><tr><td style="white-space: nowrap;">portName</td><td style="white-space: nowrap;">string</td><td>The port name for the serviceMonitor</td></tr><tr><td style="white-space: nowrap;">selector</td><td style="white-space: nowrap;"></td><td>Labels to match pods in the namespace to apply the policy to. Leave empty to apply to all pods in the namespace</td></tr><tr><td style="white-space: nowrap;">targetPort</td><td style="white-space: nowrap;">number</td><td>The service targetPort. This is required so the NetworkPolicy can be generated correctly.</td></tr>
<tr><td style="white-space: nowrap;">authorization</td><td style="white-space: nowrap;"><a href="#Authorization">Authorization</a></td><td>Authorization settings.</td></tr><tr><td style="white-space: nowrap;">description</td><td style="white-space: nowrap;">string</td><td>A description of this monitor entry, this will become part of the ServiceMonitor name</td></tr><tr><td style="white-space: nowrap;">fallbackScrapeProtocol</td><td style="white-space: nowrap;">string (enum):<ul><li><code>OpenMetricsText0.0.1</code></li><li><code>OpenMetricsText1.0.0</code></li><li><code>PrometheusProto</code></li><li><code>PrometheusText0.0.4</code></li><li><code>PrometheusText1.0.0</code></li></ul></td><td>The protocol for Prometheus to use if a scrape returns a blank, unparsable, or otherwise invalid Content-Type</td></tr><tr><td style="white-space: nowrap;">kind</td><td style="white-space: nowrap;">string (enum):<ul><li><code>PodMonitor</code></li><li><code>ServiceMonitor</code></li></ul></td><td>The type of monitor to create; PodMonitor or ServiceMonitor. ServiceMonitor is the default.</td></tr><tr><td style="white-space: nowrap;">path</td><td style="white-space: nowrap;">string</td><td>HTTP path from which to scrape for metrics, defaults to `/metrics`</td></tr><tr><td style="white-space: nowrap;">podSelector</td><td style="white-space: nowrap;"></td><td>Labels to match pods in the namespace to apply the policy to. Leave empty to apply to all pods in the namespace</td></tr><tr><td style="white-space: nowrap;">portName</td><td style="white-space: nowrap;">string</td><td>The port name for the serviceMonitor</td></tr><tr><td style="white-space: nowrap;">selector</td><td style="white-space: nowrap;"></td><td>Labels to match pods in the namespace to apply the policy to. Leave empty to apply to all pods in the namespace</td></tr><tr><td style="white-space: nowrap;">targetPort</td><td style="white-space: nowrap;">number</td><td>The service targetPort. This is required so the NetworkPolicy can be generated correctly.</td></tr>
</tbody>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uds-core",
"version": "0.5.0",
"version": "0.6.0",
"description": "A collection of capabilities for UDS Core",
"keywords": [
"pepr",
Expand Down
19 changes: 0 additions & 19 deletions pepr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { PeprModule } from "pepr";

import cfg from "./package.json";

import { DataStore } from "pepr/dist/lib/storage";
import { istio } from "./src/pepr/istio";
import { Component, setupLogger } from "./src/pepr/logger";
import { operator } from "./src/pepr/operator";
import { setupAuthserviceSecret } from "./src/pepr/operator/controllers/keycloak/authservice/config";
import { Policy } from "./src/pepr/operator/crd";
import { registerCRDs } from "./src/pepr/operator/crd/register";
import { patches } from "./src/pepr/patches";
import { policies, startExemptionWatch } from "./src/pepr/policies";
Expand Down Expand Up @@ -42,23 +40,6 @@ const log = setupLogger(Component.STARTUP);
// Patches for specific components
patches,
]);
// Remove legacy policy entries from the pepr store for the 0.5.0 upgrade
if (
process.env.PEPR_MODE === "dev" ||
(process.env.PEPR_WATCH_MODE === "true" && cfg.version === "0.5.0")
) {
log.debug("Clearing legacy pepr store exemption entries...");
policies.Store.onReady((data: DataStore) => {
const policiesList = Object.values(Policy);
for (const p of Object.keys(data)) {
// if p matches a Policy key, remove it
if (policiesList.includes(p as Policy)) {
log.debug(`Removing legacy storage of ${p} policy exemptions...`);
policies.Store.removeItem(p);
}
}
});
}
})().catch(err => {
log.error(err, "Critical error during startup. Exiting...");
process.exit(1);
Expand Down
4 changes: 4 additions & 0 deletions src/pepr/operator/controllers/monitoring/pod-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { K8s } from "pepr";
import { Component, setupLogger } from "../../../logger";
import { Monitor, PrometheusPodMonitor, UDSPackage } from "../../crd";
import { Kind } from "../../crd/generated/package-v1alpha1";
import { FallbackScrapeProtocol } from "../../crd/generated/prometheus/podmonitor-v1";
import { getOwnerRef, purgeOrphans } from "../utils";
import { generateMonitorName } from "./common";

Expand Down Expand Up @@ -86,6 +87,9 @@ export function generatePodMonitor(
selector: {
matchLabels: podSelector ?? selector,
},
// Fallback to the Prometheus 2.x default if not defined
fallbackScrapeProtocol:
monitor.fallbackScrapeProtocol || FallbackScrapeProtocol.PrometheusText004,
},
};

Expand Down
4 changes: 4 additions & 0 deletions src/pepr/operator/controllers/monitoring/service-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { V1OwnerReference } from "@kubernetes/client-node";
import { Component, setupLogger } from "../../../logger";
import { Monitor, PrometheusServiceMonitor, UDSPackage } from "../../crd";
import { Kind } from "../../crd/generated/package-v1alpha1";
import { FallbackScrapeProtocol } from "../../crd/generated/prometheus/servicemonitor-v1";
import { getOwnerRef, purgeOrphans } from "../utils";
import { generateMonitorName } from "./common";

Expand Down Expand Up @@ -89,6 +90,9 @@ export function generateServiceMonitor(
selector: {
matchLabels: selector,
},
// Fallback to the Prometheus 2.x default if not defined
fallbackScrapeProtocol:
monitor.fallbackScrapeProtocol || FallbackScrapeProtocol.PrometheusText004,
},
};

Expand Down
17 changes: 17 additions & 0 deletions src/pepr/operator/crd/generated/package-v1alpha1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export interface Monitor {
* A description of this monitor entry, this will become part of the ServiceMonitor name
*/
description?: string;
/**
* The protocol for Prometheus to use if a scrape returns a blank, unparsable, or otherwise
* invalid Content-Type
*/
fallbackScrapeProtocol?: FallbackScrapeProtocol;
/**
* The type of monitor to create; PodMonitor or ServiceMonitor. ServiceMonitor is the
* default.
Expand Down Expand Up @@ -99,6 +104,18 @@ export interface Credentials {
optional?: boolean;
}

/**
* The protocol for Prometheus to use if a scrape returns a blank, unparsable, or otherwise
* invalid Content-Type
*/
export enum FallbackScrapeProtocol {
OpenMetricsText001 = "OpenMetricsText0.0.1",
OpenMetricsText100 = "OpenMetricsText1.0.0",
PrometheusProto = "PrometheusProto",
PrometheusText004 = "PrometheusText0.0.4",
PrometheusText100 = "PrometheusText1.0.0",
}

/**
* The type of monitor to create; PodMonitor or ServiceMonitor. ServiceMonitor is the
* default.
Expand Down
Loading
Loading