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

Expand Standard Values #3

Open
SQLJames opened this issue Nov 15, 2024 · 4 comments
Open

Expand Standard Values #3

SQLJames opened this issue Nov 15, 2024 · 4 comments

Comments

@SQLJames
Copy link
Contributor

A lot of helm charts follow standard values. Fields like serviceAccount, image, resources, etc...

It'd be cool if, either via a comment like # $type: resources, or just smart detection, schema gen could "fill-in" the schema for standard fields.

So resources would from

        "resources": {
            "type": "object"
        },

to

              "resources": {
                "description": "ResourceRequirements describes the compute resource requirements.",
                "properties": {
                  "limits": {
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      ]
                    },
                    "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "requests": {
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      ]
                    },
                    "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
                    "type": [
                      "object",
                      "null"
                    ]
                  }
                },
                "type": [
                  "object",
                  "null"
                ]
              },

Could possibly use https://github.com/instrumenta/kubernetes-json-schema as an update to date src for these fields.

@SQLJames
Copy link
Contributor Author

copying issue from karuppiah7890/helm-schema-gen#4

@SQLJames
Copy link
Contributor Author

new up to date repository https://github.com/yannh/kubernetes-json-schema

@SQLJames
Copy link
Contributor Author

playing off the comments from #5 we should be able to implement this by using a comment like

# +schemagen:standard=resources

we will need to define a kubernetes version so we may need to implement a global version

# +schemagen:global:version=1.30

@SQLJames
Copy link
Contributor Author

we also will not be able to just directly reference that repository unless we want some massive bloat in our codebase. So we may need to be selective on common fields that we add. To name a few:

  • resources
  • image
  • affinity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant