Skip to content

Cannot remove environment variables via cf push #433

@bbtong

Description

@bbtong

Summary

Removing environment variables from a deployed CF app doesn't work. A cf delete and repush is necessary to remove outdated environemnt variables entirely.

We spoke to some teams and it seems to be a known issue with the platform, and have been encouraged to file a bug report here.

Expected Result

Given this Concourse task that uses the "cf" concourse resource:

# logstash2datadog
  - name: deploy-logstash2datadog
    build_logs_to_retain: 25
    serial: true
    plan:
    - get: logstash2datadog
      trigger: true
    - put: deploy-to-jynx-pcf-production
      tags: [sf-vsphere]
      params:
        manifest: logstash2datadog/manifest.yml
        path: logstash2datadog
        environment_variables:
          DATADOG_API_KEY: key
          KIBANA_PASSWORD: password 							# We remove this
          KIBANA_USERNAME: username 							# We remove this
          KIBANA_HOSTS:    host 								# We remove this
          KIBANA_DEPLOYMENT_NAMES: url							# We remove this
          GRAYLOG_PASSWORDS: password
          GRAYLOG_USERNAMES: username
          GRAYLOG_HOSTS: host
          GRAYLOG_DEPLOYMENT_NAMES: names

If we remove all KIBANA_ instances in this scenario above then we push this to a CF-deployed app, we expect the environment variables related to KIBANA to be removed in the deployment too.

Thus, a query for environment variables we expect would return:


...
DATADOG_API_KEY: key
GRAYLOG_PASSWORDS: password
GRAYLOG_USERNAMES: username
GRAYLOG_HOSTS: host
GRAYLOG_DEPLOYMENT_NAMES: names
...

Actual Result

Unlike the expected results above where our deleted environment variables are likewise removed in the CF-deployed app, it seems that Diego forever keeps old environment variables somewhere in memory / database and will not remove them without a cf delete and repush. Possibly, you could overwrite the environment variable values with empty strings; however, this does not equal a proper removal of the variables still.

Our actual result from an environment variable query looks like:


...
DATADOG_API_KEY: key
KIBANA_PASSWORD: password 
KIBANA_USERNAME: username 
KIBANA_HOSTS:    host
KIBANA_DEPLOYMENT_NAMES: url
GRAYLOG_PASSWORDS: password
GRAYLOG_USERNAMES: username
GRAYLOG_HOSTS: host
GRAYLOG_DEPLOYMENT_NAMES: names
...

Context

The affected app is running on PCF 2.5.2 on vSphere.

Steps to Reproduce

  • Push an CF app with some environment variables
  • Remove an env var and re-push the app
  • Notice that the env var you removed is still in the output from cf env $APP_NAME

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions