Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
fix(providers): add docker_swarm as a provider
Browse files Browse the repository at this point in the history
Currently the documentation states that `docker_swarm` is an acceptable value for the Docker Swarm provider.
However, the code actually uses `swarm`.

This changes adds `docker_swarm` as a supported provider alias for docker swarm.

Closes #279
  • Loading branch information
acouvreur committed Apr 16, 2024
1 parent b0b7981 commit 0e6a132
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
12 changes: 8 additions & 4 deletions app/providers/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ type Provider interface {
}

func NewProvider(config config.Provider) (Provider, error) {
switch {
case config.Name == "swarm":
if err := config.IsValid(); err != nil {
return nil, err
}

switch config.Name {
case "swarm", "docker_swarm":
return NewDockerSwarmProvider()
case config.Name == "docker":
case "docker":
return NewDockerClassicProvider()
case config.Name == "kubernetes":
case "kubernetes":
return NewKubernetesProvider(config.Kubernetes)
}
return nil, fmt.Errorf("unimplemented provider %s", config.Name)
Expand Down
2 changes: 1 addition & 1 deletion config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Kubernetes struct {
Burst int `mapstructure:"BURST" yaml:"Burst" default:"10"`
}

var providers = []string{"docker", "swarm", "kubernetes"}
var providers = []string{"docker", "docker_swarm", "swarm", "kubernetes"}

func NewProviderConfig() Provider {
return Provider{
Expand Down
8 changes: 4 additions & 4 deletions docs/providers/docker_swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ In order to use the docker provider you can configure the [provider.name](TODO)

```yaml
provider:
name: docker_swarm
name: docker_swarm # or swarm
```
#### **CLI**
```bash
sablier start --provider.name=docker_swarm
sablier start --provider.name=docker_swarm # or swarm
```

#### **Environment Variable**

```bash
PROVIDER_NAME=docker_swarm
PROVIDER_NAME=docker_swarm # or swarm
```

<!-- tabs:end -->
Expand All @@ -38,7 +38,7 @@ services:
image: acouvreur/sablier:1.6.0
command:
- start
- --provider.name=docker_swarm
- --provider.name=docker_swarm # or swarm
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
```
Expand Down
16 changes: 8 additions & 8 deletions docs/providers/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ A Provider typically have the following capabilities:

## Available providers

| Provider | Name | Details |
| --------------------------------------- | -------------- | ----------------------------------------------------------- |
| [Docker](/providers/docker) | `docker` | Stop and start **containers** on demand |
| [Docker Swarm](/providers/docker_swarm) | `docker_swarm` | Scale down to zero and up **services** on demand |
| [Kubernetes](/providers/kubernetes) | `kubernetes` | Scale down and up **deployments** and **statefulsets** on demand |
| [Podman](/providers/podman) | `podman` | [See #70](https://github.com/acouvreur/sablier/issues/70) |
| [ECS](/providers/ec2) | `ecs` | [See #116](https://github.com/acouvreur/sablier/issues/116) |
| [Systemd](/providers/systemd) | `systemd` | [See #148](https://github.com/acouvreur/sablier/issues/148) |
| Provider | Name | Details |
| --------------------------------------- | ------------------------- | ---------------------------------------------------------------- |
| [Docker](/providers/docker) | `docker` | Stop and start **containers** on demand |
| [Docker Swarm](/providers/docker_swarm) | `docker_swarm` or `swarm` | Scale down to zero and up **services** on demand |
| [Kubernetes](/providers/kubernetes) | `kubernetes` | Scale down and up **deployments** and **statefulsets** on demand |
| [Podman](/providers/podman) | `podman` | [See #70](https://github.com/acouvreur/sablier/issues/70) |
| [ECS](/providers/ec2) | `ecs` | [See #116](https://github.com/acouvreur/sablier/issues/116) |
| [Systemd](/providers/systemd) | `systemd` | [See #148](https://github.com/acouvreur/sablier/issues/148) |

*Your Provider is not on the list? [Open an issue to request the missing provider here!](https://github.com/acouvreur/sablier/issues/new?assignees=&labels=enhancement%2C+provider&projects=&template=instance-provider-request.md&title=Add+%60%5BPROVIDER%5D%60+provider)*

Expand Down

0 comments on commit 0e6a132

Please sign in to comment.