Skip to content

Commit

Permalink
update readme, rename tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang committed Oct 25, 2024
1 parent 160eed4 commit a3c7d95
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ The motivation for creating this tool was to provide a way to support Datadog us

```bash

$ go build -o yaml-mapper .
$ go build -o helm-operator-mapper .

```

## How to use

### Mapping Helm YAML to DatadogAgent CRD Spec

If the desired conversion is between the `datadog` Helm chart and a `DatadogAgent` spec, use the provided `mapping_datadog_helm_to_datadogagent_crd.yaml` file as the mapping file. Otherwise, create your own using the following format:

```
Expand All @@ -29,7 +31,7 @@ Both the key and value are period-delimited instead of nested or indented, as in
Pass the source file and mapping file to the command:

```bash
$ ./yaml-mapper -sourceFile=source.yaml -mappingFile=mapping.yaml
$ ./helm-operator-mapper -sourceFile=source.yaml -mappingFile=mapping.yaml

```

Expand All @@ -42,5 +44,25 @@ By default the output is also printed to STDOUT; to disable this use the flag `-
## Example usage (using provided files)

```bash
$ ./yaml-mapper -sourceFile=example_source.yaml -mappingFile=mapping_datadog_helm_to_datadogagent_crd.yaml -prefixFile=example_prefix.yaml
$ ./helm-operator-mapper -sourceFile=example_source.yaml -mappingFile=mapping_datadog_helm_to_datadogagent_crd.yaml -prefixFile=example_prefix.yaml
```

### Updating Mapping File from a Source YAML

#### Update default Datadog Helm to DatadogAgent CRD mapping file with latest published Datadog Helm chart values.yaml

```bash
./helm-operator-mapper -updateMap
```

#### Update default Datadog Helm to DatadogAgent CRD mapping file with local Datadog values.yaml

```bash
./helm-operator-mapper -updateMap -sourceFile=../../charts/datadog/values.yaml
```

#### Update custom mapping file with custom source YAML file

```bash
./helm-operator-mapper -updateMap -sourceFile=<YOUR_SOURCE_FILE> -mappingFile=<YOUR_MAPPING_FILE>
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This file maps keys from the Datadog Helm chart (YAML) to the DatadogAgent CustomResource spec (YAML).

agents.additionalLabels: spec.override.nodeAgent.labels
agents.affinity: spec.override.nodeAgent.affinity
agents.containers.agent.env: spec.override.nodeAgent.containers.agent.env
Expand Down Expand Up @@ -101,7 +99,7 @@ agents.podSecurity.defaultApparmor: ""
agents.podSecurity.podSecurityPolicy.create: ""
agents.podSecurity.privileged: spec.override.nodeAgent.containers.agent.securityContext.privileged
agents.podSecurity.seLinuxContext: spec.override.nodeAgent.containers.agent.securityContext.seLinuxContext
agents.podSecurity.seLinuxContext.rule:
agents.podSecurity.seLinuxContext.rule: ""
agents.podSecurity.seLinuxContext.seLinuxOptions.level: spec.override.nodeAgent.containers.agent.securityContext.seLinuxContext.level
agents.podSecurity.seLinuxContext.seLinuxOptions.role: spec.override.nodeAgent.containers.agent.securityContext.seLinuxContext.role
agents.podSecurity.seLinuxContext.seLinuxOptions.type: spec.override.nodeAgent.containers.agent.securityContext.seLinuxContext.type
Expand Down Expand Up @@ -134,7 +132,7 @@ agents.volumeMounts:
- spec.override.nodeAgent.containers.security-agent.volumeMounts
agents.volumes: spec.override.nodeAgent.volumes
clusterAgent.additionalLabels: spec.override.clusterAgent.labels
clusterAgent.admissionController.agentSidecarInjection.clusterAgentCommunicationEnabled: spec.features.admissionController.agentSidecarInjection.clusterAgentCommunicationEnabled
clusterAgent.admissionController.agentSidecarInjection.clusterAgentCommunicationEnabled: spec.features.admissionController.agentSidecarInjection.clusterAgentCommunicationEnabled
clusterAgent.admissionController.agentSidecarInjection.containerRegistry: spec.features.admissionController.agentSidecarInjection.registry
clusterAgent.admissionController.agentSidecarInjection.enabled: spec.features.admissionController.agentSidecarInjection.enabled
clusterAgent.admissionController.agentSidecarInjection.imageName: spec.features.admissionController.agentSidecarInjection.image.name
Expand Down Expand Up @@ -370,6 +368,7 @@ datadog.kubelet.podLogsPath: ""
datadog.kubelet.tlsVerify: spec.global.kubelet.tlsVerify
datadog.kubernetesEvents.collectedEventTypes: spec.features.eventCollection.collectEventTypes
datadog.kubernetesEvents.filteringEnabled: ""
datadog.kubernetesEvents.sourceDetectionEnabled: ""
datadog.kubernetesEvents.unbundleEvents: spec.features.eventCollection.unbundleEvents
datadog.kubernetesResourcesAnnotationsAsTags: spec.global.kubernetesResourcesAnnotationsAsTags
datadog.kubernetesResourcesLabelsAsTags: spec.global.kubernetesResourcesLabelsAsTags
Expand Down Expand Up @@ -475,7 +474,6 @@ existingClusterAgent.join: ""
existingClusterAgent.serviceName: ""
existingClusterAgent.tokenSecretName: ""
fips.customFipsConfig: ""
# customFIPSConfig: data, items, name
fips.enabled: spec.global.fips.enabled
fips.image.digest: ""
fips.image.name: spec.global.fips.image.name
Expand All @@ -486,20 +484,20 @@ fips.local_address: spec.global.fips.localAddress
fips.port: spec.global.fips.port
fips.portRange: spec.global.fips.portRange
fips.resources: ""
#resources claims, limits, requests
fips.use_https: spec.global.fips.useHTTPS
fullnameOverride: ""
nameOverride: spec.global.localservice.nameOverride
kube-state-metrics.image: ""
kube-state-metrics.image.repository: ""
kube-state-metrics.nodeSelector.kubernetes.io/os: ""
kube-state-metrics.rbac.create: ""
kube-state-metrics.serviceAccount.create: ""
kube-state-metrics.serviceAccount.name: ""
nameOverride: spec.global.localservice.nameOverride
providers.aks.enabled: ""
providers.eks.ec2.useHostnameFromFile: ""
providers.gke.autopilot: ""
providers.gke.cos: ""
registry: spec.global.registry
remoteConfiguration.enabled: spec.features.remoteConfiguration.enabled
targetSystem: ""
testKey.enabled: ""

0 comments on commit a3c7d95

Please sign in to comment.