Skip to content
New issue

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

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

Already on GitHub? # to your account

CRD support for variables + images - broken #1268

Closed
rosscdh opened this issue Jun 27, 2019 · 3 comments
Closed

CRD support for variables + images - broken #1268

rosscdh opened this issue Jun 27, 2019 · 3 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@rosscdh
Copy link

rosscdh commented Jun 27, 2019

I setup "variables"
When using kind: Deployment
the variables are substituted

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: helloworld
  name: helloworld
spec:
  replicas: 2
  selector:
    matchLabels:
      app: helloworld
  strategy:
    blueGreen:
      activeService: helloworld-svc-active
      autoPromotionEnabled: false
      previewService: helloworld-svc-preview
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - env:
        - name: DEPLOY_VERSION
          value: orange
        image: someplage/hellopy
        imagePullPolicy: Always

When using a CRD kind: Rollout
the variables are not substituted

---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  labels:
    app: helloworld
  name: helloworld
spec:
  replicas: 2
  selector:
    matchLabels:
      app: helloworld
  strategy:
    blueGreen:
      activeService: helloworld-svc-active
      autoPromotionEnabled: false
      previewService: helloworld-svc-preview
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - env:
        - name: DEPLOY_VERSION
          value: $(DEPLOYMENT_COLOUR)

Expectation, variables get substituted regardless of kind

@jbrette
Copy link
Contributor

jbrette commented Jun 27, 2019

@rosscdh I do believe that you are missing a varReference configuration:

varReference:
- path: spec/template/spec/containers[]/env[]/value
  kind: Rollout

Have a look at the files used to reproduce the issue here. The output folder is here

An example for a CRD is in doc

The reason is works out of the box for deployment is here

The output with such a field is:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  labels:
    app: helloworld
  name: helloworld
spec:
  replicas: 2
  selector:
    matchLabels:
      app: helloworld
  strategy:
    blueGreen:
      activeService: helloworld-svc-active
      autoPromotionEnabled: false
      previewService: helloworld-svc-preview
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - env:
        - name: DEPLOY_VERSION
          value: orange

Also we are trying to get feedback on the usability of another PR: Automatic Creation of 'vars:' and 'varReferences:' sections

Have a look at the strategy field in the rollout input and rendered files. See variable $(Values.file1.spec.blueGreen) is automatically replaced without the need for vars: nor varReferences:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  labels:
    app: helloworld
  name: helloworld
spec:
  replicas: 2
  selector:
    matchLabels:
      app: helloworld
  strategy:
    blueGreen: $(Values.file1.spec.blueGreen)
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      containers:
      - env:
        - name: DEPLOY_VERSION
          value: $(DEPLOYMENT_COLOR)

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 25, 2019
@rosscdh
Copy link
Author

rosscdh commented Oct 11, 2019

Thanks! :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants