Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devfile variables inside kubernetes component are not replaced #5240

Closed
kadel opened this issue Nov 23, 2021 · 2 comments
Closed

devfile variables inside kubernetes component are not replaced #5240

kadel opened this issue Nov 23, 2021 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). triage/duplicate Indicates an issue or PR that is a duplicate of other open issue or PR.

Comments

@kadel
Copy link
Member

kadel commented Nov 23, 2021

Devfile variables inside kubernetes component files referenced by uri should work the same way as they do when inline is used

#devfile.yaml

commands:
  - exec:
      commandLine: npm install
      component: runtime
      group:
        isDefault: true
        kind: build
      workingDir: $PROJECT_SOURCE
    id: install
  - exec:
      commandLine: npm start
      component: runtime
      group:
        isDefault: true
        kind: run
      workingDir: $PROJECT_SOURCE
    id: run
  - id: build-image
    apply:
      component: prod-image
  - id: deployk8s
    apply:
      component: outerloop-deploy
  - id: deploy
    composite:
      commands:
        - build-image
        - deployk8s
      group:
        kind: deploy
        isDefault: true
components:
  - container:
      endpoints:
        - name: http-3000
          targetPort: 3000
      image: registry.access.redhat.com/ubi8/nodejs-14:latest
      memoryLimit: 1024Mi
      mountSources: true
    name: runtime
  - name: prod-image
    image:
      imageName: "{{CONTAINER_IMAGE}}"
      dockerfile:
        uri: ./Dockerfile
        buildContext: ${PROJECT_SOURCE}
  - name: outerloop-deploy
    kubernetes:
      uri: kubernetes/deployment.yaml

variables:
  CONTAINER_IMAGE: quay.io/tkral/test:latest
metadata:
  language: javascript
  name: nodejs-nodejs-kkty
  projectType: nodejs
schemaVersion: 2.2.0
starterProjects:
  - git:
      remotes:
        origin: https://github.com/odo-devfiles/nodejs-ex.git
    name: nodejs-starter
# kubernetes/deployment.yaml

kind: Deployment
apiVersion: apps/v1
metadata:
  name: mynode
spec:
  replicas: 1
  selector:
    matchLabels:
      app: node-app
  template:
    metadata:
      labels:
        app: node-app
    spec:
      containers:
        - name: main
          image: "{{CONTAINER_IMAGE}}"
          resources: {}

odo deploy
$ k get deployment mynode -o yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2021-11-23T08:58:43Z"
  generation: 1
  labels:
    app.kubernetes.io/managed-by: odo
  name: mynode
  namespace: test
  resourceVersion: "31444"
  uid: 98f8a389-0a3d-4abf-b9f1-c691ad7c4cf0
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: node-app
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: node-app
    spec:
      containers:
      - image: '{{ CONTAINER_IMAGE }}'
        imagePullPolicy: IfNotPresent
        name: main
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  conditions:
  - lastTransitionTime: "2021-11-23T08:58:43Z"
    lastUpdateTime: "2021-11-23T08:58:43Z"
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: "2021-11-23T09:08:44Z"
    lastUpdateTime: "2021-11-23T09:08:44Z"
    message: ReplicaSet "mynode-5db6864ffd" has timed out progressing.
    reason: ProgressDeadlineExceeded
    status: "False"
    type: Progressing
  observedGeneration: 1
  replicas: 1
  unavailableReplicas: 1
  updatedReplicas: 1

/kind bug
/priority high

@kadel kadel added kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). labels Nov 23, 2021
@rm3l
Copy link
Member

rm3l commented Sep 1, 2022

Duplicate of #5451 (fixed by #5711).
#6041 would allow to simplify the code in odo, now that substitution is done in the Devfile library itself.

/triage duplicate
/close

@openshift-ci openshift-ci bot added the triage/duplicate Indicates an issue or PR that is a duplicate of other open issue or PR. label Sep 1, 2022
@openshift-ci openshift-ci bot closed this as completed Sep 1, 2022
@openshift-ci
Copy link

openshift-ci bot commented Sep 1, 2022

@rm3l: Closing this issue.

In response to this:

Duplicate of #5451 (fixed by #5711).
#6041 would allow to simplify the code in odo, now that substitution is done in the Devfile library itself.

/triage duplicate
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). triage/duplicate Indicates an issue or PR that is a duplicate of other open issue or PR.
Projects
None yet
Development

No branches or pull requests

2 participants