-
Notifications
You must be signed in to change notification settings - Fork 224
USHIFT-1061: auto config generator #1639
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
Changes from all commits
00954ed
ad52ad4
8431a08
842beba
b0598cd
9331369
a54f2b3
74c6398
b7484f0
bf1e5f3
9c0fd86
6b7f303
30d711c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| { | ||
| "type": "object", | ||
| "required": [ | ||
| "apiServer", | ||
| "debugging", | ||
| "dns", | ||
| "etcd", | ||
| "network", | ||
| "node" | ||
| ], | ||
| "properties": { | ||
| "apiServer": { | ||
| "type": "object", | ||
| "required": [ | ||
| "subjectAltNames" | ||
| ], | ||
| "properties": { | ||
| "advertiseAddress": { | ||
| "description": "Kube apiserver advertise address to work around the certificates issue when requiring external access using the node IP. This will turn into the IP configured in the endpoint slice for kubernetes service. Must be a reachable IP from pods. Defaults to service network CIDR first address.", | ||
| "type": "string" | ||
| }, | ||
| "subjectAltNames": { | ||
| "description": "SubjectAltNames added to API server certs", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "debugging": { | ||
| "type": "object", | ||
| "required": [ | ||
| "logLevel" | ||
| ], | ||
| "properties": { | ||
| "logLevel": { | ||
| "description": "Valid values are: \"Normal\", \"Debug\", \"Trace\", \"TraceAll\". Defaults to \"Normal\".", | ||
| "type": "string", | ||
| "default": "Normal" | ||
| } | ||
| } | ||
| }, | ||
| "dns": { | ||
| "type": "object", | ||
| "required": [ | ||
| "baseDomain" | ||
| ], | ||
| "properties": { | ||
| "baseDomain": { | ||
| "description": "baseDomain is the base domain of the cluster. All managed DNS records will be sub-domains of this base. \n For example, given the base domain `example.com`, router exposed domains will be formed as `*.apps.example.com` by default, and API service will have a DNS entry for `api.example.com`, as well as \"api-int.example.com\" for internal k8s API access. \n Once set, this field cannot be changed.", | ||
| "type": "string", | ||
| "default": "example.com", | ||
| "example": "microshift.example.com" | ||
| } | ||
| } | ||
| }, | ||
| "etcd": { | ||
| "type": "object", | ||
| "required": [ | ||
| "memoryLimitMB" | ||
| ], | ||
| "properties": { | ||
| "memoryLimitMB": { | ||
| "description": "Set a memory limit on the etcd process; etcd will begin paging memory when it gets to this value. 0 means no limit.", | ||
| "type": "integer", | ||
| "format": "int64" | ||
| } | ||
| } | ||
| }, | ||
| "network": { | ||
| "type": "object", | ||
| "required": [ | ||
| "clusterNetwork", | ||
| "serviceNetwork", | ||
| "serviceNodePortRange" | ||
| ], | ||
| "properties": { | ||
| "clusterNetwork": { | ||
| "description": "IP address pool to use for pod IPs. This field is immutable after installation.", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "required": [ | ||
| "cidr" | ||
| ], | ||
| "properties": { | ||
| "cidr": { | ||
| "description": "The complete block for pod IPs.", | ||
| "type": "string", | ||
| "default": "10.42.0.0/16" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "serviceNetwork": { | ||
| "description": "IP address pool for services. Currently, we only support a single entry here. This field is immutable after installation.", | ||
| "type": "array", | ||
| "default": [ | ||
| "10.43.0.0/16" | ||
| ], | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "serviceNodePortRange": { | ||
| "description": "The port range allowed for Services of type NodePort. If not specified, the default of 30000-32767 will be used. Such Services without a NodePort specified will have one automatically allocated from this range. This parameter can be updated after the cluster is installed.", | ||
| "type": "string", | ||
| "default": "30000-32767", | ||
| "pattern": "^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])-([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$" | ||
| } | ||
| } | ||
| }, | ||
| "node": { | ||
| "type": "object", | ||
| "required": [ | ||
| "hostnameOverride", | ||
| "nodeIP" | ||
| ], | ||
| "properties": { | ||
| "hostnameOverride": { | ||
| "description": "If non-empty, will use this string to identify the node instead of the hostname", | ||
| "type": "string" | ||
| }, | ||
| "nodeIP": { | ||
| "description": "IP address of the node, passed to the kubelet. If not specified, kubelet will use the node's default IP address.", | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Config-Gen | ||
|
|
||
| This is a simple generator tool that will read files for a specific struct and generate a yaml representation of it with comments to help keep things in sync. This is meant to be used as part of the `//go:generate` command but can also be installed and used as a stand alone binary. | ||
|
|
||
| ### Install | ||
|
|
||
| ```sh | ||
| go install . | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| CLI flags. | ||
|
|
||
| ```sh | ||
| Usage: | ||
| config-gen [flags] | ||
|
|
||
| Flags: | ||
| -a, --api-output string output path for openapi spec if desired | ||
| -f, --file string default is stdin | ||
| -h, --help help for config-gen | ||
| -o, --output string output path, default is stdout | ||
| -t, --template string template file to use | ||
| -v, --v Level number for the log level verbosity | ||
| ``` | ||
|
|
||
| Use as a go generate command example | ||
| ```go | ||
| //go:generate sh -c "controller-gen crd paths=../../hack/config-gen/configcrd output:stdout | go run -mod vendor ../../hack/config-gen -a ../../cockpit-plugin/packaging/config-openapi-spec.json -o ../../packaging/microshift/config.yaml" | ||
| //go:generate sh -c "controller-gen crd paths=../../hack/config-gen/configcrd output:stdout | go run -mod vendor ../../hack/config-gen -o ../../docs/howto_config.md -t ../../docs/howto_config.md" | ||
| ``` | ||
|
|
||
| Use the example test to see it in action, run the command from the `hack/config-gen` directory. | ||
|
|
||
| ```sh | ||
| controller-gen crd paths=../../hack/config-gen/configcrd output:stdout | go run -mod vendor ../../hack/config-gen | ||
| ``` | ||
|
|
||
| The sample output should be. | ||
| ```yaml | ||
| #!! Do Not Edit | ||
| #!! This is a generated file | ||
| apiServer: | ||
| # Kube apiserver advertise address to work around the certificates issue when requiring external access using the node IP. This will turn into the IP configured in the endpoint slice for kubernetes service. Must be a reachable IP from pods. Defaults to service network CIDR first address. | ||
| advertiseAddress: "" | ||
| # SubjectAltNames added to API server certs | ||
| subjectAltNames: | ||
| - "" | ||
| debugging: | ||
| # Valid values are: "Normal", "Debug", "Trace", "TraceAll". Defaults to "Normal". | ||
| logLevel: Normal | ||
| dns: | ||
| # baseDomain is the base domain of the cluster. All managed DNS records will be sub-domains of this base. | ||
| # For example, given the base domain `example.com`, router exposed domains will be formed as `*.apps.example.com` by default, and API service will have a DNS entry for `api.example.com`, as well as "api-int.example.com" for internal k8s API access. | ||
| # Once set, this field cannot be changed. | ||
| # example: | ||
| # microshift.example.com | ||
| baseDomain: example.com | ||
| etcd: | ||
| # Set a memory limit on the etcd process; etcd will begin paging memory when it gets to this value. 0 means no limit. | ||
| memoryLimitMB: 0 | ||
| network: | ||
| # IP address pool to use for pod IPs. This field is immutable after installation. | ||
| clusterNetwork: | ||
| - # The complete block for pod IPs. | ||
| cidr: 10.42.0.0/16 | ||
| # IP address pool for services. Currently, we only support a single entry here. This field is immutable after installation. | ||
| serviceNetwork: | ||
| - "" | ||
| # The port range allowed for Services of type NodePort. If not specified, the default of 30000-32767 will be used. Such Services without a NodePort specified will have one automatically allocated from this range. This parameter can be updated after the cluster is installed. | ||
| serviceNodePortRange: 30000-32767 | ||
| node: | ||
| # If non-empty, will use this string to identify the node instead of the hostname | ||
| hostnameOverride: "" | ||
| # IP address of the node, passed to the kubelet. If not specified, kubelet will use the node's default IP address. | ||
| nodeIP: "" | ||
| ``` |
Uh oh!
There was an error while loading. Please reload this page.