Application.argoproj.io "from-appset-cool_app" is invalid: metadata.name: Invalid value: "from-appset-cool_app": a lowercase RFC 1123 subdomain #48

Closed
opened 2024-11-07 08:06:29 +00:00 by cmoulliard · 1 comment
cmoulliard commented 2024-11-07 08:06:29 +00:00 (Migrated from github.com)

Issue

The following syntax fails

spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
    - plugin:
        configMapRef:
          name: secret-var-plugin-generator
        input:
          parameters:
            secret_vars: ["app_name"]
  template:
    metadata:
      name: 'from-appset-{{.app_name}}'

as ApplicationSet reports

  Template:
    Metadata:
      Name:  from-appset-{{.app_name}}
    Spec:
      Destination:
        Namespace:  default
        Server:     https://kubernetes.default.svc
      Project:      default
      Source:
        Path:      guestbook
        Repo URL:  https://github.com/argoproj/argocd-example-apps.git
Status:
  Conditions:
    Last Transition Time:  2024-11-07T08:03:23Z
    Message:               Application.argoproj.io "from-appset-cool_app" is invalid: metadata.name: Invalid value: "from-appset-cool_app": a lowercase RFC 1123 subdomain must consist of lower case alph
anumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
)
    Reason:                UpdateApplicationError

The problem is coming from the default secret which includes a value's name containing an underscore

apiVersion: v1
data:
  secret_vars.yaml: YXBwX25hbWU6ICJjb29sX2FwcCIK
kind: Secret
metadata:
  annotations:
    meta.helm.sh/release-name: argocd-secret-plugin
    meta.helm.sh/release-namespace: argocd
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: argocd
  name: argocd-secret-plugin-appset-secret-plugin-secret-vars
  namespace: argocd
type: Opaque

==>

echo "YXBwX25hbWU6ICJjb29sX2FwcCIK" | base64 -d
app_name: "cool_app"
## Issue The following syntax fails ``` spec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - plugin: configMapRef: name: secret-var-plugin-generator input: parameters: secret_vars: ["app_name"] template: metadata: name: 'from-appset-{{.app_name}}' ``` as ApplicationSet reports ``` Template: Metadata: Name: from-appset-{{.app_name}} Spec: Destination: Namespace: default Server: https://kubernetes.default.svc Project: default Source: Path: guestbook Repo URL: https://github.com/argoproj/argocd-example-apps.git Status: Conditions: Last Transition Time: 2024-11-07T08:03:23Z Message: Application.argoproj.io "from-appset-cool_app" is invalid: metadata.name: Invalid value: "from-appset-cool_app": a lowercase RFC 1123 subdomain must consist of lower case alph anumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' ) Reason: UpdateApplicationError ``` The problem is coming from the default secret which includes a value's name containing an underscore ``` apiVersion: v1 data: secret_vars.yaml: YXBwX25hbWU6ICJjb29sX2FwcCIK kind: Secret metadata: annotations: meta.helm.sh/release-name: argocd-secret-plugin meta.helm.sh/release-namespace: argocd labels: app.kubernetes.io/managed-by: Helm app.kubernetes.io/part-of: argocd name: argocd-secret-plugin-appset-secret-plugin-secret-vars namespace: argocd type: Opaque ``` ==> ``` echo "YXBwX25hbWU6ICJjb29sX2FwcCIK" | base64 -d app_name: "cool_app" ```
jessebot commented 2024-11-08 06:29:53 +00:00 (Migrated from github.com)

Thanks for pointing this out!

Thanks for pointing this out!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
small-hack/appset-secret-plugin#48
No description provided.