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

Inconsistent inline behaviour for embedded structs depending on pointer/value type #773

Open
Miles-Garnsey opened this issue Feb 2, 2023 · 10 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@Miles-Garnsey
Copy link

Miles-Garnsey commented Feb 2, 2023

I'm not sure if this is a bug or a feature, but I couldn't find documentation for it so thought I'd raise an issue.

When using controller-gen, and using the inline json tag on an embedded struct pointer, it appears that the generated CRDs come out with a field "inline". If I make the field (TelemetrySpec in the below example) a value type, the CRDs correctly inline the type's fields as expected.

Structs


type TelemetrySpec struct {
	Prometheus *PrometheusTelemetrySpec `json:"prometheus,omitempty"`
	Vector     *VectorSpec              `json:"vector,omitempty"`
}

type CassandraTelemetrySpec struct {
	*TelemetrySpec `json:",inline"`
	Mcac          *McacTelemetrySpec  `json:"mcac,omitempty"`
	Cassandra     *CassandraAgentSpec `json:"cassandra,omitempty"`
}

Generated CRD (with pointer)

                          properties:
                            cassandra:
                              properties:
...
                            inline:
                              properties:
                                prometheus:
                                  properties:
                                    commonLabels:
                                      additionalProperties:
                                        type: string
                                      description: CommonLabels are applied to all
                                        serviceMonitors created.
                                      type: object
                                    enabled:
                                      description: Enable the creation of Prometheus
                                        serviceMonitors for this resource (Cassandra
                                        or Stargate).
                                      type: boolean
                                  type: object
                                vector:

Generated CRD (with value type)

                          properties:
                            cassandra:
                              properties:
...
                            mcac:
                              properties:
                                enabled:
                                  description: enabled sets whether MCAC (legacy metrics
                                    endpoint) is enabled. This is considered true
                                    by default.
                                  type: boolean
                                metricFilters:
                                  description: 'MetricFilters allows passing filters
                                    to MCAC in order to reduce the amount of extracted
                                    metrics. Not setting this field will result in
                                    the default filters being used: - "deny:org.apache.cassandra.metrics.Table"
                                    - "deny:org.apache.cassandra.metrics.table" -
                                    "allow:org.apache.cassandra.metrics.table.live_ss_table_count"
                                    - "allow:org.apache.cassandra.metrics.Table.LiveSSTableCount"
                                    - "allow:org.apache.cassandra.metrics.table.live_disk_space_used"
                                    - "allow:org.apache.cassandra.metrics.table.LiveDiskSpaceUsed"
                                    - "allow:org.apache.cassandra.metrics.Table.Pending"
                                    - "allow:org.apache.cassandra.metrics.Table.Memtable"
                                    - "allow:org.apache.cassandra.metrics.Table.Compaction"
                                    - "allow:org.apache.cassandra.metrics.table.read"
                                    - "allow:org.apache.cassandra.metrics.table.write"
                                    - "allow:org.apache.cassandra.metrics.table.range"
                                    - "allow:org.apache.cassandra.metrics.table.coordinator"
                                    - "allow:org.apache.cassandra.metrics.table.dropped_mutations"
                                    Setting it to an empty list will result in all
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 3, 2023
@Miles-Garnsey
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 12, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 20, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 19, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
@sbueringer
Copy link
Member

/reopen
/lifecycle frozen

@k8s-ci-robot
Copy link
Contributor

@sbueringer: Reopened this issue.

In response to this:

/reopen
/lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot reopened this Jul 16, 2024
@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jul 16, 2024
@Miles-Garnsey
Copy link
Author

I see this has been reopened. Can I be of assistance in fixing it? I may need some support but I’m open to helping.

@sbueringer
Copy link
Member

I re-opened because it seems like a valid issue. As to how to fix this, I'm not sure where this should/can be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants