Skip to content
New issue

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

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

Already on GitHub? # to your account

feature/add-wl #632

Merged
merged 1 commit into from
Feb 17, 2025
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
4 changes: 2 additions & 2 deletions packages/apps/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ virtual-machine 0.5.0 cad9cde
virtual-machine 0.6.0 0e728870
virtual-machine 0.7.0 af58018a
virtual-machine 0.7.1 05857b95
virtual-machine 0.8.0 3fa4dd3a
virtual-machine 0.8.0 3fa4dd3
virtual-machine 0.8.1 HEAD
vm-disk 0.1.0 HEAD
vm-instance 0.1.0 ced8e5b9
vm-instance 0.2.0 4f767ee3
vm-instance 0.3.0 0e728870
vm-instance 0.4.0 af58018a
vm-instance 0.4.1 05857b95
vm-instance 0.5.0 3fa4dd3a
vm-instance 0.5.0 3fa4dd3
vm-instance 0.5.1 HEAD
vpn 0.1.0 f642698
vpn 0.2.0 7151424
Expand Down
71 changes: 57 additions & 14 deletions packages/core/platform/bundles/paas-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,67 @@ releases:
namespace: cozy-dashboard
dependsOn: [cilium,kubeovn,keycloak-configure]
values:
kubeapps:
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1" "HelmRepository" "cozy-public" "").items }}
redis:
master:
podAnnotations:
{{- range $index, $repo := . }}
{{- with (($repo.status).artifact).revision }}
repository.cozystack.io/{{ $repo.metadata.name }}: {{ quote . }}
{{- end }}
{{- end }}
{{- end }}
redis:
master:
podAnnotations:
{{- range $index, $repo := . }}
{{- with (($repo.status).artifact).revision }}
repository.cozystack.io/{{ $repo.metadata.name }}: {{ quote . }}
{{- end }}
{{- end }}
{{- end }}

{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
{{- $dashboardKCValues | nindent 4 }}
{{- end }}
dashboard:
image:
registry: ghcr.io/aenix-io/cozystack
repository: dashboard
tag: v0.25.0
digest: "sha256:81e7b625c667bce5fc339eb97c8e115eafb82f66df4501550b3677ac53f6e234"
{{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
{{- $locale := dig "data" "locale" "" $wlConfigmap }}
{{- if $locale }}
customLocale:
"Kubeapps": {{ $locale }}
{{- end }}
customStyle: |
{{- $logoImage := dig "data" "logo" "" $wlConfigmap }}
{{- if $logoImage }}
.kubeapps-logo {
background-image: {{ $logoImage }}
}
{{- end }}
#serviceaccount-selector {
display: none;
}
.login-moreinfo {
display: none;
}
a[href="#/docs"] {
display: none;
}
.login-group .clr-form-control .clr-control-label {
display: none;
}
.appview-separator div.appview-first-row div.center {
display: none;
}
.appview-separator div.appview-first-row section[aria-labelledby="app-secrets"] {
display: none;
}
.appview-first-row section[aria-labelledby="access-urls-title"] {
width: 100%;
}
{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
valuesFrom:
- kind: ConfigMap
name: kubeapps-auth-config
valuesKey: values.yaml
{{- end }}

{{- if eq $oidcEnabled "true" }}
dependsOn: [keycloak-configure]
Expand Down
56 changes: 49 additions & 7 deletions packages/core/platform/bundles/paas-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ releases:
chart: cozy-dashboard
namespace: cozy-dashboard
values:
kubeapps:
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1" "HelmRepository" "cozy-public" "").items }}
kubeapps:
redis:
master:
podAnnotations:
Expand All @@ -168,12 +168,54 @@ releases:
{{- end }}
{{- end }}
{{- end }}

{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
{{- $dashboardKCValues | nindent 4 }}
{{- end }}
dashboard:
image:
registry: ghcr.io/aenix-io/cozystack
repository: dashboard
tag: v0.25.0
digest: "sha256:81e7b625c667bce5fc339eb97c8e115eafb82f66df4501550b3677ac53f6e234"
{{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
Comment on lines +171 to +177
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the image digest for security.

The dashboard image is properly configured with a digest for immutability. However, let's verify the digest against the official repository.


🏁 Script executed:

#!/bin/bash
# Description: Verify the dashboard image digest
curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
     -H "Authorization: Bearer $(curl -s "https://ghcr.io/token?service=ghcr.io&scope=repository:aenix-io/cozystack/dashboard:pull" | jq -r .token)" \
     https://ghcr.io/v2/aenix-io/cozystack/dashboard/manifests/v0.25.0 | jq -r '.config.digest'

Length of output: 450


Mismatch Found: Update the Dashboard Image Digest

The digest retrieved from the official repository for the dashboard image tag v0.25.0 is:

sha256:6ff65b7407e0ee4524df1591c0dc185fcaf52582bcc3d246540e380822a46d69

However, the file packages/core/platform/bundles/paas-hosted.yaml currently specifies:

sha256:81e7b625c667bce5fc339eb97c8e115eafb82f66df4501550b3677ac53f6e234

Please update the digest in the YAML file to match the verified official digest.

  • Location: packages/core/platform/bundles/paas-hosted.yaml (lines 171-177)
  • Action Required: Replace the current digest with sha256:6ff65b7407e0ee4524df1591c0dc185fcaf52582bcc3d246540e380822a46d69.

{{- $locale := dig "data" "locale" "" $wlConfigmap }}
{{- if $locale }}
customLocale:
"Kubeapps": {{ $locale }}
{{- end }}
Comment on lines +177 to +182
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for ConfigMap lookup.

The white-label ConfigMap lookup lacks error handling. If the ConfigMap doesn't exist, the template will continue silently.

Add error handling:

 {{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
+{{- if not $wlConfigmap }}
+  {{- fail "ERROR: white-label ConfigMap not found in cozy-dashboard namespace" }}
+{{- end }}
 {{- $locale := dig "data" "locale" "" $wlConfigmap }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
{{- $locale := dig "data" "locale" "" $wlConfigmap }}
{{- if $locale }}
customLocale:
"Kubeapps": {{ $locale }}
{{- end }}
{{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
{{- if not $wlConfigmap }}
{{- fail "ERROR: white-label ConfigMap not found in cozy-dashboard namespace" }}
{{- end }}
{{- $locale := dig "data" "locale" "" $wlConfigmap }}
{{- if $locale }}
customLocale:
"Kubeapps": {{ $locale }}
{{- end }}

customStyle: |
{{- $logoImage := dig "data" "logo" "" $wlConfigmap }}
{{- if $logoImage }}
.kubeapps-logo {
background-image: {{ $logoImage }}
}
{{- end }}
#serviceaccount-selector {
display: none;
}
.login-moreinfo {
display: none;
}
a[href="#/docs"] {
display: none;
}
.login-group .clr-form-control .clr-control-label {
display: none;
}
.appview-separator div.appview-first-row div.center {
display: none;
}
.appview-separator div.appview-first-row section[aria-labelledby="app-secrets"] {
display: none;
}
.appview-first-row section[aria-labelledby="access-urls-title"] {
width: 100%;
}
{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
valuesFrom:
- kind: ConfigMap
name: kubeapps-auth-config
valuesKey: values.yaml
{{- end }}
Comment on lines +211 to +218
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for auth config ConfigMap.

Similar to the white-label ConfigMap, the auth config ConfigMap lookup lacks error handling.

Add error handling:

 {{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
+{{- if not $dashboardKCconfig }}
+  {{- fail "ERROR: kubeapps-auth-config ConfigMap not found in cozy-dashboard namespace" }}
+{{- end }}
 {{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
valuesFrom:
- kind: ConfigMap
name: kubeapps-auth-config
valuesKey: values.yaml
{{- end }}
{{- $dashboardKCconfig := lookup "v1" "ConfigMap" "cozy-dashboard" "kubeapps-auth-config" }}
{{- if not $dashboardKCconfig }}
{{- fail "ERROR: kubeapps-auth-config ConfigMap not found in cozy-dashboard namespace" }}
{{- end }}
{{- $dashboardKCValues := dig "data" "values.yaml" "" $dashboardKCconfig }}
{{- if $dashboardKCValues }}
valuesFrom:
- kind: ConfigMap
name: kubeapps-auth-config
valuesKey: values.yaml
{{- end }}


{{- if eq $oidcEnabled "true" }}
dependsOn: [keycloak-configure]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
{{- $cookieSecret = randAlphaNum 16 }}
{{- end }}

{{- $wlConfigmap := lookup "v1" "ConfigMap" "cozy-dashboard" "white-label" }}
{{- $locale := index $wlConfigmap.data "locale" }}

---

apiVersion: v1
Expand Down Expand Up @@ -83,6 +86,9 @@ metadata:
spec:
realmName: cozy
clusterKeycloakRef: keycloak-cozy
{{- if $locale }}
displayNameHtml: {{ $locale }}
{{- end }}

---

Expand Down