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

examples-generated contain fields with wrong type #345

Open
humoflife opened this issue Feb 15, 2024 · 0 comments
Open

examples-generated contain fields with wrong type #345

humoflife opened this issue Feb 15, 2024 · 0 comments
Labels
bug Something isn't working docgen v2
Milestone

Comments

@humoflife
Copy link

What happened?

When generating an example yaml in examples-generated the expectation is that the type of the fields matches the type of the fields in the corresponding generated CRD. However, when generating a provider-datadog, the generated CRD for package/crds/monitor.datadog.upbound.io_monitors.yaml includes the expected type string for the following monitorThresholds numbers:

 161                   monitorThresholds:
 162                     description: '(Block List, Max: 1) Alert thresholds of the monitor.
 163                       (see below for nested schema) Alert thresholds of the monitor.'
 164                     items:
 165                       properties:
 166                         critical:
 167                           description: (String) The monitor CRITICAL threshold. Must
 168                             be a number. The monitor `CRITICAL` threshold. Must be
 169                             a number.
 170                           type: string
 171                         criticalRecovery:
 172                           description: (String) The monitor CRITICAL recovery threshold.
 173                             Must be a number. The monitor `CRITICAL` recovery threshold.
 174                             Must be a number.
 175                           type: string
 176                         ok:
 177                           description: (String) The monitor OK threshold. Only supported
 178                             in monitor type service check. Must be a number. The monitor
 179                             `OK` threshold. Only supported in monitor type `service
 180                             check`. Must be a number.
 181                           type: string
 182                         unknown:
 183                           description: (String) The monitor UNKNOWN threshold. Only
 184                             supported in monitor type service check. Must be a number.
 185                             The monitor `UNKNOWN` threshold. Only supported in monitor
 186                             type `service check`. Must be a number.
 187                           type: string
 188                         warning:
 189                           description: (String) The monitor WARNING threshold. Must
 190                             be a number. The monitor `WARNING` threshold. Must be
 191                             a number.
 192                           type: string
 193                         warningRecovery:
 194                           description: (String) The monitor WARNING recovery threshold.
 195                             Must be a number. The monitor `WARNING` recovery threshold.
 196                             Must be a number.
 197                           type: string

Yet the examples-generated/monitor/monitor.yaml, uses integers for those fields per below:

apiVersion: monitor.datadog.upbound.io/v1alpha1
kind: Monitor
metadata:
 annotations:
   meta.upbound.io/example-id: monitor/v1alpha1/monitor
 labels:
   testing.upbound.io/example-name: foo
 name: foo
spec:
 forProvider:
   escalationMessage: Escalation message @pagerduty
   includeTags: true
   message: 'Monitor triggered. Notify: @hipchat-channel'
   monitorThresholds:
   - critical: 4
     warning: 2
   name: Name for monitor foo
   query: avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4
   tags:
   - foo:bar
   - team:fooBar
   type: metric alert

When changing the example manually to use strings like below, resources are created.

    monitorThresholds:
    - critical: "4"
      warning: "2"

How can Upjet be directed to create examples with matching types?

How can we reproduce it?

This can be reproduced as follows:

- git clone [email protected]:upbound/provider-datadog.git
- git checkout bootstrap
- make submodules
- make clean; make gen-clean; make generate

Compare the types of examples-generated/monitor/monitor.yaml and package/crds/monitor.datadog.upbound.io_monitors.yaml for monitorThresholds fields.

@humoflife humoflife added the bug Something isn't working label Feb 15, 2024
@jeanduplessis jeanduplessis added this to the 1.2 milestone Feb 15, 2024
@jeanduplessis jeanduplessis modified the milestones: 1.3, 2.x Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docgen v2
Projects
None yet
Development

No branches or pull requests

2 participants