Resource Service :: The New Configuration Service
The resource-service is a Keptn core component used to manage resources for Keptn project-related entities,
i.e., project, stage, and service. The entity model is shown below. To store the resources with version control, a Git
repository is used that is mounted as emptyDir volume. Besides, this service has functionality to upload the Git repository
to any Git-based service such as GitLab, GitHub, Bitbucket, etc.
The resource-service has been designed from the ground up to work with a remote upstream.
Hence, Keptn projects must always have a Git repository configured. Furthermore, the resource-service does not have the requirement of using uninitialized repositories.
These changes allow the service implementation to be more flexible and faster in retrieving and storing Keptn data comparing it to the resource-service.
Entity model
------------ ------------ ------------
| | 1 | | 1 | |
| Project |----------| Stage |----------| Service |
| | * | | * | |
------------ ------------ ------------
1 \ 1 \ 1 \
\ * \ * \ *
------------ ------------ ------------
| | | | | |
| Resource | | Resource | | Resource |
| | | | | |
------------ ------------ ------------
Installation
As of Keptn 0.16.0, the resource-service
is installed by default, and replaces the old configuration-service
.
Deploy it directly into your Kubernetes cluster
To deploy the current version of the resource-service in your Keptn Kubernetes cluster,
use the file deploy/service.yaml
from this repository and apply it.
kubectl apply -f deploy/service.yaml
Delete it from your Kubernetes cluster
To delete a deployed resource-service, use the file deploy/service.yaml
from this repository
and delete the Kubernetes resources:
kubectl delete -f deploy/service.yaml
Migration from the configuration-service
Before migrating from the configuration-service to the resource-service it is recommended to (i) attach an upstream to your Keptn projects and (ii) do a backup. If you set an upstream for all your Keptn projects, no additional steps are required.
Suppose you need the additional features provided by the resource-service, such as HTTPS/SSH or Proxy, to configure your Keptn project with an upstream. In that case,
you can also deploy the resource-service and configure the Git repositories later. For this, a backup is necessary.
- Back up of the configuration-service.
- For each Keptn project in the backup data open a shell in that directory and make sure the
Git
CLI is available.
- Attach your upstream to the Keptn project via the Git CLI with
git remote add origin <remoteURL>
, where <remoteURL>
is your Git upstream.
- Run
git push --all
to synchronize your backup with your Git repository.
- Install Keptn with the resource-service enabled
- Navigate to your Bridge installation and configure an upstream to the Keptn projects.
Executing unit tests locally
To execute unit tests of this service locally, libgit2 1.3.0
needs to be installed. This library needs to be built and installed using cmake
:
git clone --branch v1.3.0 --single-branch https://github.com/libgit2/libgit2.git
cd libgit2
mkdir build && cd build
cmake ..
sudo cmake --build . --target install
If you encounter an error saying the the libgit2.so
shared library cannot be located, you might need to add the location of the
libgit2.so
library to the LD_LIBRARY_PATH
env var. In the following example, the library is located in /usr/local/lib
:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/ go test ./...