Skip to content

Commit

Permalink
Merge branch 'release-1.2' into nifi-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsankesara committed Dec 4, 2024
2 parents af02efb + d93cf9a commit 49b11de
Show file tree
Hide file tree
Showing 18 changed files with 59,610 additions and 23,263 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
install:
strategy:
matrix:
K3S_VERSION: ["v1.27.14+k3s1", "v1.28.10+k3s1", "v1.29.5+k3s1", "v1.30.1+k3s1"]
K3S_VERSION: ["v1.30.6+k3s1", "v1.31.2+k3s1"]
exclude:
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.27.14+k3s1' }}
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.28.10+k3s1' }}
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.29.5+k3s1' }}
- K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.30.6+k3s1' }}
runs-on: self-hosted
steps:
- name: Cleanup
Expand All @@ -33,10 +31,10 @@ jobs:

- name: Install dependencies
env:
HELM_VERSION: "v3.11.3"
HELM_DIFF_VERSION: "3.6.0"
HELMFILE_VERSION: "v0.152.0"
YQ_VERSION: "v4.33.3"
HELM_VERSION: "v3.16.3"
HELM_DIFF_VERSION: "3.9.12"
HELMFILE_VERSION: "v0.169.1"
YQ_VERSION: "v4.44.3"
run: |
./.github/ci_config/bin/install-dependencies
Expand Down
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,41 @@ Then you can make a new fork or branch and make your changes there and after you
If you're changing an existing code, make sure that it is either backwards compatible or the documentation shows a clear path of applying the changes without breaking the existing installations.


#### Development automation

This repository can be used for development automation for instance on a k3s or k3d (dockerized k3s) cluster. The example below shows how to deploy on a k3d cluster.

1. Install k3d (see [here](https://github.com/k3d-io/k3d#get))
2. Create a k3d cluster that is configured to run RADAR-base

```shell
k3d cluster create my-test-cluster --port '80:80@loadbalancer' --config=.github/ci_config/k3d-config.yaml
```

This example creates a cluster named `my-test-cluster` with a load balancer that forwards local port 80 to the cluster. The
configuration file `.github/ci_config/k3d-config.yaml` is used to configure the cluster. This cluster will be accessible
in _kubectl_ with context name _k3d-my-test-cluster_.

3. Initialize the RADAR-Kubernetes deployment. Run:

```shell
./bin/init
```

4. In file _etc/production.yaml_:

- set _kubeContext_ to _k3d-my-test-cluster_
- set _dev_deployment_ to _true_
- (optional) enable/disable components as needed with the __install_ fields

5. Install RADAR-Kubernetes on the k3d cluster:

```shell
helmfile sync
```

When installation is complete, you can access the applications at `http://localhost`.

#### Adding a new component to RADAR-Kuberentes
In order to add a new component you first need to add its helm chart to [radar-helm-charts)](https://github.com/RADAR-base/radar-helm-charts) repository. Refer to contributing guidelines of that repository for more information. Once the chart has been added you need to:
- Add a helmfile for it in `helmfile.d` directory. The helmfiles are seperated in a modular way in order to avoid having a huge file and also installing certain components in order. Have a look at the current helmfiles and if your component is related to one of them add your component in that file other file create a new file. If your component is a dependency to other components, like Kafka or PostgreSQL prefix the file name with a smaller number so it will be installed first, but if it's a standalone component, the prefix number can be higher.
Expand Down
187 changes: 7 additions & 180 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ The Kubernetes stack of RADAR-base platform.
- [Usage and accessing the applications](#usage-and-accessing-the-applications)
- [Service-specific documentation](#service-specific-documentation)
- [Troubleshooting](#troubleshooting)
- [Upgrade instructions](#upgrade-instructions)
* [Upgrade to RADAR-Kubernetes version 1.1.x](#upgrade-to-radar-kubernetes-version-11x)
* [Upgrade to RADAR-Kubernetes version 1.0.0](#upgrade-to-radar-kubernetes-version-100)
- [Volume expansion](#volume-expansion)
- [Uninstall](#uninstall)
- [Update charts](#update-charts)
- [Development automation](#development-automation)
- [Feedback and Contributions](#feedback-and-contributions)

<!-- TOC end -->
Expand All @@ -62,13 +58,13 @@ While this documentation will provide guidance for installing and configuring RA
Currently RADAR-Kubernetes is tested and supported on following component versions:
| Component | Version |
| ---- | ------- |
| Kubernetes | v1.27 to v1.30 |
| K3s | v1.27.14+k3s1 to v1.30.1+k3s1 |
| Kubectl | v1.27 to v1.30 |
| Helm | v3.11.3 |
| Helm diff | v3.6.0 |
| Helmfile | v0.152.0 |
| YQ | v4.33.3 |
| Kubernetes | v1.30 and v1.31 |
| K3s | v1.30.6+k3s1 and v1.31.2+k3s1 |
| Kubectl | v1.30 and v1.31 |
| Helm | v3.16.3 |
| Helm diff | 3.9.12 |
| Helmfile | v0.169.1 |
| YQ | v4.44.3 |

It's possible to install RADAR-Kubernetes on different version of tools as well, but you might encounter compatibility issues. Make sure that `kubectl` version matches or it's higher than Kubernetes or K3s version that you're using. For other tools such as Git or Java the version, as long as it's not very old, it's not very impactful.

Expand Down Expand Up @@ -385,139 +381,6 @@ Once you've solved the issue, you need to run the `helmfile sync` command again.
If you have enabled monitoring you should also check **Prometheus** to see if there are any alerts. In next section there is a guide on how to connect to Prometheus.


## Upgrade instructions

Run the following instructions to upgrade an existing RADAR-Kubernetes cluster.

| :exclamation: Note |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Upgrading the major version of a PostgreSQL image is not supported. If necessary, we propose to use a `pg_dump` to dump the current data and a `pg_restore` to restore that data on a newer version. Please find instructions for this elsewhere. |

### Upgrade to RADAR-Kubernetes version >=1.1.4

In `production.yaml` rename sections:

| Old Name | New Name |
|--------------------------|------------------------------------|
| radar_jdbc_connector | radar_jdbc_connector_grafana |
| radar_jdbc_connector_agg | radar_jdbc_connector_realtime_dashboard |

### Upgrade to RADAR-Kubernetes version 1.1.x
Before running the upgrade make sure to copy `environments.yaml.tmpl` to `environments.yaml` and if you've previously changed `environments.yaml` apply the changes again. This is necessary due to addition of `helmDefaults` and `repositories` configurations to this file.

### Upgrade to RADAR-Kubernetes version 1.0.0

Before running the upgrade, compare `etc/base.yaml` and `etc/base.yaml.gotmpl` with their `production.yaml` counterparts. Please ensure that all properties in `etc/base.yaml` are overridden in your `production.yaml` or that the `base.yaml` default value is fine, in which case no value needs to be provided in `production.yaml`.

To upgrade the initial services, run

```shell
kubectl delete -n monitoring deployments kube-prometheus-stack-kube-state-metrics
helm -n graylog uninstall mongodb
kubectl delete -n graylog pvc datadir-mongodb-0 datadir-mongodb-1
```

Note that this will remove your graylog settings but not your actual logs. This step is unfortunately needed to enable credentials on the Graylog database hosted by the mongodb chart. You will need to recreate the GELF TCP input source as during install.

Then run

```shell
helmfile -f helmfile.d/00-init.yaml apply --concurrency 1
helmfile -f helmfile.d/10-base.yaml --selector name=cert-manager-letsencrypt apply
```

To update the Kafka stack, run:

```shell
helmfile -f helmfile.d/10-base.yaml apply --concurrency 1
```

After this has succeeded, edit your `production.yaml` and change the `cp_kafka.customEnv.KAFKA_INTER_BROKER_PROTOCOL_VERSION` to the corresponding version documented in the [Confluent upgrade instructions](https://docs.confluent.io/platform/current/installation/upgrade.html) of your Kafka installation. Find the currently installed version of Kafka with `kubectl exec cp-kafka-0 -c cp-kafka-broker -- kafka-topics --version`.
When the `cp_kafka.customEnv.KAFKA_INTER_BROKER_PROTOCOL_VERSION` is updated, again run

```shell
helmfile -f helmfile.d/10-base.yaml apply
```

To upgrade to the latest PostgreSQL helm chart, in `production.yaml`, uncomment the line `postgresql.primary.persistence.existingClaim: "data-postgresql-postgresql-0"` to use the same data storage as previously. Then run

```shell
kubectl delete secrets postgresql
kubectl delete statefulsets postgresql-postgresql
helmfile -f helmfile.d/10-managementportal.yaml apply
```

If installed, `radar-appserver-postgresql`, uncomment the `production.yaml` line `radar_appserver_postgresql.primary.existingClaim: "data-radar-appserver-postgresql-postgresql-0"`. Then run

```shell
kubectl delete secrets radar-appserver-postgresql
kubectl delete statefulsets radar-appserver-postgresql-postgresql
helmfile -f helmfile.d/20-appserver.yaml apply
```

If installed, to upgrade `timescaledb`, uncomment the `production.yaml` line `timescaledb.primary.existingClaim: "data-timescaledb-postgresql-0"`. Then run

```shell
kubectl delete secrets timescaledb-postgresql
kubectl delete statefulsets timescaledb-postgresql
helmfile -f helmfile.d/20-grafana.yaml apply
```

If installed, to upgrade `radar-upload-postgresql`, uncomment the `production.yaml` line `radar_upload_postgresql.primary.existingClaim: "data-radar-upload-postgresql-postgresql-0"`. Then run

```shell
kubectl delete secrets radar-upload-postgresql
kubectl delete statefulsets radar-upload-postgresql-postgresql
helmfile -f helmfile.d/20-upload.yaml apply
```

If minio is installed, upgrade it with the following instructions:

```shell
# get minio PV and PVC
kubectl get pv | grep export-minio- | tr -s ' ' | cut -d ' ' -f 1,6 | tr '/' ' ' | cut -d ' ' -f 1,3 | tee minio-pv.list
# Uninstall the minio statefulset
helm uninstall minio
# Associate PV with the new PVC name
while read -r pv pvc
do
# Don not delete PV
kubectl patch pv $pv -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
# Delete PVC
kubectl delete pvc $pvc
# Name of the new PVC
newpvc=$(echo $pvc | sed 's/export-/data-/')
# Associate PV with the new PVC name
kubectl patch pv $pv -p '{"spec":{"claimRef":{"name": "'$newpvc'", "namespace": "default", "uid": null}}}'
# Create new PVC
cat <<EOF | sed "s/data-minio-i/$newpvc/" | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/instance: minio
app.kubernetes.io/name: minio
name: data-minio-i
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
EOF
done < minio-pv.list
# Do the new helm install.
helmfile -f helmfile.d/20-s3.yaml apply
```

Delete the redis stateful set (this will not delete the data on the volume)

```shell
kubectl delete statefulset redis-master
helmfile -f helmfile.d/20-s3.yaml sync --concurrency 1
```

## Volume expansion

If want to resize a volumes after its initialization you need to make sure that it's supported by its underlying volume plugin:
Expand Down Expand Up @@ -558,42 +421,6 @@ To find any updates to the Helm charts that are listed in the repository, run
bin/chart-updates
```

## Development automation

This repository can be used for development automation for instance on a k3s or k3d (dockerized k3s) cluster. The example below shows how to deploy on a k3d cluster.

1. Install k3d (see [here](https://github.com/k3d-io/k3d#get))
2. Create a k3d cluster that is configured to run RADAR-base

```shell
k3d cluster create my-test-cluster --port '80:80@loadbalancer' --config=.github/ci_config/k3d-config.yaml
```

This example creates a cluster named `my-test-cluster` with a load balancer that forwards local port 80 to the cluster. The
configuration file `.github/ci_config/k3d-config.yaml` is used to configure the cluster. This cluster will be accessible
in _kubectl_ with context name _k3d-my-test-cluster_.

3. Initialize the RADAR-Kubernetes deployment. Run:

```shell
./bin/init
```

4. In file _etc/production.yaml_:

- set _kubeContext_ to _k3d-my-test-cluster_
- set _dev_deployment_ to _true_
- (optional) enable/disable components as needed with the __install_ fields

5. Install RADAR-Kubernetes on the k3d cluster:

```shell
helmfile sync
```

When installation is complete, you can access the applications at `http://localhost`.



## Feedback and Contributions

Expand Down
Loading

0 comments on commit 49b11de

Please sign in to comment.