-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for custom prometheus registry #4041
Conversation
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 mentioned in the issue here #3204 (comment), We don't actually need a new prometheusRegistry
flag, we would just want to re-use the dockerRegistry
flag.
Something like
installValues.PrometheusImage = fmt.Sprintf("%s/%s", options.dockerRegistry, installValues.PrometheusImage)
but this means that folks actually can't overwrite the prometheusImage
using the CLI. So, we will have to add a prometheusImage
cli flag, and overwrite it when the value is given.
Both options will still have to use the same dockerRegistry
flag as the registry. It dosen't make sense for prometheus to have its own registry
field.
Can you also update the PR name to reflect the changes that are being done?
@Pothulapati Okay I will make the requested changes. :) Also I should be adding a regex check to validate the prometheus image name? |
@Pothulapati Can you please explain the difference b/w options & install values? |
@christyjacob4 the options hold data that have been supplied by the command line arguments. The values is the data used to render the Helm chart. Thinkgs of it this way: the options are used to override some of the default values and customize what you actually get in the end. Does that answer the question? |
@zaharidichev thanks for that. It makes it clearer to me now. Since I've never worked with Helm before, could you please tell me what it's used for? |
@christyjacob4 Helm is like a package manager for kubernetes deployments. Applications like MySQL,etc are packaged as a helm template, which users can directly install on their cluster. We also package Linkerd as a helm chart, which users can directly install on their cluster using helm |
@Pothulapati Thanks so much. Much clearer now. So its sort of like a Dockerfile ? |
Yep, you can think of it like that. Let's please keep the issue comments regarding the issue itself. Feel free to use the Linkerd slack for conversations like this. |
@Pothulapati would this be a right regex to validate a prometheus image string? prometheusImage = regexp.MustCompile(`^[a-zA-Z]+\/[a-zA-Z]+\:v[0-9]+\.[0-9]+\.[0-9]+$`) I have assumed that prometheus-image would have strings like prom/prometheus:v2.15.2 |
@christyjacob4 the progress looks good on this. Please be sure to document the new flag as well. |
@cpretzer where do you want me to add the documentation? |
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.
@cpretzer where do you want me to add the documentation?
You could add it to the docs in the [linkerd/website](https://github.com/linkerd/website)
repository. That being said, I see that we don't document all of the image
flags there, so you may not need to add it there.
cli/cmd/install.go
Outdated
@@ -662,6 +663,7 @@ func (options *installOptions) buildValuesWithoutIdentity(configs *pb.All) (*l5d | |||
installValues.Global.HighAvailability = options.highAvailability | |||
installValues.Global.ImagePullPolicy = options.imagePullPolicy | |||
installValues.GrafanaImage = fmt.Sprintf("%s/grafana", options.dockerRegistry) | |||
installValues.PrometheusImage = fmt.Sprintf("%s/prometheus", options.prometheusRegistry) |
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.
@christyjacob4 I see that this is still a draft PR. Do you plan to add support for a specific tag?
@cpretzer it was suggested by @Pothulapati to open a draft PR so thay its clearer to others what changes I'm making. |
@christyjacob4 So, The problem is that we don't maintain the diff --git a/cli/cmd/install.go b/cli/cmd/install.go
index 2934d6c0..56b61e17 100644
--- a/cli/cmd/install.go
+++ b/cli/cmd/install.go
@@ -653,6 +653,10 @@ func (options *installOptions) buildValuesWithoutIdentity(configs *pb.All) (*l5d
options.identityOptions.replicas = options.controllerReplicas
}
+ if options.prometheusImage != "" {
+ installValues.PrometheusImage = options.prometheusImage
+ }
+
globalJSON, proxyJSON, installJSON, err := config.ToJSON(configs)
if err != nil {
return nil, err
@@ -674,7 +678,6 @@ func (options *installOptions) buildValuesWithoutIdentity(configs *pb.All) (*l5d
installValues.Global.HighAvailability = options.highAvailability
installValues.Global.ImagePullPolicy = options.imagePullPolicy
installValues.GrafanaImage = fmt.Sprintf("%s/grafana", options.dockerRegistry)
- installValues.PrometheusImage = fmt.Sprintf("%s/%s", options.dockerRegistry, installValues.PrometheusImage)
installValues.Global.Namespace = controlPlaneNamespace
installValues.Global.CNIEnabled = options.cniEnabled
installValues.OmitWebhookSideEffects = options.omitWebhookSideEffects Thus allowing users to just give a full image name (including registry name) in the flag. Should we also consider the |
So how would you like me to proceed on this @Pothulapati @cpretzer ? |
@Pothulapati provides a good snippet of code about how to handle this case and it is congruent with the comments from the issue:
Think about it this way: let's say BigBank has an airgapped environment and they use their own docker registry. They will source the prometheus image from some location and add it to their internal registry, so the repository could be something like: They could even rename the image if they wanted to like: In that case, their install command might be like: For this scenario, the snippet that @Pothulapati wrote would work. Additionally, for other users like I don't see added value to having constituent parts for the Hope that helps! |
This looks good but I think we should update the regex now (as we include the registry name, etc stuff in the
|
@Pothulapati I will do that now... :) |
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
This PR adds support to override the default prometheus image name and use custom image names in private repositories Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
The default can be overridden by the argument given in installOptions Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
@Pothulapati Do you want me to add the regex in the root.go file or install.go? |
Signed-off-by: Christy Jacob <christyjacob4@gmail.com>
@cpretzer @Pothulapati Are we good to go on this? |
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.
LGTM
Ran automated tests
Confirmed that the prometheus image is set when using --prometheus-image
flag.
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.
LGTM!
This PR contains the proposed changes for allowing custom registries for the prometheus image.
Draft for #3204