Repository: glasskube/glasskube (go)

Issue:
Error during bootstrap: package repo webhook certificate problem
**Describe the bug**

Updated from v0.13.0 straight to v0.18.0, and this error appeared. However, it seems that most of the stuff has been updated and `glasskube version` shows v0.18.0. 

```
$ glasskube bootstrap
Glasskube will be updated to version v0.18.0 in cluster xxx.
Continue? (Y/n) 

## Installing GLASSKUBE ##
🧊 The next generation Package Manager for Kubernetes 📦
* Fetching Glasskube manifest from https://github.com/glasskube/glasskube/releases/download/v0.18.0/manifest-aio.yaml
* Validating existing installation
* Applying Glasskube manifests
Applying glasskube-validating-webhook-configuration (ValidatingWebhookConfiguration)  90% || (47/52, 5 it/s) [9                                                                                                               Applying glasskube-validating-webhook-configuration (ValidatingWebhookConfiguration)  92% || (48/52, 5 it/s) [9                                                                                                               Applying glasskube (PackageRepository)  92% |████████████████████████████████████    | (48/52, 5 it/s) [9s:0s]* Couldn't apply manifests: Internal error occurred: failed calling webhook "vpackagerepository.kb.io": failed to call webhook: Post "https://glasskube-webhook-service.glasskube-system.svc:443/validate-packages-glasskube-dev-v1alpha1-packagerepository?timeout=10s": tls: failed to verify certificate: x509: certificate signed by unknown authority

An error occurred during bootstrap:
Internal error occurred: failed calling webhook "vpackagerepository.kb.io": failed to call webhook: Post "https://glasskube-webhook-service.glasskube-system.svc:443/validate-packages-glasskube-dev-v1alpha1-packagerepository?timeout=10s": tls: failed to verify certificate: x509: certificate signed by unknown authority
$ glasskube version

  ____ _        _    ____ ____  _  ___   _ ____  _____
 / ___| |      / \  / ___/ ___|| |/ / | | | __ )| ____|
| |  _| |     / _ \ \___ \___ \| ' /| | | |  _ \|  _|
| |_| | |___ / ___ \ ___) |__) | . \| |_| | |_) | |___
 \____|_____/_/   \_\____/____/|_|\_\\___/|____/|_____|
	
glasskube: v0.18.0
package-operator: v0.18.0
```

I think the problem is that we also create the default repository custom resource, and this will be validated. At bootstrap time however, the updated controller manager might not be ready yet and run into this error.

Running `glasskube bootstrap` again after 2 minutes, a different error occurs:

```
glasskube bootstrap
⚠️  Glasskube is already installed in this cluster (xxx) in version v0.18.0. You are about to bootstrap this version again.
Continue? (Y/n) 

## Installing GLASSKUBE ##
🧊 The next generation Package Manager for Kubernetes 📦
* Fetching Glasskube manifest from https://github.com/glasskube/glasskube/releases/download/v0.18.0/manifest-aio.yaml
* Validating existing installation
* Applying Glasskube manifests
Applying glasskube-validating-webhook-configuration (ValidatingWebhookConfiguration)  90% || (47/52, 5 it/s) [9                                                                                                               Applying glasskube-validating-webhook-configuration (ValidatingWebhookConfiguration)  92% || (48/52, 5 it/s) [9                                                                                                               Applying glasskube (PackageRepository)  92% |████████████████████████████████████    | (48/52, 5 it/s) [9s:0s]* Couldn't apply manifests: admission webhook "vpackagerepository.kb.io" denied the request: validator called with unexpected object type

An error occurred during bootstrap:
admission webhook "vpackagerepository.kb.io" denied the request: validator called with unexpected object type
```

This is either a bug in the package repo validator (#1094) or the package repository we create is actually incorrect. Either way this only happens in v0.18.0 (not verified).

Nevertheless, both things should be fixed:
1. Directly at bootstrap time, the validator isn't ready yet
2. The default repository must be createable.  

Also, luckily the package repo is the last thing that is applied during bootstrap, so all the other things are successfully set up. The error does not appear at all when installing glasskube, only when updating.

**To Reproduce**
Steps to reproduce the behavior:
`glasskube bootstrap`

**Expected behavior**
No errors. 

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Cluster Info (please complete the following information):**
 - Type: Kubernetes
 - Version: [e.g. 1.29]
 - Provider: minikube

**Glasskube Info (please complete the following information):**
 - Package Operator version: v0.18.0
 - CLI version: v0.18.0

**Additional context**


Pull request:
fix(package-operator): package repository webhook validation
<!-- Thanks for creating this pull request 🤗 Please make sure you followed the conventional commit -->

<!-- If this pull request closes an issue, please mention the issue number below -->
Closes #1155

## 📑 Description
This should at least fix one part of the #1155 issue. Problem was that it was not allowed to update a package repository if the URL did not change, due to a missing else branch.

I don't know about the first part of the issue though (certificate error – pretty sure that only happens during the update of an installation, and maybe the cert-manager generates a new cert there and it's just not ready in time?). 

## ✅ Checks
- [ ] My code requires changes to the documentation
- [ ] I have updated the documentation as required

## ℹ Additional Information
<!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behavior, etc. -->

Patch:
diff --git a/internal/webhook/packagerepository_webhook.go b/internal/webhook/packagerepository_webhook.go
index 630655a..2ec7597 100644
--- a/internal/webhook/packagerepository_webhook.go
+++ b/internal/webhook/packagerepository_webhook.go
@@ -61,6 +61,8 @@ func (p *PackageRepositoryValidatingWebhook) ValidateUpdate(ctx context.Context,
 			log.Info("validate update", "name", newRepo.Name)
 			if oldRepo.Spec.Url != newRepo.Spec.Url {
 				return nil, p.validateUpdateOrDelete(ctx, oldRepo)
+			} else {
+				return nil, nil
 			}
 		}
 	}
diff --git a/website/package-lock.json b/website/package-lock.json
index 46bf909..71b516d 100644
--- a/website/package-lock.json
+++ b/website/package-lock.json
@@ -3811,6 +3811,13 @@
       "integrity": "sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==",
       "license": "MIT"
     },
+    "node_modules/@rtsao/scc": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
+      "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
+      "dev": true,
+      "license": "MIT"
+    },
     "node_modules/@sideway/address": {
       "version": "4.1.5",
       "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz",
@@ -8826,9 +8833,9 @@
       }
     },
     "node_modules/eslint-module-utils": {
-      "version": "2.8.2",
-      "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.2.tgz",
-      "integrity": "sha512-3XnC5fDyc8M4J2E8pt8pmSVRX2M+5yWMCfI/kDZwauQeFgzQOuhcRBFKjTeJagqgk4sFKxe1mvNVnaWwImx/Tg==",
+      "version": "2.9.0",
+      "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.9.0.tgz",
+      "integrity": "sha512-McVbYmwA3NEKwRQY5g4aWMdcZE5xZxV8i8l7CqJSrameuGSQJtSWaL/LxTEzSKKaCcOhlpDR8XEfYXWPrdo/ZQ==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
@@ -8854,27 +8861,28 @@
       }
     },
     "node_modules/eslint-plugin-import": {
-      "version": "2.29.1",
-      "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
-      "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
+      "version": "2.30.0",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz",
+      "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
-        "array-includes": "^3.1.7",
-        "array.prototype.findlastindex": "^1.2.3",
+        "@rtsao/scc": "^1.1.0",
+        "array-includes": "^3.1.8",
+        "array.prototype.findlastindex": "^1.2.5",
         "array.prototype.flat": "^1.3.2",
         "array.prototype.flatmap": "^1.3.2",
         "debug": "^3.2.7",
         "doctrine": "^2.1.0",
         "eslint-import-resolver-node": "^0.3.9",
-        "eslint-module-utils": "^2.8.0",
-        "hasown": "^2.0.0",
-        "is-core-module": "^2.13.1",
+        "eslint-module-utils": "^2.9.0",
+        "hasown": "^2.0.2",
+        "is-core-module": "^2.15.1",
         "is-glob": "^4.0.3",
         "minimatch": "^3.1.2",
-        "object.fromentries": "^2.0.7",
-        "object.groupby": "^1.0.1",
-        "object.values": "^1.1.7",
+        "object.fromentries": "^2.0.8",
+        "object.groupby": "^1.0.3",
+        "object.values": "^1.2.0",
         "semver": "^6.3.1",
         "tsconfig-paths": "^3.15.0"
       },


Test patch:
diff --git a/internal/webhook/packagerepository_webhook_test.go b/internal/webhook/packagerepository_webhook_test.go
index e63f6b7..60343ca 100644
--- a/internal/webhook/packagerepository_webhook_test.go
+++ b/internal/webhook/packagerepository_webhook_test.go
@@ -102,5 +102,12 @@ var _ = Describe("PackageRepositoryValidatingWebhook", Ordered, func() {
 				Expect(err).To(MatchError(ErrPackagesInstalled))
 			})
 		})
+		When("url not changed", func() {
+			It("should not return an error", func(ctx context.Context) {
+				webhook := newPackageRepositoryValidatingWebhook(&glasskubev1Repo, &hinterseerv1Package, &hinterseerv1PackageInfo)
+				_, err := webhook.ValidateUpdate(ctx, &glasskubev1Repo, &glasskubev1Repo)
+				Expect(err).NotTo(HaveOccurred())
+			})
+		})
 	})
 })