-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add Pingdom Transaction Checks #570
Add Pingdom Transaction Checks #570
Conversation
@karlderkaefer Image is available for testing. |
return monitors | ||
} | ||
|
||
func (service *PingdomTransactionMonitorService) GetUrlFromSteps(id int64) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this required. This was a attempt before I realized that the controller is not supporting more than one provider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as i have seen, it supports atleast two monitors, with working on both simultaneously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes stakater will send out request to every provider that is defined. This is not required in my opinion, since I don't the alert to be duplication on different providers, but instead I want to use different providers for different alerts.
|
||
// `-` separated set list of integrations ids (e.g. "91166-12168") | ||
// +optional | ||
AlertIntegrations string `json:"alertIntegrations,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally would prefer a string array here because it's more natural for yaml and users. On the other hand, pingdom user might be used to existing format, What is your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i myself prefer arrays as well for such conditions, pushed a change recently with array for grafana cloud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this requires a refactoring. The problem is the alertIntegration, alertContacts and TeamAlerts are defined in Provider struct
IngressMonitorController/pkg/config/config.go
Lines 65 to 67 in 88a3c47
AlertContacts string `yaml:"alertContacts"` | |
AlertIntegrations string `yaml:"alertIntegrations"` | |
TeamAlertContacts string `yaml:"teamAlertContacts"` |
This is used by all provider implementation. Probably string was used to allow more flexible setup and let the parsing upto the specific provider implementation.
I think its fine if we keep string here, also to align to existing pingdom configuration. I would like to do changes here
@karl-johan-grahn can you have look? I wanted to minimize changes but in the end still a lot. If splitting of the PR helps let me know |
Hi @MuneebAijaz is there an update on the review status? |
@karlderkaefer apologies for the delay, this is scheduled for next week |
|
||
// `-` separated set list of integrations ids (e.g. "91166-12168") | ||
// +optional | ||
AlertIntegrations string `json:"alertIntegrations,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i myself prefer arrays as well for such conditions, pushed a change recently with array for grafana cloud
return monitors | ||
} | ||
|
||
func (service *PingdomTransactionMonitorService) GetUrlFromSteps(id int64) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as i have seen, it supports atleast two monitors, with working on both simultaneously
func (service *PingdomTransactionMonitorService) createTransactionCheck(monitor models.Monitor) *pingdomNew.CheckWithoutID { | ||
transactionCheck := &pingdomNew.CheckWithoutID{} | ||
providerConfig, _ := monitor.Config.(*endpointmonitorv1alpha1.PingdomTransactionConfig) | ||
if providerConfig == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldnt this be checked at setup level and not so down the code flow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the providerConfig is set on alert configuration. We can not move to setup because it needs to be checked for every alert. One alternative instead of checking for existence of *endpointmonitorv1alpha1.PingdomTransactionConfig
we can use the providers from the spec
Providers string `json:"providers"` |
} | ||
|
||
// getSecretValue retrieves a secret value from Kubernetes. | ||
func getSecretValue(kubeClient KubernetesInterface, namespace, secretName, secretKey string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to define separate interfaces to do get calls here? simple get call on secret types with kubeclient can also give us secret object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface is required in order to mock the kubernetes client for test. see test TestReplaceSecrets
https://github.com/karlderkaefer/IngressMonitorController/blob/c06ff6e38c6e2b875d9b91ebac20e33ac2d3bdf8/pkg/monitors/pingdomtransaction/pingdom-transaction-monitor_test.go#L112
@MuneebAijaz I have answered all comments, can we get an update on the review? |
@MuneebAijaz I appreciate the approval very much. Although we have tested these changes intensively, If there any bug related I'm happy to fix. you can mention me or @dennis-ge |
Summary
This pull request addresses issue #553 #569 . The main changes are:
PingdomTransaction
Detailed Feature List
Multi Provider Support:
It was not possible to add more than one provider. For example if you have provider config
If you add monitor regardless of the provider spec, the create and update events were fired to all available providers. This lead API errors and unwanted creation of monitors
We will now find the right service monitor proxy depending on the spec and sent create, update and delete events only to suitable providers. In case the provider could not be detected we use the first configured provider, which is default for endpoint monitors without specific provider spec.
Further more I added a enum for different providers
The existing spec does not assign a check to a service provider directly on the CRDs. We have check with either a provider config or without. This will lead to more code. It would be probably better to introduce a required field
spec.monitorType
to map each check explicitly to a provider. However that would introduce a breaking change (wanted to avoid that)New Provider for Pingdom Transaction
I created a new provider and package for Pingdom transaction provider since the fields are significantly different than Uptime checks. Also we need another client to do the API calls. So it's probably best if separate by packages
Using Pointer for Monitor Proxy
The service monitor proxies are initialised on startup. It would make more sense for me if we use pointer here to avoid allocation of new objects. What do you think?
Refactor Logging Output
Secret Template to retrieve sensitive Data
We have the requirement to set sensitive data such as password for some fields.
We would like to avoid to store them in endpoint monitor CRD. Instead we just define a secret reference e.g.
value: '{{secret:my-secret-name:my-secret-key}}'
.The secret will be retrieved and is replacing the template before the post request is sent to Pingdom.
Minor fixes
Motivation
#569
Testing
pingdom-transaction-monitor_test.go
to ensure a basic create and delete worksAdditional Notes
Include any additional notes or comments you have about the changes made.
closes #569