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

Calico Typha custom label and annotations are not working #7838

Closed
mehmetyazicioglu opened this issue Jul 5, 2023 · 3 comments
Closed

Calico Typha custom label and annotations are not working #7838

mehmetyazicioglu opened this issue Jul 5, 2023 · 3 comments

Comments

@mehmetyazicioglu
Copy link

mehmetyazicioglu commented Jul 5, 2023

I would like to label typha pods to collect their logs to Kibana, but I tried many different values from the chart installation which did not work out.

Expected Behavior

being able to label and annotate Typha pods without manually patching them.

Current Behavior

Possible Solution

I checked official documentation but it is still not working

https://docs.tigera.io/calico/3.24/reference/installation/api#operator.tigera.io/v1.ComponentResource

It would be nice to have a sample for this on github or documentation.

@caseydavenport I believe there was replacement for "componentResources" field to be used "Deprecated. Please use CalicoNodeDaemonSet, TyphaDeployment, and KubeControllersDeployment."

I get the error PodTemplate is not a valid variable. I used "TyphaDeploymentPodTemplateSpec" or "TyphaDeploymentPodSpec" which I got the same invalid variable name. what am I missing here?

Context

apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
 name: default



typhaDeployment:
   spec:
    PodTemplate:
      spec:
        metadata:
           labels:
            logs.westwing.eu/loggable: "true"
spec:
 typhaDeployment:
   spec:
     PodTemplate:
       spec:
         metadata:
            labels:
               logs.company.eu/loggable: "true"
           annotations:
               channel: "typha"

 nodeUpdateStrategy:
   type: RollingUpdate
   rollingUpdate:
     maxUnavailable: 3
 typhaAffinity:
   nodeAffinity:
     preferredDuringSchedulingIgnoredDuringExecution:
       - weight: 1
         preference:
           matchExpressions:
             - key: application
               operator: In
               values:
                 - main
             - key: node_type
               operator: In
               values:
                 - default
 variant: Calico
 cni:
   type: Calico
   ipam:
     type: Calico
 calicoNetwork:
   # https://docs.projectcalico.org/networking/bgp
   bgp: Enabled
   mtu: 8000
   containerIPForwarding: Disabled
   ipPools:
   - blockSize: 26
     cidr: 10.244.0.0/16
     encapsulation: IPIP
     # https://docs.projectcalico.org/networking/workloads-outside-cluster
     natOutgoing: Enabled
     nodeSelector: all()
 nodeMetricsPort: 9532`

Your Environment

  • Calico version --> 3.24.6
  • Orchestrator version (e.g. kubernetes, mesos, rkt): kubernetes (kubeadm)
  • Operating System and version: Amazon Linux
@coutinhop
Copy link
Contributor

Hi @mehmetyazicioglu, could you please fix the formatting of the yaml? The indentation is off as of how it is, please use triple backticks ``` so it shows up correctly.

From what we could make of it, it looks like you mixed up the type and name of the fields in our documentation. Instead of "PodTemplate" or "TyphaDeploymentPodTemplateSpec", which are types, try using just "template, which is the field name.

@mehmetyazicioglu
Copy link
Author

@coutinhop thanks for the reply but i am still having the same similar problem.

error validating data: ValidationError(Installation.spec): unknown field "Pod" in io.tigera.operator.v1.Installation.spec; if you choose to ignore these errors, turn validation off with --validate=false
spec:
 Pod:
   Template:
     spec:
       metadata:
         labels:
           logs.company.eu/loggable: "true"

I tried this way but still the same error

error validating data: ValidationError(Installation.spec): unknown field "template" in io.tigera.operator.v1.Installation.spec; if you choose to ignore these errors, turn validation off with --validate=false

and my configuration part is

spec:
 template:
    spec:
      metadata:
        labels:
          logs.westwing.eu/loggable: "true"

I tried this

spec:
 typhaDeployment:
   pod:
    template:
      spec:
        metadata:
          labels:
            logs.westwing.eu/loggable: "true"

error validating data: ValidationError(Installation.spec.typhaDeployment): unknown field "pod" in io.tigera.operator.v1.Installation.spec.typhaDeployment

I also checked this issue tigera/operator#1990

here is MR for the custom template https://github.com/tigera/operator/pull/2063/files

@mehmetyazicioglu
Copy link
Author

@coutinhop thank you very much the tip, I have figured out the labelling, the ticket can be closed.

  typhaDeployment:
    spec:
      template:
        metadata:
          labels:
            foo: "bar"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants