github devspace-sh/devspace v4.0.0

latest releases: v6.3.13, v6.3.12, v6.3.11...
5 years ago

*** BREAKING CHANGES ***

Removed devspace-configs.yaml

  1. Profiles instead of multiple configs: We reworked how multiple configs in devspace are handled because we felt that it was currently too complicated and inflexible. Instead of creating a separate file besides devspace.yaml, you can now define different 'profiles' directly in the devspace.yaml instead of having different configs (see profiles documentation).
  2. Config patches instead of overrides: We removed the config override mechanism. Instead of overriding the config in the old way, you are now able to either completely replace parts of the config (the top level keys like images,deployments etc.) or patch specific fields in the config by providing 1) a jsonpath or xpath to the config option, 2) an operation (replace, add, remove) and 3) a value. We believe this gives the user more power of how values can be overridden (especially for alterations of arrays). At the same time, patches seem easier to use and understand than the previous override system although they might require more lines of config (see patches documentation).

This is a basic example how a devspace.yaml with multiple profiles and patches can look like:

version: v1beta3
images:
  test:
    image: myimage
deployments:
- name: test
  component:
    containers:
    - image: myimage
profiles:
# A profile name
- name: myprofile
# Replacement parts which will completely replace a part of the config
  replace:
    # images: {} Will replace images completely with an empty configuration
    # deployments: {}
    dev: 
      ports:
      - imageName: test
        forward:
        - port: 8080
# With patches you have to option to replace, add or remove certain parts of the configuration
  patches:
  # Will remove the image test
  - op: remove
    path: images.test
  # Replaces the image name in the deployment with nginx
  - op: replace
    path: deployments[0].component.containers[0].image
    value: nginx 
  1. Config variables are now also defined directly in the devspace.yaml. DevSpace will only ask the variables in the currently used profile which means you can define all config variables for all profiles in one place (see variables documentation):
version: v1beta3
deployments:
  # This will be filled with a question on `devspace deploy` or `devspace dev`, alternatevly you could also set the
  # environment variable SELECT to avoid the question and fill it automatically
  - name: ${SELECT}
    component:
      containers:
        - image: ${IMAGE}
        - image: nginx:${SOME_ENV_VAR}
vars:
- name: SELECT
  question: Please choose a deployment name
  options:
    - deployment-1
    - deployment-2
- name: IMAGE
  question: Please specify an image name, or press enter to use 'nginx'
  default: nginx
  source: input
  validationPattern: ^n.*$
  validationMessage: Only image names that start with a 'n' are allowed
- name: UNUSED
  question: This variable is not asked because it is not used in the config above

Other breaking changes

  • Removed the config option cluster.kubeContext and cluster.namespace since this caused some confusion which kube-context and namespace were used during deployment. Instead DevSpace will now always use the current kube-context (or the context passed via the --kube-context flag) and remember the most recently used kube-context and namespace. If the user starts the deployment process using devspace dev or devspace deploy, DevSpace will print a warning if the current kube-context is different than the previously used one and wait a couple of seconds to give the user the chance to abort the command and prevent that the user accidentally deploys to the wrong cluster or namespace.
  • Removed devspace install since this command is no longer needed
  • Renamed devspace use/list config(s) into devspace use/list profile(s)
  • Removed devspace add/list/remove selector
  • devspace dev will not rebuild images if there were changes in the image context path
  • The shortcut flag for --pick -p was removed. -p is not used as --profile shortcut flag
  • The config option dev.overrideImages.dockerfile and dev.overrideImages.context were removed. dev.overrideImages was renamed to dev.interactive. The config will be automatically converted via devspace update config

*** New Features ***

  • New config version v1beta3 (run devspace update config to convert your current config automatically)
  • Custom commands: The idea of custom commands is that the more experienced developers on your team define a set of useful commands and store them in the devspace.yaml, commit and push this config to the code repository via git and then, let other team mates run them without having to remember all the details or having to read through endless pages of internal workflow documentation (see custom commands documentation).

Example:

# File: devspace.yaml
version: v1beta3
images:
  default:
    image: john/backend
commands:
- name: debug-backend
  command: "devspace dev -i --profile=debug-backend"
profiles:
- name: debug-backend
  patches:
  - op: replace
    path: images.default.entrypoint
    value: ["npm", "run", "debug"]

You can execute custom commands with: devspace run debug-backend

  • There are now a bunch of global flags that can be used for every command:
--debug - Prints the stack trace if an error occurs
--silent - Run in silent mode and prevents any devspace log output except fatals & panics
--no-warn - If true does not show any warning when deploying into a different namespace or kube-context than before

--profile - The devspace profile to use (if there is any)
--namespace - The kubernetes namespace to use
--kube-context - The kubernetes context to use
--var - Variables to override during execution (e.g. --var=MYVAR=MYVALUE)
  • Profiles: you are now able to specify multiple profiles in devspace.yaml and switch between those profiles via the devspace use profile command or the --profile / -p flag. See multiple profiles for an example how to use profiles.
  • Config Patches: you are now able to specify config patches in profiles to override certain parts of the config (see multiple profiles for an example). This makes it easy to reuse most of the config and exchange only small parts.
  • devspace dev is now able to log multiple pods to the console. To enable this behavior by default strip the config option dev.interactive from your devspace.yaml.
  • Interactive mode: when using devspace dev -i you can choose an image which should be started in interactive mode. This means that the image entrypoint will be overriden by a sleep command and a terminal to that image will be openend. Interactive mode can be configured as default to mimic old behaviour with the config option dev.interactive.enabled and dev.interactive.images. dev.terminal was moved to dev.interactive.terminal (see interactive mode documentation).
  • New config option dev.sync[*].imageName and dev.sync[*].imageName as an alternative to labelSelector. With imageName DevSpace will automatically find the pods in which the image is used and start sync or port-forwarding. For a working example take a look at quickstart
  • New config option dev.open: you can DevSpace now automatically open the browser to a certain webpage like http://localhost:8080 (see auto-open documentation).
  • New command devspace use context to switch the current kube-context and devspace use namespace to switch the current configured default namespace in the kube-context
  • New command devspace attach that allows users to attach to a specific pod and container (behaves like kubectl attach but has a picker to select pods)
  • New flag --verbose-dependencies in devspace dev/deploy/purge/build to print the output of dependency deployment
  • New config option dev.logs: you can specify if DevSpace should display image logs on devspace dev and what images should be logged (see multi-container log streaming documentation).
  • New config option images[*].entrypoint & images[*].cmd which allows you to specify an entrypoint and cmd that will be used during deployment (also works with multi stage build)
  • New config option deployments[*].kubectl.replaceImageTags, deployments[*].helm.replaceImageTags & deployments[*].component.options.replaceImageTags to prevent automatic replacement of image tags for deployments

*** Changes & Fixes ***

  • Renamed config option dependencies[*].config into dependencies[*].profile
  • Removed config option dev.selectors (will be converted automatically), use imageName where possible instead
  • Removed config options .selector and --selector flags, use imageName where possible instead
  • Fixed issue in dependency resolving where dependency variables were not correctly used
  • Show warning if current built tag is the same as last built tag
  • Overriding image entrypoints now also works with multi staged builds
  • DevSpace now prefers the git cli for git dependencies if the cli is installed locally

*** What do you need to do? ***

  • Please run devspace update config to automatically update your config to the newest version.
  • devspace dev is now able to log multiple pods to the console (see multi-container log streaming documentation). To enable this behavior by default strip the config option dev.interactive from your devspace.yaml.
  • As log streaming has become default option for devspace dev, you can still return to the old behavior (overriding the entrypoint with sleep and opening an interactive terminal) using devspace dev -i using the -i / --interactive flag (see interactive mode documentation)

Don't miss a new devspace release

NewReleases is sending notifications on new releases.