Skip to content

Octal defaultMode notation in yaml not properly converted to json #6110

Closed
@bearpaws

Description

@bearpaws

Describe the bug

I'm creating a CronJob from a yaml manifest that contains a ConfigMap volume with octal notation 0555 for the defaultMode.

When creating the resource on the kube server, the API returns this error:

CronJob.batch "conf" is invalid: [spec.jobTemplate.spec.template.spec.volumes[0].configMap.defaultMode: Invalid value: 555: must be a number between 0 and 0777 (octal)

This worked correctly in version 5.12.4 of the API, however in 6.13.1 it fails.

Fabric8 Kubernetes Client version

6.13.1

Steps to reproduce

Yaml manifest that contains a ConfigMap volume:

volumes:
- name: resources
  configMap:
    name: conf
    defaultMode: 0555

Create the resource via the API:

var resource = Serialization.unmarshal(Files.newInputStream(yamlFile), CronJob.class);

System.out.println(resource.getSpec().getJobTemplate().getSpec().getTemplate().getSpec().getVolumes().get(0).getConfigMap());

client.batch().v1().cronjobs()
  .inNamespace(resource.getMetadata().getNamespace())
  .createOrReplace(resource);

In version 5.12.4, it prints:

ConfigMapVolumeSource(defaultMode=365 ...)

In version 6.13.1, it prints the following and fails with the above error.

ConfigMapVolumeSource(defaultMode=555 ...)

Expected behavior

The library should properly convert the octal yaml value into the equivalent value required for json, as it did in previous versions.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

other (please specify in additional context)

Environment

other (please specify in additional context)

Fabric8 Kubernetes Client Logs

No response

Additional context

Related issue: #2572

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions