-
Notifications
You must be signed in to change notification settings - Fork 344
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
Setting istio annotation on invalid resource #1330
Comments
Nice catch. Would you like to contribute a fix? |
I am not particularly confident with Golang but having looked through the codebase it looks quite straightforward to change if you'd rather take a PR for this. I expect the hardest part of this change is the most appropriate place to add this logic without being disgusting or complicated. For example, if I just remove the Like this: podAnnotations := make(map[string]string)
for k, v := range commonSpec.Annotations {
podAnnotations[k] = v
}
podAnnotations["sidecar.istio.io/inject"] = "false" |
Yes, something like that would certainly work. Send in a PR and we can check together if it needs to be done before or after the merge of the base common spec with the common spec. |
Hitting this as well, i was wondering if there would be situations where we might want the sidecar to be enabled ? |
Is this causing an actual problem? I thought this was mostly a linting issue? |
linting only ... just cleaning up my |
Thanks for the clarification! Would you be able to send us a PR? |
Apologies for never submitting the PR last year. tl;dr I was struggling to get the development environment installed locally and didn't want to submit a PR without running tests on it first. Here is the diff if you want to take this over. I don't expect I will have the time to try and get this working again for a few weeks. diff --git a/pkg/deployment/collector.go b/pkg/deployment/collector.go
index 672f07e8..fec1410d 100644
--- a/pkg/deployment/collector.go
+++ b/pkg/deployment/collector.go
@@ -46,16 +46,23 @@ func (c *Collector) Get() *appsv1.Deployment {
baseCommonSpec := v1.JaegerCommonSpec{
Annotations: map[string]string{
- "prometheus.io/scrape": "true",
- "prometheus.io/port": strconv.Itoa(int(adminPort)),
- "sidecar.istio.io/inject": "false",
- "linkerd.io/inject": "disabled",
+ "prometheus.io/scrape": "true",
+ "prometheus.io/port": strconv.Itoa(int(adminPort)),
+ "linkerd.io/inject": "disabled",
},
Labels: labels,
}
commonSpec := util.Merge([]v1.JaegerCommonSpec{c.jaeger.Spec.Collector.JaegerCommonSpec, c.jaeger.Spec.JaegerCommonSpec, baseCommonSpec})
+ podAnnotations := make(map[string]string)
+
+ for k, v := range commonSpec.Annotations {
+ podAnnotations[k] = v
+ }
+
+ podAnnotations["sidecar.istio.io/inject"] = "false"
+
var envFromSource []corev1.EnvFromSource
if len(c.jaeger.Spec.Storage.SecretName) > 0 {
envFromSource = append(envFromSource, corev1.EnvFromSource{
@@ -119,7 +126,7 @@ func (c *Collector) Get() *appsv1.Deployment {
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: commonSpec.Labels,
- Annotations: commonSpec.Annotations,
+ Annotations: podAnnotations,
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
diff --git a/pkg/deployment/query.go b/pkg/deployment/query.go
index fdb9ce51..0da6491b 100644
--- a/pkg/deployment/query.go
+++ b/pkg/deployment/query.go
@@ -41,10 +41,9 @@ func (q *Query) Get() *appsv1.Deployment {
baseCommonSpec := v1.JaegerCommonSpec{
Annotations: map[string]string{
- "prometheus.io/scrape": "true",
- "prometheus.io/port": strconv.Itoa(int(adminPort)),
- "sidecar.istio.io/inject": "false",
- "linkerd.io/inject": "disabled",
+ "prometheus.io/scrape": "true",
+ "prometheus.io/port": strconv.Itoa(int(adminPort)),
+ "linkerd.io/inject": "disabled",
},
Labels: labels,
}
@@ -63,6 +62,14 @@ func (q *Query) Get() *appsv1.Deployment {
commonSpec := util.Merge([]v1.JaegerCommonSpec{q.jaeger.Spec.Query.JaegerCommonSpec, q.jaeger.Spec.JaegerCommonSpec, baseCommonSpec})
+ podAnnotations := make(map[string]string)
+
+ for k, v := range commonSpec.Annotations {
+ podAnnotations[k] = v
+ }
+
+ podAnnotations["sidecar.istio.io/inject"] = "false"
+
options := allArgs(q.jaeger.Spec.Query.Options,
q.jaeger.Spec.Storage.Options.Filter(q.jaeger.Spec.Storage.Type.OptionsPrefix()))
@@ -110,7 +117,7 @@ func (q *Query) Get() *appsv1.Deployment {
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: commonSpec.Labels,
- Annotations: commonSpec.Annotations,
+ Annotations: podAnnotations,
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{{ |
I can have a look at it and send a pr Thanks ! |
This seems to still be an issue. What is the status of this PR @primeroz |
I am moved onto other things in the meantime so not really looking at doing 5his anytime soon |
According to the istio annotation docs, the
sidecar.istio.io/inject
annotation should only be applied to pods - see: https://istio.io/latest/docs/reference/config/annotations/.Reference error: https://preliminary.istio.io/latest/docs/reference/config/analysis/IST0107/
sidecar.istio.io/inject: false
appears on thedeployment
resources of bothjaeger-collector
andjaeger-query
:/metadata/annotations/"sidecar.istio.io/inject": "false"
(unexpected)/spec/template/metadata/annotations/"sidecar.istio.io/inject": "false"
(expected)The text was updated successfully, but these errors were encountered: