0

I have this deployement.yaml file :

kind: "Template"
apiVersion: "v1"
metadata:
  name: "deploymentConfig-gui-template-${Platform}"
  annotations:
    description: "Template for gui deploymentConfig on ${Platform}"
objects:
  - kind: HorizontalPodAutoscaler
    apiVersion: autoscaling/v1
    metadata:
      name: gui-${oPlatform}-autoscaling
    spec:
      scaleTargetRef:
        kind: DeploymentConfig 
        name: scoring-gui-deploy-${oPlatform}
        apiVersion: v1 
      minReplicas: ${{Min_replicas}}
      maxReplicas: ${{Max_replicas}}
      targetCPUUtilizationPercentage: ${{Target_CPU_use}}
  - kind: "DeploymentConfig"
    apiVersion: "v1"
    metadata:
      name: gui-deploy-${oPlatform}
      app: gui-deploy-${oPlatform}
    spec:
      template:
        metadata:
          labels:
            name: gui-${Platform}
            app: gui-${Platform}
        spec:
          imagePullSecrets:
            - name: docker-pull-secret
          containers:
            - name: gui-private-${Platform}
              image: ${Registry_URL}/${DockerImageGuiPrivateName}:${DockerImageVersion}
              imagePullPolicy: Always
              ports:
                - containerPort: 8004
                  protocol: "TCP"
              readinessProbe:
                httpGet:
                  path: /status
                  port: 8004
                  scheme: HTTP
                initialDelaySeconds: 30
                timeoutSeconds: 2
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 2
              livenessProbe: 
                httpGet: 
                  path: /status
                  port: 8004
                  scheme: HTTP
                initialDelaySeconds: 30
                timeoutSeconds: 5
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 2
              resources:
                requests:
                  cpu: ${Private_request_CPU}
                  memory: ${Private_request_memory}
                limits:
                  cpu: ${Private_limit_CPU}
                  memory: ${Private_limit_memory}
              env:
                - name: GUI_VERSION
                  value: ${DockerImageVersion}
              envFrom:
              - configMapRef:
                  name: gui-configmap-global
              - configMapRef:
                  name: gui-configmap-site
              - secretRef:
                  name: gui-secret
              volumeMounts:
                - name: pvc-private-ca-mail
                  mountPath: "/certificat/"
                  readOnly: true
            - name: scoring-gui-public-${Platform}
              image: ${Registry_URL}/${DockerImageGuiPublicName}:${DockerImageVersion}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
                  protocol: "TCP"
              readinessProbe:
                httpGet:
                  path: /status
                  port: 8080
                  scheme: HTTP
                initialDelaySeconds: 30
                timeoutSeconds: 2
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 2
              livenessProbe: 
                httpGet: 
                  path: /status
                  port: 8080
                  scheme: HTTP
                initialDelaySeconds: 30
                timeoutSeconds: 5
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 2                
              resources:
                requests:
                  cpu: ${Public_request_CPU}
                  memory: ${Public_request_memory}
                limits:
                  cpu: ${Public_Limit_CPU}
                  memory: ${Public_limit_memory}
              env:
                - name: GUI_VERSION
                  value: ${DockerImageVersion}
              envFrom:
              - configMapRef:
                  name: gui-configmap-global
              - configMapRef:
                  name: gui-configmap-site
              - secretRef:
                  name: gui-secret
              volumeMounts:
                - name: pvc-private-ca-mail
                  mountPath: "/certificat/"
                  readOnly: true
          volumes:
            - name: pvc-private-ca-mail
              secret:
                secretName: gui-ca-mail-secret
                items:
                - key: gui_ca_mail
                  path: gui_ca_mail.pem           
      replicas: 1
      revisionHistoryLimit: 1

and when i run the deployement i get this error : level=error msg="Error parsing YAML: (quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$')" level=error msg="Error fetching Kubernetes resources quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'

I know that the problem cames from the variables that i made in ressources. Can anyone know how to solve it by keeping the variables ? And what I need to do (specifically!) to fix it?

I tried to make a deployment and i get this error.

I expect something like this :

Efficiency - CPU limits are set Efficiency - Memory limits are set

Devpy
  • 1
  • 4
  • What tool is in charge of filling in the variables and what syntax does it expect? I see both `${...}` and `${{...}}` – Botje Mar 02 '23 at 14:05
  • I use gitlab-ci to run the pipelines. I declared those variables in the pipeline. it's working for other YAML deployement of other components but for this, it doesn't work at all. – Devpy Mar 03 '23 at 09:13
  • Well .. what values did you fill in for those variables? – Botje Mar 03 '23 at 12:51
  • TEMPLATES_PARAMS: | oRequest_CPU=50m, oRequest_memory=100Mi, {oMin_replicas}=1, {oMax_replicas}=2, {oTarget_CPU_use}=1800, oLimit_CPU=200m, oLimit_memory=300Mi, – Devpy Mar 10 '23 at 11:25
  • Your template uses variable names like "Private_request_CPU". I do not see these anywhere in your list of parameters? – Botje Mar 10 '23 at 11:48
  • for that it's okay. I assigne it to a variable in gitlab-ci.yaml like this : oPrivate_request_CPU="$GUI_PRIVATE_REQUEST_CPU" and it has this value : GUI_PRIVATE_REQUEST_CPU: "10m" – Devpy Mar 10 '23 at 14:28
  • I give up. So far in the comments you have unearthed two layers of complexity that were not present in your question. Can we see the final rendered YAML file and *all* inputs that lead to it please? – Botje Mar 10 '23 at 14:31

0 Answers0