Skip to content

When using quarkus.openshift.secret-volumes."secret-volumes".items."items".path the deploy fail to openshift #54784

@jedla97

Description

@jedla97

Describe the bug

Hi, I have app (see reproducer) which I deploy to openshift. As part of deploy command I set quarkus.openshift.secret-volumes."secret-volumes".items."items".path=keycloak-truststore.p12. When this property is set the deploy to openshift fail because of [StatusCause(field=spec.template.spec.volumes[0].secret.items[0].mode, message=Invalid value: -1: must be a number between 0 and 0777 (octal), both inclusive, reason=FieldValueInvalid, additionalProperties={}. This start happening after the #54245

The problem is that the item mode is set to -1 like this

      volumes:
        - name: app-808593636-keycloak-truststore-p12
          secret:
            defaultMode: 384
            items:
              - key: keycloak-truststore.p12
                mode: -1
                path: keycloak-truststore.p12
            optional: false
            secretName: app-808593636-keycloak-truststore-p12

It's possible to fix it by setting quarkus.openshift.secret-volumes."secret-volumes".items."items".mode to valid value. In previous releases 3.36 and older this was not needed.

The mode is newly set in https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/SecretVolumeConfig.java#L16 and https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ConfigMapVolumeConfig.java#L16

I encounter this with secrets as I don't set non-secret but I expect the same thing happen there.

Expected behavior

I would expect either not to fail the deploy as before or at least some entry/mention to migration guide if this is expected.

Actual behavior

Failing with spec.template.spec.volumes[0].secret.items[0].mode: Invalid value: -1: must be a number between 0 and 0777 (octal), both inclusive

How to Reproduce?

  1. git clone -b openshift-reproducer https://github.com/jedla97/quarkus-reproducers.git
  2. cd quarkus-reproducers
  3. Login to Openshift (maybe the problem is on Kubernetes as well didn't try it)
  4. mvn -e --no-transfer-progress -B -V package -DskipTests=true -DskipITs=true

The properties are set in application.properties. To see that quarkus.openshift.secret-volumes."secret-volumes".items."items".mode fixing the issue, please un-comment it.

Note: I'm setting the namespace as Quarkus property so you may need to remove it or create that namespace

Output of uname -a or ver

No response

Output of java -version

No response

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

main, 3.37.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions