Commit Graph

1268 Commits

Author SHA1 Message Date
Andrei Kvapil
23a7281fbf [cozystack-api] Disable startegic-json-patch support
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-09 18:31:14 +02:00
Andrei Kvapil
f32c6426a9 [cozystack-api] Refactor OpenAPI Schema (#1173)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack-api] Fix updaing lists on cozystack objects
[cozystack-api] Refactor OpenAPI Schema
[cozystack-api] Support reading OpenAPI Schema from config
[cozystack-api] Disable startegic-json-patch support
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added support for dynamic OpenAPI schema post-processing for both
OpenAPI v2 and v3 specifications, enabling custom schema injection per
resource kind.
* Introduced a new configuration field to allow specifying a custom
OpenAPI schema.

* **Refactor**
* Streamlined OpenAPI schema handling by moving from inline logic to
modular post-processing functions.
* Implemented dynamic versioning for OpenAPI specs based on resource
configuration changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 18:30:13 +02:00
Andrei Kvapil
91583a4e1a [cozystack-api] Refactor OpenAPI Schema
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-09 18:28:06 +02:00
Andrei Kvapil
f628e7d9c7 [docs] Add backup and restore instructions for PostgreSQL (#1141)
## What this PR does

Rephrase the descriptions for backup and restore variables

### Release note

```release-note
[docs] Add backup and restore instructions for PostgreSQL 
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Updated PostgreSQL backup restore instructions to use a YAML
configuration approach for bootstrapping from a backup, replacing
previous shell command examples.
* Clarified and restructured backup and recovery documentation,
including detailed configuration examples for enabling backups with
S3-compatible storage.
* Improved descriptions and default values for backup-related
configuration parameters for better clarity and consistency.

* **Chores**
  * Incremented the PostgreSQL app chart version.
  * Updated version mapping for the PostgreSQL package.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 11:24:10 +02:00
klinch0
68d1646ae7 make velero deletable (#1176)
<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
- make velero deletable
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Included the Velero Helm release in the pre-delete suspension process
to ensure proper cleanup during teardown.

* **Chores**
  * Updated the Kubernetes application chart version to 0.25.2.
  * Adjusted version mapping for improved tracking of releases.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 12:18:35 +03:00
kklinch0
8fde834e39 make velero addon deletable
Signed-off-by: kklinch0 <kklinch0@gmail.com>
2025-07-09 11:52:44 +03:00
kklinch0
e99d238647 [docs] Add backup and restore instructions for PostgreSQL
Rephrase the descriptions for backup and restore variables

Co-authored-by: Nick Volynkin <nick.volynkin@gmail.com>
Signed-off-by: Nick Volynkin <nick.volynkin@gmail.com>
2025-07-09 10:47:09 +02:00
Andrei Kvapil
e9435c2d3d [docs] Fix a typo in preset resource tables in the README's (#1172)
Signed-off-by: Nick Volynkin <nick.volynkin@gmail.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Updated documentation across multiple applications to reflect a change
in the CPU allocation for the "large" resource preset from 3 CPUs to 2
CPUs. Memory allocation for this preset remains unchanged at 2Gi. No
other documentation changes were made.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 10:42:39 +02:00
Andrei Kvapil
da3ee5d0ea [virtual-machine] add comment about sshKeys logic
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-09 10:37:39 +02:00
Andrei Kvapil
411a465b14 [virtual-machine] Fix cloudInit and sshKeys (#1175)
<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does

fixes https://github.com/cozystack/cozystack/issues/1148

This PR does two things:
1. **Fixes the cloud-init shebang**
(e1382f51c6)
Dashboard comments were removed unintentionally, which also stripped out
the cloud-init shebang. This fix puts it back.
2. **Improves cloudInit option handling**
The update refines how various cloudInit options are processed, whether
or not sshKeys are provided.

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[dashboard] Fix removing shebang for cloud init
[virtual-machine] Fix cloudInit and sshKeys processing
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Cloud-init configuration now supports providing SSH keys even when
explicit cloud-init data is not set, allowing for easier SSH access
setup.

* **Refactor**
* Simplified and unified the logic for handling cloud-init and SSH key
configuration in virtual machine templates, reducing complexity and
improving maintainability.

* **Chores**
* Updated the default commit reference for Kubeapps components to a
newer version in the dashboard build process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 10:21:37 +02:00
Andrei Kvapil
cad57cd922 [cozystack-api] Fix updaing lists (#1171)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does

When you update lists in cozystack objects, you might face with the
error:

```
Warning: resource vminstances/mikrotik-demo is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used o
n resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
warning: error calculating patch from openapi v3 spec: unable to find api field "disks"
Error from server: error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apps.cozystack.io/v1alpha1\",\"kind\":\"VMInstance\",\"metadata\":{\"annotations\":{},\"name
\":\"mikrotik-demo\",\"namespace\":\"tenant-vasya\"},\"spec\":{\"disks\":[{\"bus\":\"sata\",\"name\":\"mikrotik-system\"},{\"name\":\"mikrotik-iso\"}],\"instanceProfile\":\"ubuntu\",\"instan
ceType\":\"u1.medium\",\"running\":true}}\n"}},"spec":{"disks":[{"bus":"sata","name":"mikrotik-system"},{"name":"mikrotik-iso"}]}}
to:
Resource: "apps.cozystack.io/v1alpha1, Resource=vminstances", GroupVersionKind: "apps.cozystack.io/v1alpha1, Kind=VMInstance"
Name: "mikrotik-demo", Namespace: "tenant-vasya"
for: "/tmp/2": error when patching "/tmp/2": unable to find api field in struct JSON for the json field "disks"
```

This PR workarounds this.

Related to https://github.com/cozystack/cozystack/pull/1168

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack-api] Fix updaing lists on cozystack objects
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Enhancements**
* Made resource specifications more flexible by allowing any content
under the specification property for dynamically registered resource
kinds.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 10:20:30 +02:00
Andrei Kvapil
fe1776b4c8 [cozystack-api] Fix resourceVersion error (#1170)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does

This PR fixes error:

```
failed to update HelmRelease: helmreleases.helm.toolkit.fluxcd.io "xxx" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update
```

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack-api] Fix resourceVersion error
```
2025-07-09 10:20:14 +02:00
Andrei Kvapil
d9779d55ea [cozystack-api] Fix singular name for cozystack resources (#1169)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozystack-api] Fix singular name for cozystack resources
```
2025-07-09 10:19:57 +02:00
Andrei Kvapil
74d3c89235 [vm-instance] Add bus option; Always specify bootOrder (#1168)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[vm-instance] Add bus option
[vm-instance] Always specify bootOrder for all disks
```
2025-07-09 10:19:38 +02:00
Andrei Kvapil
c831f53444 [virtual-machine] Fix cloudInit and sshKeys
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-09 08:41:40 +02:00
Andrei Kvapil
2c68eee9f8 [cozystack-api] Fix updaing lists
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-08 20:23:06 +02:00
Andrei Kvapil
e6ffb4f4e5 [cozystack-api] Fix resourceVersion error
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-08 18:45:19 +02:00
Andrei Kvapil
e63cc1890e [cozystack-api] Fix singular name for cozystack resources
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-08 18:09:12 +02:00
Andrei Kvapil
1079472a2a [vm-instance] Add bus option; Always specify bootOrder
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-08 17:47:34 +02:00
Nick Volynkin
1609931e3f [docs] Fix a typo in preset resource tables in the README's
Signed-off-by: Nick Volynkin <nick.volynkin@gmail.com>
2025-07-08 16:17:23 +03:00
Andrei Kvapil
699d38d8b9 bugfix: vm and vmi add svc to dashboard (#1161)
<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
- vm and vmi add svc to dashboard
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
* Enhanced dashboard permissions to allow viewing and monitoring of
specific service resources in both the virtual-machine and vm-instance
applications.

* **Chores**
* Updated chart versions for virtual-machine (to 0.12.1) and vm-instance
(to 0.9.1).
* Refreshed version mappings for virtual-machine and vm-instance
components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-08 10:49:27 +02:00
Andrei Kvapil
acd4663aee Release v0.33.1 (#1166)
This PR prepares the release `v0.33.1`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated container image tags and digests across multiple components to
newer patch versions, including cluster-autoscaler,
kubevirt-cloud-provider, kubevirt-csi-driver, cozystack installer, e2e
testing service, matchbox, s3manager, cozystackAPI,
cozystack-controller, dashboard, kubeapps, Kamaji, kubeovn-webhook,
kubeovn, and kubevirt-csi-node.
* Updated related configuration files to reflect the new image versions
and digests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
v0.33.1
2025-07-08 11:48:09 +03:00
kklinch0
f251cba363 bugfix: vm and vmi add svc to dashboard
Signed-off-by: kklinch0 <kklinch0@gmail.com>
2025-07-08 10:02:34 +03:00
Andrei Kvapil
91a07dcda6 [postgres] Restrict password change for user postgres (#1164)
Restrict password change for user postgres

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
  * Updated the chart version for Postgres from 0.16.0 to 0.17.0.
* Updated the versions map to reference the latest commit and added the
new version.

* **Bug Fixes**
* Enhanced initialization script to forbid creating a user named
"postgres," providing clear error messaging.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-08 09:25:11 +03:00
cozystack-bot
99552bf792 Prepare release v0.33.1
Signed-off-by: cozystack-bot <217169706+cozystack-bot@users.noreply.github.com>
2025-07-08 06:24:09 +00:00
Andrei Kvapil
45031055f8 [kubevirt-csi] Update Role of CSI controller (#1165)
## What this PR does

Following a [recent
update](0171916b01),
the KubeVirt CSI controller now needs new permissions to manage volumes
for tenant k8s clusters. This patch updates the role granted to the
kcsi-controller deployment of each tenant k8s cluster.

### Release note

```release-note
[kubevirt-csi] Update kcsi-controller role to align with the requirements of the version of the controller in use.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Expanded permissions for Kubernetes infrastructure service accounts,
including enhanced access to virtual machines, volume snapshots, and
persistent volume claims.

* **Chores**
  * Updated chart version to 0.25.1.
  * Refreshed version mapping for the Kubernetes package.
* Made the CSI driver container image configurable via deployment
settings.
* Integrated CSI driver image reference into deployment configuration
automatically.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-08 09:20:02 +03:00
Andrei Kvapil
d200017f74 Automatically set image for kubevirt-csi-node
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-08 09:19:03 +03:00
Ahmad Murzahmatov
f6eaca3843 [postgres] do not allow change postgres pwd
Signed-off-by: Ahmad Murzahmatov <gwynbleidd2106@yandex.com>
2025-07-08 08:52:29 +06:00
Timofei Larkin
8d3324f958 [kubevirt-csi] Update Role of CSI controller
Following a [recent update](0171916b01),
the KubeVirt CSI controller now needs new permissions to manage volumes
for tenant k8s clusters.

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-07-07 19:12:51 +03:00
Andrei Kvapil
70f8266767 Release v0.33.0 (#1159)
This PR prepares the release `v0.33.0`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated container image versions and digests across multiple
components, including ClickHouse backup, nginx-cache,
cluster-autoscaler, kubevirt-cloud-provider, kubevirt-csi-driver,
mariadb-backup, Grafana, s3manager, and others.
* Upgraded image tags and digests for core and system services such as
the installer, API, controller, dashboard, Kamaji, kubeovn, and related
components.
* Updated configuration files to reflect new image versions and digests,
ensuring consistency across deployments.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
v0.33.0
2025-07-04 00:21:43 +03:00
cozystack-bot
a9674d2ae7 Prepare release v0.33.0
Signed-off-by: cozystack-bot <217169706+cozystack-bot@users.noreply.github.com>
2025-07-03 20:57:31 +00:00
Andrei Kvapil
cb6a55bc4a [ci] fix releasing pipeline
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 23:53:36 +03:00
Andrei Kvapil
3ecbaf23a4 [apps] Give examples of new resources in managed app README's (#1120)
Merge after https://github.com/cozystack/cozystack/pull/1117 and
https://github.com/cozystack/cozystack/pull/1155


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Improved clarity and detail in parameter descriptions across multiple
app documentation files, especially for resource configuration options.
* Expanded explanations for `resources` and `resourcesPreset`
parameters, including explicit usage, allowed values, and fallback
behavior.
* Added new sections with YAML configuration examples and reference
tables for resource presets in several app READMEs.
* Corrected typos, improved formatting, and updated terminology for
better readability and consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 23:26:43 +03:00
Andrei Kvapil
946fad8bb8 [apps] Give examples of new resources in managed app README's
- Change wording for `resources` and `resourcesPreset` variables.
- Explain and give exampls of other object-type variables,
  if their child fields are not annotated.
- Fix a few typos, improve wording.
- Bump all application charts to ensure that new texts are shown
  immediately after updating Cozystack.

Co-authored-by: Andrei Kvapil <kvapss@gmail.com>
Signed-off-by: Nick Volynkin <nick.volynkin@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 22:58:06 +03:00
Andrei Kvapil
f1d86e5045 [keycloak, cozy-lib] Calculate Java heap params (#1157)
## What this PR does

This patch passes Java heap parameters to Keycloak to prevent OOM errors
when the JVM lacks compatibility with cgroups v2 and fails to recognize
container memory requests and limits. A new function is introduced in
cozy-lib to calculate the heap parameters from requests and limits,
setting Xmx to 75% of the memory limit and Xms to the lesser of the
memory request or 25% of the memory limits.

## Release note

```release-note
[keycloak] Calculate and pass Java heap parameters explicitly to prevent OOM errors.
[cozy-lib] Introduce helper function to calculate Java heap params based on memory requests and limits.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added automatic calculation and injection of Java heap size settings
for the Keycloak container, based on resource requests and limits.
* **Improvements**
* Enhanced resource handling to ensure all resource values are
consistently formatted and sanitized.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 22:55:11 +03:00
Timofei Larkin
9adcd48c44 [keycloak, cozy-lib] Calculate Java heap params
This patch passes Java heap parameters to Keycloak to prevent OOM errors
when the JVM lacks compatibility with cgroups v2 and fails to recognize
container memory requests and limits. A new function is introduced in
cozy-lib to calculate the heap parameters from requests and limits,
setting Xmx to 75% of the memory limit and Xms to the lesser of the
memory request or 25% of the memory limits.

Change log:
[keycloak] Calculate and pass Java heap parameters explicitly to prevent
OOM errors.
[cozy-lib] Introduce helper function to calculate Java heap params based
on memory requests and limits.

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-07-03 22:15:04 +03:00
Timofei Larkin
fb82bfae11 [platform] Always set resources for managed apps (#1156)
## What this PR does

This patch removes the loophole to leave resource requests and limits
unspecified in managed apps. Any of cpu, memory, and ephemeral storage
are now filled in from the resource preset (default or user-specified)
if not explicitly specified in .Values.resources. "none" is no longer an
accepted value in resourcePresets and the primary resources now always
have some explicit value for proper billing and isolation.

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->



### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[platform] Always set resources for managed apps. "none" is no longer valid in resourcePresets, deployed apps now always have explicitly specified cpu, memory, ephemeral-storage requests and limits.
```
2025-07-03 19:56:39 +04:00
Timofei Larkin
bd9e283d3b [platform] Always set resources for managed apps
This patch removes the loophole to leave resource requests and limits
unspecified in managed apps. Any of cpu, memory, and ephemeral storage
are now filled in from the resource preset (default or user-specified)
if not explicitly specified in .Values.resources. "none" is no longer an
accepted value in resourcePresets and the primary resources now always
have some explicit value for proper billing and isolation.

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-07-03 17:45:32 +03:00
Andrei Kvapil
d2126b6703 Save a list of observed images after workflow (#1089)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a process to list images used in the environment before deletion
during cleanup operations.
- **Chores**
- Enhanced environment cleanup workflow with improved visibility into
used images.
- Introduced a shared writable directory between host and container for
better file management during testing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 15:45:12 +03:00
Andrei Kvapil
73fe621da1 [cozy-lib] refactor resources (#1155)
Add. missing commits from
https://github.com/cozystack/cozystack/pull/1127, which were skipped by
mistake

- [cozy-lib, bug] divf by cpu ratio, not mulf (#1125)
- [cozy-lib] remove handler for nested resources/requests map
- [cozy-lib] Introduce memory-allocation-ratio and
ephemeral-strorage-allocation-ratio options
- [system] Recuce resources for some system apps

<!-- Thank you for making a contribution! Here are some tips for you:
- Start the PR title with the [label] of Cozystack component:
- For system components: [platform], [system], [linstor], [cilium],
[kube-ovn], [dashboard], [cluster-api], etc.
- For managed apps: [apps], [tenant], [kubernetes], [postgres],
[virtual-machine] etc.
- For development and maintenance: [tests], [ci], [docs], [maintenance].
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `backport` if it's a bugfix that needs to be backported
to a previous version.
-->

## What this PR does


### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[cozy-lib] refactor resources
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced support for memory and ephemeral storage allocation ratios,
allowing more flexible resource allocation.

* **Refactor**
* Simplified resource preset structure for easier configuration and
management.
* Updated resource preset logic to use a new sanitization process for
resource values.

* **Bug Fixes**
  * Improved error handling for invalid resource preset keys.

* **Chores**
* Adjusted resource requests and limits for Redis master, FluxCD
operator, and Vertical Pod Autoscaler components to optimize resource
usage.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 15:40:35 +03:00
Andrei Kvapil
0b7bbb1ba9 [system] Recuce resources for some system apps
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 15:00:41 +03:00
Andrei Kvapil
bb46aa4b7d [cozy-lib] Introduce memory-allocation-ratio and ephemeral-strorage-allocation-ratio options
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 15:00:41 +03:00
Andrei Kvapil
6256e40169 [cozy-lib] remove handler for nested resources/requests map
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 15:00:40 +03:00
Andrei Kvapil
22cda073b9 [cozy-lib, bug] divf by cpu ratio, not mulf (#1125)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Refactor**
* Updated the structure of resource presets for improved clarity and
processing.
* Adjusted template logic to streamline resource handling and removed
previous resource limit calculations.
* Modified template parameters to enhance flexibility in resource
processing.
* **Chores**
* Improved internal template invocation for better compatibility with
resource data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 15:00:24 +03:00
Andrei Kvapil
0d46393e8c [nfs-driver] Introduce new module (#1133)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>


## What this PR does

This PR adds a new optional module to support nfs shares

## Way to test it:

#### driver and provisioner setup

```yaml
---
apiVersion: v1
kind: Namespace
metadata:
  labels:
    cozystack.io/system: "true"
    pod-security.kubernetes.io/enforce: privileged
  name: cozy-nfs-driver
spec:
  finalizers:
  - kubernetes
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  labels:
    cozystack.io/repository: system
    cozystack.io/system-app: "true"
  name: nfs-driver
  namespace: cozy-nfs-driver
spec:
  chart:
    spec:
      chart: cozy-nfs-driver
      reconcileStrategy: Revision
      sourceRef:
        kind: HelmRepository
        name: cozystack-system
        namespace: cozy-system
      version: '>= 0.0.0-0'
  dependsOn:
  - name: cilium
    namespace: cozy-cilium
  - name: kubeovn
    namespace: cozy-kubeovn
  install:
    crds: CreateReplace
    remediation:
      retries: -1
  interval: 5m
  releaseName: nfs-driver
  suspend: true
  upgrade:
    crds: CreateReplace
    remediation:
      retries: -1
```

Then `cd packages/system/csi-driver-nfs` and:

```
make apply
```

#### export share

```bash
apt install nfs-server
mkdir /data
chmod 777 /data
echo '/data *(rw,sync,no_subtree_check)' >> /etc/exports
exportfs -a
```

#### configure connection

```yaml
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs
provisioner: nfs.csi.k8s.io
parameters:
  server: 10.244.57.210
  share: /data
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
mountOptions:
  - nfsvers=4.1
```

#### order volume

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 3Gi
```

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[nfs-driver] Introduce new optional module to order volumes from NFS shares
```
2025-07-03 14:32:51 +03:00
Andrei Kvapil
193f43d7bb [kubernetes] Fix dead-lock while reattaching a KubeVirt-CSI volume (#1135)
## What this PR does


This pr imports upstream fix for volume reattaching procedure
- https://github.com/kubevirt/csi-driver/pull/143

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same [label] as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
[kubernetes] Fix dead-lock while reattaching a KubeVirt-CSI volume
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Improved volume management for virtual machines by adding checks to
skip unnecessary attach or detach operations when the volume is already
in the desired state.

* **Tests**
* Added new unit tests to verify optimized volume attach/detach
workflows and ensure fast-path logic is functioning correctly.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 14:27:10 +03:00
Andrei Kvapil
8ec882ca5f [dx] Refactor collect-images functionality
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-03 14:26:56 +03:00
Andrei Kvapil
c596805b60 [virtual-machines] Introduce golden disks functionality (#1112)
Use Golden Images to speed up VM / VMI deploy

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added support for using pre-imported "golden image" disks for virtual
machines, enabling faster provisioning by referencing existing images
instead of downloading via HTTP.
* Introduced a script to automate the import of golden images into the
system.

* **Improvements**
* Updated documentation and configuration to clarify and demonstrate how
to use golden images.
* Enhanced permission settings to support secure cloning of data
volumes.

* **Versioning**
  * Updated vm-disk package to version 0.3.0.
  * Updated virtual-machine app version to 0.12.0.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 14:25:12 +03:00
Timofei Larkin
f891d0bee6 Add exec bit to script, sanitize image list
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-07-03 13:56:41 +03:00
Andrei Kvapil
1f748d563f Copy contents of directory instead of directory
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-07-03 13:56:35 +03:00