Skip to content

Commit 60283c6

Browse files
authored
Merge pull request #3440 from thaJeztah/drop_kube_follow_up
update docs, and remove some unused code related to "compose on kubernetes" deprecation
2 parents 531810b + 467e650 commit 60283c6

19 files changed

Lines changed: 65 additions & 147 deletions

File tree

cli/command/context/export.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
// ExportOptions are the options used for exporting a context
1616
type ExportOptions struct {
17-
Kubeconfig bool
1817
ContextName string
1918
Dest string
2019
}
@@ -23,26 +22,22 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command {
2322
opts := &ExportOptions{}
2423
cmd := &cobra.Command{
2524
Use: "export [OPTIONS] CONTEXT [FILE|-]",
26-
Short: "Export a context to a tar or kubeconfig file",
25+
Short: "Export a context to a tar archive FILE or a tar stream on STDOUT.",
2726
Args: cli.RequiresRangeArgs(1, 2),
2827
RunE: func(cmd *cobra.Command, args []string) error {
2928
opts.ContextName = args[0]
3029
if len(args) == 2 {
3130
opts.Dest = args[1]
3231
} else {
33-
opts.Dest = opts.ContextName
34-
if opts.Kubeconfig {
35-
opts.Dest += ".kubeconfig"
36-
} else {
37-
opts.Dest += ".dockercontext"
38-
}
32+
opts.Dest = opts.ContextName + ".dockercontext"
3933
}
4034
return RunExport(dockerCli, opts)
4135
},
4236
}
4337

4438
flags := cmd.Flags()
45-
flags.BoolVar(&opts.Kubeconfig, "kubeconfig", false, "Export as a kubeconfig file")
39+
flags.Bool("kubeconfig", false, "Export as a kubeconfig file")
40+
flags.MarkDeprecated("kubeconfig", "option will be ignored")
4641
flags.SetAnnotation("kubeconfig", "kubernetes", nil)
4742
flags.SetAnnotation("kubeconfig", "deprecated", nil)
4843
return cmd

cli/command/defaultcontextstore_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ func TestDefaultContextInitializer(t *testing.T) {
6060
cli, err := NewDockerCli()
6161
assert.NilError(t, err)
6262
defer env.Patch(t, "DOCKER_HOST", "ssh://someswarmserver")()
63-
cli.configFile = &configfile.ConfigFile{
64-
StackOrchestrator: "swarm",
65-
}
63+
cli.configFile = &configfile.ConfigFile{}
6664
ctx, err := ResolveDefaultContext(&cliflags.CommonOptions{
6765
TLS: true,
6866
TLSOptions: &tlsconfig.Options{

cli/command/formatter/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ func (c *clientContextContext) DockerEndpoint() string {
7575
return c.c.DockerEndpoint
7676
}
7777

78+
// KubernetesEndpoint returns the kubernetes endpoint.
79+
//
80+
// Deprecated: support for kubernetes endpoints in contexts has been removed, and this formatting option will always be empty.
7881
func (c *clientContextContext) KubernetesEndpoint() string {
7982
return ""
8083
}

cli/command/stack/swarm/common.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ func getStackFilter(namespace string) filters.Args {
1717
return filter
1818
}
1919

20-
func getStackServiceFilter(namespace string) filters.Args {
21-
return getStackFilter(namespace)
22-
}
23-
2420
func getStackFilterFromOpt(namespace string, opt opts.FilterOpt) filters.Args {
2521
filter := opt.Value()
2622
filter.Add("label", convert.LabelNamespace+"="+namespace)
@@ -34,7 +30,7 @@ func getAllStacksFilter() filters.Args {
3430
}
3531

3632
func getStackServices(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Service, error) {
37-
return apiclient.ServiceList(ctx, types.ServiceListOptions{Filters: getStackServiceFilter(namespace)})
33+
return apiclient.ServiceList(ctx, types.ServiceListOptions{Filters: getStackFilter(namespace)})
3834
}
3935

4036
func getStackNetworks(ctx context.Context, apiclient client.APIClient, namespace string) ([]types.NetworkResource, error) {

cli/command/system/version.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ func runVersion(dockerCli command.Cli, opts *versionOptions) error {
128128
}
129129

130130
// TODO print error if kubernetes is used?
131-
// orchestrator, err := dockerCli.StackOrchestrator("")
132-
// if err != nil {
133-
// return cli.StatusError{StatusCode: 64, Status: err.Error()}
134-
// }
135-
// if orchestrator.HasKubernetes() {
136-
// // TODO print error if kubernetes is used?
137-
// }
138131

139132
vd := versionInfo{
140133
Client: clientVersion{

cli/config/configfile/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type ConfigFile struct {
4545
PruneFilters []string `json:"pruneFilters,omitempty"`
4646
Proxies map[string]ProxyConfig `json:"proxies,omitempty"`
4747
Experimental string `json:"experimental,omitempty"`
48-
StackOrchestrator string `json:"stackOrchestrator,omitempty"`
48+
StackOrchestrator string `json:"stackOrchestrator,omitempty"` // Deprecated: swarm is now the default orchestrator, and this option is ignored.
4949
CurrentContext string `json:"currentContext,omitempty"`
5050
CLIPluginsExtraDirs []string `json:"cliPluginsExtraDirs,omitempty"`
5151
Plugins map[string]map[string]string `json:"plugins,omitempty"`

docs/deprecated.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,31 @@ to decrypt the private key, and store it un-encrypted to continue using it.
197197
### Kubernetes stack and context support
198198

199199
**Deprecated in Release: v20.10**
200+
**Removed in Release: v21.xx**
201+
202+
Following the deprecation of [Compose on Kubernetes](https://github.com/docker/compose-on-kubernetes),
203+
support for Kubernetes in the `stack` and `context` commands has been removed from
204+
the cli, and options related to this functionality are now either ignored, or may
205+
produce an error.
206+
207+
The following command-line flags are removed from the `docker context` subcommands:
208+
209+
- `--default-stack-orchestrator` - swarm is now the only (and default) orchestrator for stacks.
210+
- `--kubernetes` - the kubernetes endpoint can no longer be stored in `docker context`.
211+
- `--kubeconfig` - exporting a context as a kubeconfig file is no longer supported.
212+
213+
The output produced by the `docker context inspect` subcommand no longer contains
214+
information about `StackOrchestrator` and `Kubernetes` endpoints for new contexts.
215+
216+
The following command-line flags are removed from the `docker stack` subcommands:
217+
218+
- `--kubeconfig` - using a kubeconfig file as context is no longer supported.
219+
- `--namespace` - configuring the kubernetes namespace for stacks is no longer supported.
220+
- `--orchestrator` - swarm is now the only (and default) orchestrator for stacks.
200221

201-
Following the deprecation of [Compose on Kubernetes](https://github.com/docker/compose-on-kubernetes), support for
202-
Kubernetes in the `stack` and `context` commands in the docker CLI is now marked as deprecated as well.
222+
The `DOCKER_STACK_ORCHESTRATOR`, `DOCKER_ORCHESTRATOR`, and `KUBECONFIG` environment
223+
variables, as well as the `stackOrchestrator` option in the `~/.docker/config.json`
224+
cli configuration file are no longer used, and ignored.
203225

204226
### Pulling images from non-compliant image registries
205227

docs/reference/commandline/cli.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,17 @@ the [installation](https://docs.docker.com/install/) instructions for your opera
6565
The following list of environment variables are supported by the `docker` command
6666
line:
6767

68-
| Variable | Description |
69-
|:------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
70-
| `DOCKER_API_VERSION` | Override the negotiated API version to use for debugging (e.g. `1.19`) |
68+
| Variable | Description |
69+
|:------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|
70+
| `DOCKER_API_VERSION` | Override the negotiated API version to use for debugging (e.g. `1.19`) |
7171
| `DOCKER_CERT_PATH` | Location of your authentication keys. This variable is used both by the `docker` CLI and the [`dockerd` daemon](dockerd.md) |
72-
| `DOCKER_CONFIG` | The location of your client configuration files. |
73-
| `DOCKER_CONTENT_TRUST_SERVER` | The URL of the Notary server to use. Defaults to the same URL as the registry. |
74-
| `DOCKER_CONTENT_TRUST` | When set Docker uses notary to sign and verify images. Equates to `--disable-content-trust=false` for build, create, pull, push, run. |
75-
| `DOCKER_CONTEXT` | Name of the `docker context` to use (overrides `DOCKER_HOST` env var and default context set with `docker context use`) |
76-
| `DOCKER_DEFAULT_PLATFORM` | Default platform for commands that take the `--platform` flag. |
72+
| `DOCKER_CONFIG` | The location of your client configuration files. |
73+
| `DOCKER_CONTENT_TRUST_SERVER` | The URL of the Notary server to use. Defaults to the same URL as the registry. |
74+
| `DOCKER_CONTENT_TRUST` | When set Docker uses notary to sign and verify images. Equates to `--disable-content-trust=false` for build, create, pull, push, run. |
75+
| `DOCKER_CONTEXT` | Name of the `docker context` to use (overrides `DOCKER_HOST` env var and default context set with `docker context use`) |
76+
| `DOCKER_DEFAULT_PLATFORM` | Default platform for commands that take the `--platform` flag. |
7777
| `DOCKER_HIDE_LEGACY_COMMANDS` | When set, Docker hides "legacy" top-level commands (such as `docker rm`, and `docker pull`) in `docker help` output, and only `Management commands` per object-type (e.g., `docker container`) are printed. This may become the default in a future release, at which point this environment-variable is removed. |
78-
| `DOCKER_HOST` | Daemon socket to connect to. |
79-
| `DOCKER_STACK_ORCHESTRATOR` | Configure the default orchestrator to use when using `docker stack` management commands. |
78+
| `DOCKER_HOST` | Daemon socket to connect to. |
8079
| `DOCKER_TLS_VERIFY` | When set Docker uses TLS and verifies the remote. This variable is used both by the `docker` CLI and the [`dockerd` daemon](dockerd.md) |
8180
| `BUILDKIT_PROGRESS` | Set type of progress output (`auto`, `plain`, `tty`) when [building](build.md) with [BuildKit backend](../builder.md#buildkit). Use plain to show container output (default `auto`). |
8281

@@ -192,14 +191,6 @@ for a specific registry. For more information, see the
192191
[**Credential helpers** section in the `docker login` documentation](login.md#credential-helpers)
193192

194193

195-
### Orchestrator options for docker stacks
196-
197-
The property `stackOrchestrator` specifies the default orchestrator to use when
198-
running `docker stack` management commands. Valid values are `"swarm"`,
199-
`"kubernetes"`, and `"all"`. This property can be overridden with the
200-
`DOCKER_STACK_ORCHESTRATOR` environment variable, or the `--orchestrator` flag.
201-
202-
203194
### Automatic proxy configuration for containers
204195

205196
The property `proxies` specifies proxy environment variables to be automatically
@@ -282,7 +273,6 @@ various fields:
282273
"awesomereg.example.org": "hip-star",
283274
"unicorn.example.com": "vcbait"
284275
},
285-
"stackOrchestrator": "kubernetes",
286276
"plugins": {
287277
"plugin1": {
288278
"option": "value"

docs/reference/commandline/context_create.md

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,16 @@ cert Path to TLS certificate file
2121
key Path to TLS key file
2222
skip-tls-verify Skip TLS certificate validation
2323

24-
Kubernetes endpoint config:
25-
26-
NAME DESCRIPTION
27-
from Copy Kubernetes endpoint configuration from an existing context
28-
config-file Path to a Kubernetes config file
29-
context-override Overrides the context set in the kubernetes config file
30-
namespace-override Overrides the namespace set in the kubernetes config file
31-
3224
Example:
3325

3426
$ docker context create my-context \
3527
--description "some description" \
3628
--docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file"
3729

3830
Options:
39-
--default-stack-orchestrator string Default orchestrator for
40-
stack operations to use with
41-
this context
42-
(swarm|kubernetes|all)
4331
--description string Description of the context
4432
--docker stringToString set the docker endpoint
4533
(default [])
46-
--kubernetes stringToString set the kubernetes endpoint
47-
(default [])
4834
--from string Create the context from an existing context
4935
```
5036

@@ -55,17 +41,15 @@ configuration to connect to different clusters or single nodes.
5541

5642
## Examples
5743

58-
### Create a context with a docker and kubernetes endpoint
44+
### Create a context with a docker endpoint
5945

6046
To create a context from scratch provide the docker and, if required,
6147
kubernetes options. The example below creates the context `my-context`
62-
with a docker endpoint of `/var/run/docker.sock` and a kubernetes configuration
63-
sourced from the file `/home/me/my-kube-config`:
48+
with a docker endpoint of `/var/run/docker.sock`:
6449

6550
```console
6651
$ docker context create \
6752
--docker host=unix:///var/run/docker.sock \
68-
--kubernetes config-file=/home/me/my-kube-config \
6953
my-context
7054
```
7155

@@ -92,32 +76,18 @@ $ source my-setup-script.sh
9276
$ docker context create my-context
9377
```
9478

95-
To source only the `docker` endpoint configuration from an existing context
79+
To source the `docker` endpoint configuration from an existing context
9680
use the `--docker from=<context-name>` option. The example below creates a
9781
new context named `my-context` using the docker endpoint configuration from
98-
the existing context `existing-context` and a kubernetes configuration sourced
99-
from the file `/home/me/my-kube-config`:
82+
the existing context `existing-context`:
10083

10184
```console
10285
$ docker context create \
10386
--docker from=existing-context \
104-
--kubernetes config-file=/home/me/my-kube-config \
105-
my-context
106-
```
107-
108-
To source only the `kubernetes` configuration from an existing context use the
109-
`--kubernetes from=<context-name>` option. The example below creates a new
110-
context named `my-context` using the kuberentes configuration from the existing
111-
context `existing-context` and a docker endpoint of `/var/run/docker.sock`:
112-
113-
```console
114-
$ docker context create \
115-
--docker host=unix:///var/run/docker.sock \
116-
--kubernetes from=existing-context \
11787
my-context
11888
```
11989

120-
Docker and Kubernetes endpoints configurations, as well as default stack
121-
orchestrator and description can be modified with `docker context update`.
90+
Docker endpoints configurations, as well as the description can be modified with
91+
`docker context update`.
12292

12393
Refer to the [`docker context update` reference](context_update.md) for details.

docs/reference/commandline/context_export.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ keywords: "context, export"
99
```markdown
1010
Usage: docker context export [OPTIONS] CONTEXT [FILE|-]
1111

12-
Export a context to a tar or kubeconfig file
13-
14-
Options:
15-
--kubeconfig Export as a kubeconfig file
12+
Export a context to a tar archive FILE or a tar stream on STDOUT.
1613
```
1714

1815
## Description
1916

20-
Exports a context in a file that can then be used with `docker context import`
21-
(or with `kubectl` if `--kubeconfig` is set). Default output filename is
22-
`<CONTEXT>.dockercontext`, or `<CONTEXT>.kubeconfig` if `--kubeconfig` is set.
23-
To export to `STDOUT`, you can run `docker context export my-context -`.
17+
Exports a context to a file that can then be used with `docker context import`.
18+
19+
The default output filename is `<CONTEXT>.dockercontext`. To export to `STDOUT`,
20+
use `-` as filename, for example:
21+
22+
```console
23+
$ docker context export my-context -
24+
```

0 commit comments

Comments
 (0)