This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiple deployment backends (#1130)
* Abstract out deployment Provides ability to plugin different deployment backends for use in testing. Current deployment backends supported are "docker" and "kubernetes" * remove unused import * remove unsetting of fleet server hostname as it's not needed * add deployer support to stand-alone * add elastic-agent to k8s deployment specs * Update internal/docker/docker.go Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
- Loading branch information
1 parent
7c64627
commit 55eee96
Showing
11 changed files
with
348 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: elastic-agent | ||
labels: | ||
app: elastic-agent | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: elastic-agent | ||
template: | ||
metadata: | ||
labels: | ||
app: elastic-agent | ||
spec: | ||
containers: | ||
- name: elastic-agent | ||
image: centos/systemd:latest | ||
command: ["/usr/sbin/init"] | ||
securityContext: | ||
allowPrivilegeEscalation: true | ||
runAsUser: 0 | ||
capabilities: | ||
add: ["SYS_ADMIN"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bases: | ||
- ../../base | ||
|
||
resources: | ||
- deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package deploy | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// Deployment interface for operations dealing with deployments of the bits | ||
// required for testing | ||
type Deployment interface { | ||
Add(services []string, env map[string]string) error // adds a service to deployment | ||
Bootstrap(waitCB func() error) error // will bootstrap or reuse existing cluster if kubernetes is selected | ||
Destroy() error // Teardown deployment | ||
ExecIn(service string, cmd []string) (string, error) // Execute arbitrary commands in service | ||
Inspect(service string) (*ServiceManifest, error) // inspects service | ||
Remove(services []string, env map[string]string) error // Removes services from deployment | ||
} | ||
|
||
// ServiceManifest information about a service in a deployment | ||
type ServiceManifest struct { | ||
ID string | ||
Name string | ||
Connection string // a string representing how to connect to service | ||
Hostname string | ||
} | ||
|
||
// New creates a new deployment | ||
func New(provider string) Deployment { | ||
if strings.EqualFold(provider, "docker") { | ||
return newDockerDeploy() | ||
} | ||
if strings.EqualFold(provider, "kubernetes") { | ||
return newK8sDeploy() | ||
} | ||
return nil | ||
} |
Oops, something went wrong.