controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

auto generate sample yaml spec

Open fanux opened this issue 5 years ago • 7 comments

/kind feature

This this my api type:

// BridgeSpec defines the desired state of Bridge
type BridgeSpec struct {
	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
	// Important: Run "make" to regenerate code after modifying this file
	VpcName string `json:"vpcname"`
	// ovn-nbctl set Logical_Switch vpc1 other_config:subnet=172.66.1.10/24
	Subnet  string `json:"subnet"`
	Gateway string `json:"gateway"`
}

After generating yamls:

make && make install && make run
apiVersion: infra.genos.io/v1
kind: Bridge
metadata:
  name: bridge-sample
spec:
  # Add fields here
  foo: bar

The spec is foo:bar, auto-generate spec may be more convenience

fanux avatar Aug 06 '19 01:08 fanux

/help

The end goal for this is pretty clear, but I'm not sure how, exactly, to get to the destination. We could possible use fuzzing to generate example values, or just use the empty value. In either case, we'd probably generate invalid values (due to validation), but we could maybe hook up the openapi validator to skip these, or teach the fuzzer about openapi.

DirectXMan12 avatar Aug 06 '19 02:08 DirectXMan12

@DirectXMan12: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

The end goal for this is pretty clear, but I'm not sure how, exactly, to get to the destination. We could possible use fuzzing to generate example values, or just use the empty value. In either case, we'd probably generate invalid values (due to validation), but we could maybe hook up the openapi validator to skip these, or teach the fuzzer about openapi.

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 avatar Aug 06 '19 02:08 k8s-ci-robot

/lifecycle frozen

DirectXMan12 avatar Aug 06 '19 02:08 DirectXMan12

Doesn't the request meed the requirements listed ? I want to +1 this request. Would have been useful for me too.

nimrodf1 avatar Aug 09 '20 15:08 nimrodf1

yes, it meets the requirements -- "frozen" means don't bug us about issues going stale. However, we're still waiting on a proposal of how to accomplish this (some sort of design/prototype/whatever)

DirectXMan12 avatar Sep 09 '20 23:09 DirectXMan12

HI @DirectXMan12,

Should not it be better addressed in the controller-tools? WDYT about we raise it there and close this one?

camilamacedo86 avatar Nov 03 '20 11:11 camilamacedo86

Transferred the issue for this repo since the change would need to get done in the controller-gen.

camilamacedo86 avatar Sep 21 '22 10:09 camilamacedo86