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

add OTEL trace env for helm chart #65

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

KubeKyrie
Copy link
Contributor

@KubeKyrie KubeKyrie commented Nov 27, 2023

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • I have bumped the chart version according to versioning
  • I have updated the documentation according to documentation
  • Any new values are backwards compatible and/or have sensible default.
  • I have signed off all my commits as required by DCO.

Changes are automatically published when merged to main. They are not published on branches.

@clusterpedia-bot
Copy link

Hi @KubeKyrie,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@KubeKyrie
Copy link
Contributor Author

KubeKyrie commented Nov 27, 2023

There is test results:

  1. donnot enable otel trace:

helm install clusterpedia -n test --create-namespace ./charts/clusterpedia/ --set persistenceMatchNode=None --set postgresql.primary.persistence.enabled=false --debug

企业微信截图_6c5006b1-81c9-4e51-bac3-481df6815d3a

  1. enable otel trace:
    helm install clusterpedia -n pedia-system --create-namespace ./charts/clusterpedia/ --set telemetry.tracing.enabled=true --set persistenceMatchNode=None --set postgresql.primary.persistence.enabled=false --debug

image

those otel trace env are added for deploy clusterpedia-apiserver

kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "2"
    meta.helm.sh/release-name: clusterpedia
    meta.helm.sh/release-namespace: pedia-system
  creationTimestamp: "2023-12-05T11:51:28Z"
  generation: 2
  labels:
    app: clusterpedia-apiserver
    app.kubernetes.io/instance: clusterpedia
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: clusterpedia
    app.kubernetes.io/version: v0.7.0
    helm.sh/chart: clusterpedia-2.0.1
  name: clusterpedia-apiserver
  namespace: pedia-system
  resourceVersion: "6317151"
  uid: 6cbdf5d9-4405-43b8-955a-28b465c6e9dc
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clusterpedia-apiserver
      app.kubernetes.io/instance: clusterpedia
      app.kubernetes.io/name: clusterpedia
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: clusterpedia-apiserver
        app.kubernetes.io/instance: clusterpedia
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: clusterpedia
        app.kubernetes.io/version: v0.7.0
        helm.sh/chart: clusterpedia-2.0.1
    spec:
      containers:
      - command:
        - /usr/local/bin/apiserver
        - --secure-port=443
        - --storage-config=/etc/clusterpedia/storage/internalstorage-config.yaml
        - --tracing-config-file=/etc/clusterpedia/trace/tracing-config.yaml
        - -v=3
        env:
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: clusterpedia-internalstorage
        - name: OTEL_EXPORTER_OTLP_ENDPOINT
          value: localhost:4317
        - name: OTEL_SERVICE_NAME
          value: clusterpedia-apiserver
        - name: OTEL_K8S_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: spec.nodeName
        - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: OTEL_RESOURCE_ATTRIBUTES
          value: k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME)
        - name: GODEBUG
          value: netdns=go
        image: ghcr.io/kubekyrie/clusterpedia/apiserver-amd64:latest
        imagePullPolicy: IfNotPresent
        name: clusterpedia-apiserver
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/clusterpedia/storage
          name: internalstorage-config
          readOnly: true
        - mountPath: /etc/clusterpedia/trace
          name: tracing-config
          readOnly: true
      dnsPolicy: ClusterFirst
      initContainers:
      - command:
        - /bin/bash
        - -ec
        - "# Load YAML data into a Bash variable\nsource /opt/scripts/parse-yaml.sh;\ncreate_variables
          /etc/clusterpedia/storage/internalstorage-config.yaml;\nuntil pg_isready
          -U ${user} -d \"dbname=${database}\" -h ${host} -p ${port}; do\necho waiting
          for database check && sleep 1; \ndone;\necho 'DataBase OK ✓'\n"
        image: docker.io/bitnami/postgresql:11.15.0-debian-10-r14
        imagePullPolicy: IfNotPresent
        name: check-storage
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/clusterpedia/storage
          name: internalstorage-config
          readOnly: true
        - mountPath: /opt/scripts
          name: scripts
          readOnly: true
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: clusterpedia-apiserver
      serviceAccountName: clusterpedia-apiserver
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: clusterpedia-internalstorage
        name: internalstorage-config
      - configMap:
          defaultMode: 420
          name: clusterpedia-scripts
        name: scripts
      - configMap:
          defaultMode: 420
          name: clusterpedia-tracing-config
        name: tracing-config
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2023-12-05T11:52:16Z"
    lastUpdateTime: "2023-12-05T11:52:16Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2023-12-05T11:51:28Z"
    lastUpdateTime: "2023-12-05T11:52:16Z"
    message: ReplicaSet "clusterpedia-apiserver-5474589d87" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1


@KubeKyrie
Copy link
Contributor Author

@Iceber @calvin0327 PTAL

charts/clusterpedia/Chart.yaml Outdated Show resolved Hide resolved
charts/clusterpedia/values.yaml Outdated Show resolved Hide resolved
@KubeKyrie
Copy link
Contributor Author

New test results:

  1. enable otel trace:
    helm install clusterpedia -n pedia-system --create-namespace ./charts/clusterpedia/ --set persistenceMatchNode=None --set postgresql.primary.persistence.enabled=false --set apiserver.telemetry.tracing.enabled=true --debug

企业微信截图_06b69133-f51d-41e3-a67c-349ef5726c2e

  1. default, disable otel trace:
    helm install clusterpedia -n pedia-system --create-namespace ./charts/clusterpedia/ --set persistenceMatchNode=None --set postgresql.primary.persistence.enabled=false --debug

image

@KubeKyrie KubeKyrie force-pushed the add-otel-trace branch 3 times, most recently from d7d2be0 to 2eea64e Compare December 26, 2023 04:02
@pull-request-size pull-request-size bot added size/M and removed size/L labels Dec 26, 2023
@KubeKyrie KubeKyrie force-pushed the add-otel-trace branch 6 times, most recently from 006dd46 to 8a1c63c Compare December 26, 2023 08:50
Copy link
Member

@Iceber Iceber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,Thanks for your contribution

@calvin0327
Copy link
Collaborator

LGTM

@Iceber Iceber merged commit 90b2fff into clusterpedia-io:main Dec 27, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants