Skip to content

[BUG] Kustomize defined secrets is not used by OnionService::privateKeySecret #86

Description

@alf0ns3

Describe the bug
When importing a privateKeySecret generated by Kustomize on a new OnionService, the controller creates a new secret based on the name provided and so the hostname is random.
It is due to Kustomize which append a suffix hash to the secret name, while the Tor Controller is not aware of the new name.

To Reproduce

# kustomization.yaml
namespace: test

secretGenerator:
  - name: onion-secrets
    type: "tor.k8s.torproject.org/onion-v3"
    files:
      - privateKeyFile=secrets/hs_ed25519_secret_key
      - publicKeyFile=secrets/hs_ed25519_public_key
      - onionAddress=secrets/hostname

#generatorOptions:
#  disableNameSuffixHash: true

resources:
  - onion-service.yaml
  - deployment.yaml # definition of the http-app



# onion-service.yaml
---
apiVersion: tor.k8s.torproject.org/v1alpha2
kind: OnionService
metadata:
  name: onion-service
spec:
  version: 3
  rules:
    - port:
        number: 80
      backend:
        service:
          name: http-app
          port:
            number: 80
  privateKeySecret:
    name: onion-secrets

The Tor Controller creates the secret onion-secrets with 5 entries (Tor v2&v3), while Kustomize creates the desired secrets onion-secrets-52gc9c9ccd.

kubectl -n test get secrets
onion-secrets              tor.k8s.torproject.org/onion-v3                5      15m
onion-secrets-52gc9c9ccd   tor.k8s.torproject.org/onion-v3                3      14m

By using the Kustomize disableNameSuffixHash config, it is woking as expected, such as using the hashed name on the OnionService definition.

Expected behavior

When using a Kustomize defined secret, the Tor Controller should use it automatically with the suffix hash.

Additional information

System (please complete the following information):

  • Platform: minikube v1.34.0
  • Version: master branch ( aae11b5 )

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions