-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from vshn/namespace-watch
Add namespace watcher
- Loading branch information
Showing
21 changed files
with
698 additions
and
190 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
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 |
---|---|---|
|
@@ -40,3 +40,5 @@ release: | |
github: | ||
owner: vshn | ||
name: espejo | ||
extra_files: | ||
- glob: ./espejo-crd.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
# [Espejo](https://es.wikipedia.org/wiki/Espejo) (object-syncer) | ||
|
||
[![Build](https://img.shields.io/github/workflow/status/vshn/espejo/Build)][build] | ||
![Go version](https://img.shields.io/github/go-mod/go-version/vshn/espejo) | ||
![Kubernetes version](https://img.shields.io/badge/k8s-v1.18-blue) | ||
[![Version](https://img.shields.io/github/v/release/vshn/espejo)][releases] | ||
[![GitHub downloads](https://img.shields.io/github/downloads/vshn/espejo/total)][releases] | ||
[![Docker image](https://img.shields.io/docker/pulls/vshn/espejo)][dockerhub] | ||
[![License](https://img.shields.io/github/license/vshn/espejo)][license] | ||
|
||
The espejo tool (which means 'mirror' in Spanish) syncs objects from a SyncConfig CRD to multiple namespaces. The idea is to replace OpenShift's [project templates](https://docs.openshift.com/container-platform/3.11/admin_guide/managing_projects.html#modifying-the-template-for-new-projects) with a more flexible and robust solution. | ||
|
||
## CustomResourceDefinitions | ||
The operator introduces a CRD called `SyncConfig` to configure the objects which should be synced (see [example](deploy/crds/sync_v1alpha1_syncconfig_cr.yaml)). | ||
[This `SyncConfig`](deploy/crds/sync_v1alpha1_syncconfig_cr.yaml) will create a `Service`, `Endpoints` and `NetworkPolicy` object in all namepsaces which mach the [label selector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#labelselector-v1-meta) OR one of the name selectors. | ||
|
||
The operator introduces a CRD called `SyncConfig` to configure the objects which should be synced. | ||
[This `SyncConfig`](example/syncconfig.yaml) will create a `Service`, `Endpoints` and `NetworkPolicy` object in all namepsaces which mach the [label selector](https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#labelselector-v1-meta) OR one of the name selectors. | ||
To ensure objects are deleted, set the `prune` parameter to `true` (default is `false`) | ||
|
||
### Parameters | ||
The following parameters can be used inside object definitions: | ||
|
||
Strings within object definitions can be replaced with dynamic values with parameters. The following parameters can be used: | ||
|
||
| Parameter Name | Description | | ||
|------------------------------|------------------------------| | ||
| `${PROJECT_NAME}` | Name of the target namespace | | ||
| `${PROJECT_DISPLAYNAME}` | Not implemented | | ||
| `${PROJECT_DESCRIPTION}` | Not implemented | | ||
| `${PROJECT_ADMIN_USER}` | Not implemented | | ||
| `${PROJECT_REQUESTING_USER}` | Not implemented | | ||
|
||
The parameter replacement is implemented using the [OpenShift templates pkg](https://github.com/openshift/origin/tree/release-3.11/pkg/template/templateprocessing) and therefore follows the same [rules](https://docs.openshift.com/container-platform/3.11/dev_guide/templates.html#writing-parameters). | ||
## Development | ||
|
||
## Installation | ||
The Operator is implemented with the [Operator SDK](https://github.com/operator-framework/operator-sdk) ([Installation](https://sdk.operatorframework.io/docs/installation/install-operator-sdk/)). | ||
|
||
### Build | ||
|
||
## Development | ||
The tool is implemented with the [Operator SDK](https://github.com/operator-framework/operator-sdk). | ||
|
||
1. [Install the Operator SDK](https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md#install-the-operator-sdk-cli) | ||
2. Install dependencies | ||
```bash | ||
dep ensure | ||
``` | ||
3. Run the operator | ||
```bash | ||
cd cmd/manager | ||
go run main.go | ||
``` | ||
`make build` places the binary in `bin/espejo`. Go is required. | ||
|
||
### Integration tests | ||
|
||
`make integration_test` runs unit test cases with a K8s test environment. | ||
|
||
### End-to-End tests | ||
|
||
`make e2e_test` will run [Kubernetes in Docker](https://kind.sigs.k8s.io/) to simulate a real-world K8s cluster so we can install and run the operator on it. Docker and Kubectl are required. | ||
|
||
|
||
[build]: https://github.com/vshn/espejo/actions?query=workflow%3ABuild | ||
[releases]: https://github.com/vshn/espejo/releases | ||
[license]: https://github.com/vshn/espejo/blob/master/LICENSE | ||
[dockerhub]: https://hub.docker.com/r/vshn/espejo |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.