Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve README #108

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 56 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ It's main responsibilities **will be**:
## Prerequisites

- Golang - minimum version is 1.20.
- Kyma Custom Resource Definition present on cluster.
- Access to a k8s cluster.
- Kyma Custom Resource Definition is present on cluster.
- `kcp-system` namespace on the k8s cluster
- [k3d](https://k3d.io) to get a local cluster for testing, or run against a remote cluster.
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
- [kubebuilder](https://book.kubebuilder.io/)

## Installation

1. Clone the project.

Expand Down Expand Up @@ -50,16 +50,7 @@ make docker-build
make docker-push
```

6. Create a YAML file containing Compass Director authorization data and encode entire YAML in Base64 format:

```yaml
data:
client_id: some-id
client_secret: some-secret
tokens_endpoint: some-endpoint
```

7. Provide previously encoded file in `director.yaml` field and apply the secret on cluster where you want to run Compass Manager
6. Create a Secret containing Compass Director authorization data:

```yaml
apiVersion: v1
Expand All @@ -68,17 +59,48 @@ metadata:
name: kcp-provisioner-credentials-file
namespace: kcp-system
type: Opaque
data:
director.yaml: base64-encoded-yaml
stringData:
director.yaml: |-
data:
client_id: "some-ID"
client_secret: "some-Secret"
tokens_endpoint: "https://example.com/oauth2/token"
```

8. Deploy.
7. Deploy.

```bash
make deploy
```
## Usage

Compass Manager watches for Kyma custom resource changes. When Kyma with the Application Connector module is created, it registers Kyma runtime in the Compass Director and creates a Compass Manager Mapping with the ID assigned by the Compass Director.
It then configures the Compass runtime Secret on the client cluster.

```yaml
apiVersion: operator.kyma-project.io/v1beta2
kind: Kyma
metadata:
name: 54572f7a-b2c2-4f09-b83e-1c9f9b690e02
namespace: kcp-system
labels:
kyma-project.io/broker-plan-name: open
kyma-project.io/broker-plan-id: 925c16be-3644-457b-840b-768f69b993cf
kyma-project.io/instance-id: 1ccf9b07-1296-4052-97b5-1c38aa72ac41
kyma-project.io/shoot-name: my-shoot
kyma-project.io/subaccount-id: 170ba3ca-6905-466a-a109-f2a6efdca439
kyma-project.io/global-account-id: b07fb88f-a100-4471-bb71-8adb400a3f7f
operator.kyma-project.io/kyma-name: 54572f7a-b2c2-4f09-b83e-1c9f9b690e02
spec:
channel: regular
status:
modules:
- name: "some-module"
state: "Ready"
- name: "application-connector"
state: "Ready"
```

### Configuration Envs

| Name | Default | Description |
Expand All @@ -93,16 +115,26 @@ make deploy

> **TIP:** `CompassManagerMappings` created with dry run are labeled `kyma-project.io/cm-dry-run: Yes`

> Explain how to use the project. You can create multiple subsections (H3). Include the instructions or provide links to the related documentation.

## Development

> Add instructions on how to develop the project or example. It must be clear what to do and, for example, how to trigger the tests so that other contributors know how to make their pull requests acceptable. Include the instructions or provide links to related documentation.
To build the project, use the following command:
```shell
make build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make build only builds the Go project. The make run command runs the compass-manager locally.

````

## Troubleshooting
To run the project locally:
```shell
./bin/manager -kubeconfig <PATH TO KUBECONFIG>
```

To run the tests:
```shell
make test
```

> List potential issues and provide tips on how to avoid or solve them. To structure the content, use the following sections:
>
> - **Symptom**
> - **Cause**
> - **Remedy**
Controller is tested with the use of the [envtest](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest) package.
You can run single envtest with the following command:
```shell
make manifests generate fmt vet envtest
KUBEBUILDER_ASSETS="$PWD/$(./bin/setup-envtest use 1.26.0 --bin-dir ./bin -p path)" go test ./controllers -v -run TestAPIs -ginkgo.focus "Kyma was already registered, but doesn't have a Compass Mapping"
```
53 changes: 25 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module github.com/kyma-project/compass-manager

go 1.21
go 1.21.1

require (
github.com/99designs/gqlgen v0.17.36
github.com/google/uuid v1.5.0
github.com/kyma-incubator/compass/components/director v0.0.0-20231219143409-4fb990359ef2
github.com/kyma-project/lifecycle-manager v0.0.0-20231130130018-43561431746e
github.com/99designs/gqlgen v0.17.43
github.com/google/uuid v1.6.0
github.com/kyma-incubator/compass/components/director v0.0.0-20240205145543-05672afc5d6f
github.com/kyma-project/lifecycle-manager/api v0.0.0-20240202162014-d6c42e009612
github.com/matryer/is v1.4.1
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.18.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/vektah/gqlparser/v2 v2.5.10
github.com/vektah/gqlparser/v2 v2.5.11
github.com/vrischmann/envconfig v1.3.0
k8s.io/api v0.29.0
k8s.io/apimachinery v0.29.0
k8s.io/client-go v0.29.0
sigs.k8s.io/controller-runtime v0.16.3
k8s.io/api v0.29.1
k8s.io/apimachinery v0.29.1
k8s.io/client-go v0.29.1
sigs.k8s.io/controller-runtime v0.17.0
)

require (
Expand Down Expand Up @@ -102,13 +102,13 @@ require (
github.com/ebitengine/purego v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
github.com/go-chi/chi v4.1.2+incompatible // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
Expand All @@ -135,7 +135,7 @@ require (
github.com/google/certificate-transparency-go v1.1.7 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-containerregistry v0.17.0 // indirect
github.com/google/go-containerregistry v0.16.1 // indirect
github.com/google/go-github/v55 v55.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand All @@ -153,7 +153,7 @@ require (
github.com/in-toto/in-toto-golang v0.9.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 // indirect
github.com/jmespath/go-jmespath v0.4.1-0.20220621161143-b0104c826a24 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.2 // indirect
Expand All @@ -163,15 +163,15 @@ require (
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.4 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx/v2 v2.0.16 // indirect
github.com/lestrrat-go/jwx/v2 v2.0.19 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/letsencrypt/boulder v0.0.0-20231026200631-000cd05d5491 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mandelsoft/filepath v0.0.0-20230412200429-36b1eb66bd27 // indirect
github.com/mandelsoft/logging v0.0.0-20230905123808-7042ee3aae45 // indirect
github.com/mandelsoft/spiff v1.7.0-beta-5 // indirect
github.com/mandelsoft/vfs v0.4.0 // indirect
github.com/mandelsoft/vfs v0.0.0-20230713123140-269aa4fb1338 // indirect
github.com/marstr/guid v1.1.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
Expand Down Expand Up @@ -256,16 +256,16 @@ require (
go.uber.org/zap v1.26.0 // indirect
go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
Expand All @@ -282,8 +282,8 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a // indirect
k8s.io/apiextensions-apiserver v0.28.4 // indirect
k8s.io/component-base v0.28.4 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
k8s.io/component-base v0.29.0 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
Expand All @@ -293,7 +293,4 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace (
github.com/99designs/gqlgen => github.com/99designs/gqlgen v0.11.3
sourcegraph.com/sourcegraph/appdash-data => github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
)
replace github.com/99designs/gqlgen => github.com/99designs/gqlgen v0.11.3
Loading
Loading