-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julien Bouquillon
committed
Oct 16, 2020
1 parent
b710bc4
commit 0842837
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,45 @@ | ||
import { ServiceMonitor } from "@kubernetes-models/prometheus-operator/monitoring.coreos.com/v1/ServiceMonitor"; | ||
|
||
export type ServiceMonitorParams = { | ||
path?: string; | ||
interval?: string; | ||
port?: string; | ||
namespace: string; | ||
appName: string; | ||
}; | ||
|
||
export const getServiceMonitor = ({ | ||
path = "/metrics", | ||
interval = "1h", | ||
port = "http", | ||
namespace, | ||
appName, | ||
}: ServiceMonitorParams): ServiceMonitor => { | ||
const monitor = new ServiceMonitor({ | ||
metadata: { | ||
labels: { | ||
app: appName, | ||
}, | ||
name: `${appName}-monitor`, | ||
namespace, | ||
}, | ||
spec: { | ||
endpoints: [ | ||
{ | ||
path, | ||
port, | ||
interval, | ||
}, | ||
], | ||
namespaceSelector: { | ||
matchNames: [namespace], | ||
}, | ||
selector: { | ||
matchLabels: { | ||
app: appName, | ||
}, | ||
}, | ||
}, | ||
}); | ||
return monitor; | ||
}; |
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
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