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

feat: add script to generate watches.yaml #117

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Conversation

kasia-kujawa
Copy link
Contributor

@kasia-kujawa kasia-kujawa commented Jun 19, 2024

  • Add script to generate watches.yaml based on values.yaml for the Sumo Logic Kubernetes Collection Helm Chart
    Environment variables related to new image keys need to be manually filled out.
  • Sort existing watches.yaml using yaml.safe_load and yaml.safe_dump
  • Small fixes and improvement in scripts/get_image_config_keys.py

Example watches.yaml generated by the script with missing environment variables:

- chart: helm-charts/sumologic
  group: helm-operator.sumologic.com
  kind: SumologicCollection
  overrideValues:
    debug.sumologicMock.image.repository: ''
    debug.sumologicMock.image.tag: ''
    fluent-bit.image.repository: '{{ ("$RELATED_IMAGE_FLUENT_BIT" | split ":")._0
      }}'
    fluent-bit.image.tag: '{{ ("$RELATED_IMAGE_FLUENT_BIT" | split ":")._1 }}'
    fluentd.image.repository: '{{ ("$RELATED_IMAGE_KUBERNETES_FLUENTD" | split ":")._0
      }}'
    fluentd.image.tag: '{{ ("$RELATED_IMAGE_KUBERNETES_FLUENTD" | split ":")._1 }}'
    instrumentation.instrumentationJobImage.image.repository: ''
    instrumentation.instrumentationJobImage.image.tag: ''
    kube-prometheus-stack.kube-state-metrics.image.repository: '{{ ("$RELATED_IMAGE_KUBE_STATE_METRICS"
      | split ":")._0 }}'
    kube-prometheus-stack.kube-state-metrics.image.tag: '{{ ("$RELATED_IMAGE_KUBE_STATE_METRICS"
      | split ":")._1 }}'
    kube-prometheus-stack.prometheus-node-exporter.image.repository: '{{ ("$RELATED_IMAGE_NODE_EXPORTER"
      | split ":")._0 }}'
    kube-prometheus-stack.prometheus-node-exporter.image.tag: '{{ ("$RELATED_IMAGE_NODE_EXPORTER"
      | split ":")._1 }}'
    kube-prometheus-stack.prometheus.prometheusSpec.image.repository: '{{ ("$RELATED_IMAGE_PROMETHEUS"
      | split "@")._0 }}'
    kube-prometheus-stack.prometheus.prometheusSpec.image.sha: '{{ ("$RELATED_IMAGE_PROMETHEUS"
      | split ":")._1 }}'
    kube-prometheus-stack.prometheus.prometheusSpec.image.tag: v2.22.1
    kube-prometheus-stack.prometheus.prometheusSpec.thanos.image: $RELATED_IMAGE_THANOS
    kube-prometheus-stack.prometheusOperator.image.repository: '{{ ("$RELATED_IMAGE_PROMETHEUS_OPERATOR"
      | split "@")._0 }}'
    kube-prometheus-stack.prometheusOperator.image.sha: '{{ ("$RELATED_IMAGE_PROMETHEUS_OPERATOR"
      | split ":")._1 }}'
    kube-prometheus-stack.prometheusOperator.image.tag: v0.44.0
    kube-prometheus-stack.prometheusOperator.prometheusConfigReloader.image.repository: ''
    kube-prometheus-stack.prometheusOperator.prometheusConfigReloaderImage.repository: '{{
      ("$RELATED_IMAGE_PROMETHEUS_CONFIG_RELOADER" | split "@")._0 }}'
    kube-prometheus-stack.prometheusOperator.prometheusConfigReloaderImage.sha: '{{
      ("$RELATED_IMAGE_PROMETHEUS_CONFIG_RELOADER" | split ":")._1 }}'
    kube-prometheus-stack.prometheusOperator.prometheusConfigReloaderImage.tag: v0.44.0
    kube-prometheus-stack.prometheusOperator.thanosImage.repository: ''
    kube-prometheus-stack.prometheusOperator.thanosImage.sha: ''
    kube-prometheus-stack.prometheusOperator.thanosImage.tag: ''
    metadata.image.repository: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR" | split
      ":")._0 }}'
    metadata.image.tag: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR" | split ":")._1
      }}'
    metrics-server.image.registry: '{{ ("$RELATED_IMAGE_METRICS_SERVER" | split "/")._0
      }}'
    metrics-server.image.repository: '{{ (("$RELATED_IMAGE_METRICS_SERVER" | split
      ":")._0 | split "/")._1 }}/{{ (("$RELATED_IMAGE_METRICS_SERVER" | split ":")._0
      | split "/")._2 }}'
    metrics-server.image.tag: '{{ ("$RELATED_IMAGE_METRICS_SERVER" | split ":")._1
      }}'
    opentelemetry-operator.kubeRBACProxy.image.repository: '{{ ("$RELATED_IMAGE_KUBE_RBAC_PROXY"
      | split ":")._0 }}'
    opentelemetry-operator.kubeRBACProxy.image.repository.tag: ''
    opentelemetry-operator.kubeRBACProxy.image.tag: '{{ ("$RELATED_IMAGE_KUBE_RBAC_PROXY"
      | split ":")._1 }}'
    opentelemetry-operator.manager.autoInstrumentationImage.dotnet.repository: ''
    opentelemetry-operator.manager.autoInstrumentationImage.dotnet.tag: ''
    opentelemetry-operator.manager.autoInstrumentationImage.java.repository: ''
    opentelemetry-operator.manager.autoInstrumentationImage.java.tag: ''
    opentelemetry-operator.manager.autoInstrumentationImage.nodejs.repository: ''
    opentelemetry-operator.manager.autoInstrumentationImage.nodejs.tag: ''
    opentelemetry-operator.manager.autoInstrumentationImage.python.repository: ''
    opentelemetry-operator.manager.autoInstrumentationImage.python.tag: ''
    opentelemetry-operator.manager.collectorImage.repository: ''
    opentelemetry-operator.manager.collectorImage.tag: ''
    opentelemetry-operator.manager.image.repository: '{{ ("$RELATED_IMAGE_OPENTELEMETRY_OPERATOR"
      | split ":")._0 }}'
    opentelemetry-operator.manager.image.repository.tag: ''
    opentelemetry-operator.manager.image.tag: '{{ ("$RELATED_IMAGE_OPENTELEMETRY_OPERATOR"
      | split ":")._1 }}'
    opentelemetry-operator.testFramework.image.repository: ''
    opentelemetry-operator.testFramework.image.repository.tag: ''
    otelagent.daemonset.image.repository: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR"
      | split ":")._0 }}'
    otelagent.daemonset.image.tag: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR"
      | split ":")._1 }}'
    otelcol.deployment.image.repository: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR"
      | split ":")._0 }}'
    otelcol.deployment.image.tag: '{{ ("$RELATED_IMAGE_SUMOLOGIC_OTEL_COLLECTOR" |
      split ":")._1 }}'
    otelcolInstrumentation.statefulset.image.repository: ''
    otelcolInstrumentation.statefulset.image.tag: ''
    otelevents.image.repository: ''
    otelevents.image.tag: ''
    otellogs.daemonset.initContainers.changeowner.image.repository: ''
    otellogs.daemonset.initContainers.changeowner.image.tag: ''
    otellogs.image.repository: ''
    otellogs.image.tag: ''
    otellogswindows.daemonset.initContainers.prepare.image.repository: ''
    otellogswindows.daemonset.initContainers.prepare.image.tag: ''
    otellogswindows.image.repository: ''
    otellogswindows.image.tag: ''
    pvcCleaner.job.image.repository: ''
    pvcCleaner.job.image.tag: ''
    sumologic.metrics.collector.otelcol.image.repository: ''
    sumologic.metrics.collector.otelcol.image.tag: ''
    sumologic.metrics.remoteWriteProxy.image.repository: ''
    sumologic.metrics.remoteWriteProxy.image.tag: ''
    sumologic.otelcolImage.repository: ''
    sumologic.otelcolImage.tag: ''
    sumologic.setup.job.image.repository: '{{ ("$RELATED_IMAGE_KUBERNETES_SETUP" |
      split ":")._0 }}'
    sumologic.setup.job.image.tag: '{{ ("$RELATED_IMAGE_KUBERNETES_SETUP" | split
      ":")._1 }}'
    sumologic.setup.job.initContainerImage.repository: ''
    sumologic.setup.job.initContainerImage.tag: ''
    tailing-sidecar-operator.kubeRbacProxy.image.repository: '{{ ("$RELATED_IMAGE_KUBE_RBAC_PROXY"
      | split ":")._0 }}'
    tailing-sidecar-operator.kubeRbacProxy.image.tag: '{{ ("$RELATED_IMAGE_KUBE_RBAC_PROXY"
      | split ":")._1 }}'
    tailing-sidecar-operator.operator.image.repository: '{{ ("$RELATED_IMAGE_TAILING_SIDECAR_OPERATOR"
      | split ":")._0 }}'
    tailing-sidecar-operator.operator.image.tag: '{{ ("$RELATED_IMAGE_TAILING_SIDECAR_OPERATOR"
      | split ":")._1 }}'
    tailing-sidecar-operator.sidecar.image.repository: '{{ ("$RELATED_IMAGE_TAILING_SIDECAR"
      | split ":")._0 }}'
    tailing-sidecar-operator.sidecar.image.tag: '{{ ("$RELATED_IMAGE_TAILING_SIDECAR"
      | split ":")._1 }}'
    telegraf-operator.image.repository: '{{ ("$RELATED_IMAGE_TELEGRAF_OPERATOR" |
      split ":")._0 }}'
    telegraf-operator.image.sidecarImage: $RELATED_IMAGE_TELEGRAF
    telegraf-operator.image.tag: '{{ ("$RELATED_IMAGE_TELEGRAF_OPERATOR" | split ":")._1
      }}'
    tracesGateway.deployment.image.repository: ''
    tracesGateway.deployment.image.tag: ''
    tracesSampler.deployment.image.repository: ''
    tracesSampler.deployment.image.tag: ''
  version: v1alpha1

@kasia-kujawa kasia-kujawa requested a review from a team as a code owner June 19, 2024 11:50
@sumo-drosiek
Copy link
Contributor

can we sort watches.yaml first?

@kasia-kujawa
Copy link
Contributor Author

kasia-kujawa commented Jun 20, 2024

can we sort watches.yaml first?

@sumo-drosiek at this moment watches.yaml is only sorted/formatted, none of images is added, as images haven't been updated yet.

Copy link
Contributor

@sumo-drosiek sumo-drosiek left a comment

Choose a reason for hiding this comment

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

Awesome work 🚀 🐶 🎸

@kasia-kujawa kasia-kujawa merged commit 2231d0f into main Jun 20, 2024
3 checks passed
@kasia-kujawa kasia-kujawa deleted the generate_watches branch June 20, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants