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

Kubernetes was relax restrictions on environment variable names. #1361

Closed
chenlein opened this issue Feb 19, 2019 · 3 comments
Closed

Kubernetes was relax restrictions on environment variable names. #1361

chenlein opened this issue Feb 19, 2019 · 3 comments

Comments

@chenlein
Copy link
Contributor

chenlein commented Feb 19, 2019

Reopen: #447
Kubernetes was relax restrictions on environment variable names.
Sample code:

          env:
            - name: "cluster.name"
              value: "elasticsearch-cluster-1550544058281"
            - name: "bootstrap.memory_lock"
              value: "true"
            - name: "discovery.zen.ping.unicast.hosts"
              value: "elasticsearch-discovery-1550544058281"
            - name: "node.master"
              value: "false"
            - name: "node.data"
              value: "true"
            - name: "ES_JAVA_OPTS"
              value: "-Xms8192m -Xmx8192m"

Error message:

javax.validation.ConstraintViolationException: Constraint Validations: name must match "^[A-Za-z_][A-Za-z0-9_]*$" on bean: EnvVar(name=cluster.name, value=elasticsearch-cluster-1550544067656, valueFrom=null, additionalProperties={})
@rohanKanojia
Copy link
Member

@chenlein : oh, I see. Could you please raise a PR to relex these restrictions? I think you would just need to change some regexes here:

@chenlein
Copy link
Contributor Author

@rohanKanojia : I try to fix this problem,I modified the file of you told me, see here. However I can not generate model, when I execute make, some errors have occurred:

chenleis-MacBook-Pro:kubernetes-model chenlei$ make
dep ensure -v
CGO_ENABLED=0 GO15VENDOREXPERIMENT=1 go build -a ./cmd/generate/generate.go
./generate > kubernetes-model/src/main/resources/schema/kube-schema.json
./generate validation > kubernetes-model/src/main/resources/schema/validation-schema.json
mvn clean install
[INFO] Scanning for projects...
<snip>
[INFO] Final Memory: 45M/1184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.23:generate (default) on project kubernetes-model: Execution default of goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.23:generate failed: Path not present: kubernetes_apimachinery_pkg_runtime_ImageRawExtension -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :kubernetes-model
make: *** [build] Error 1

And, my kube-schema.json are very different from yours. Just like follows:

{
  "id": "http://fabric8.io/fabric8/v2/Schema#",
  "$schema": "http://json-schema.org/schema#",
  "definitions": {
    "github_com_fabric8io_kubernetes_model_vendor_github_com_openshift_api_apps_v1_CustomDeploymentStrategyParams": {
      "type": "object",
      "description": "",
      "properties": {
        "command": {
          "type": "array",
          "description": "",
          "javaOmitEmpty": true,
          "items": {
            "type": "string",
            "description": ""
          }
        },
        "environment": {
          "type": "array",
          "description": "",
          "javaOmitEmpty": true,
          "items": {
            "$ref": "#/definitions/github_com_fabric8io_kubernetes_model_vendor_k8s_io_api_core_v1_EnvVar",
            "javaType": "EnvVar"
          }
        },
        "image": {
          "type": "string",
          "description": ""
        }
      },
      "additionalProperties": true,
      "javaType": "CustomDeploymentStrategyParams",
      "javaInterfaces": [
        "io.fabric8.kubernetes.api.model.KubernetesResource"
      ]
    },
    "github_com_fabric8io_kubernetes_model_vendor_github_com_openshift_api_apps_v1_DeploymentCause": {
      "type": "object",
<snip>

So, I can't confirm if my changes are correct.

@rohanKanojia
Copy link
Member

rohanKanojia commented Feb 21, 2019

@chenlein : ah, I see. Thanks for trying it out. I would try pulling your changes and build and then come back to this. Bdw, Could you please create a draft PR in the meantime so that this effort doesn't get lost?

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

2 participants