Skip to content

Commit

Permalink
Add missing newlines at end of files and update file headers with aut…
Browse files Browse the repository at this point in the history
…hor comments
  • Loading branch information
EliasDeHondt committed Feb 21, 2025
1 parent 6e3453f commit 5cb52ef
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 38 deletions.
2 changes: 1 addition & 1 deletion App/Backend/cmd/auth/AuthHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ func IsLoggedIn(ctx *gin.Context) {
}

ctx.JSON(http.StatusOK, gin.H{"message": "Login successful"})
}
}
2 changes: 1 addition & 1 deletion App/Backend/cmd/auth/AuthMiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ func GenerateToken(username string) (string, error) {

token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
return token.SignedString(jwtSecret)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -424,4 +428,4 @@ func (client *Client) CreateSecret(secret *cv1.Secret) (Secret, error) {
}

return NewSecret(*secret), err
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/ConfigMap.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -26,4 +30,4 @@ func getConfigMapAge(confMap *v1.ConfigMap) string {
age := time.Since(confMap.CreationTimestamp.Time)

return fmt.Sprintf("%d:%d:%d", int(age.Hours()/24), int(age.Hours())%24, int(age.Minutes())%60)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Deployment.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -40,4 +44,4 @@ func getDeploymentAge(deployment *v1.Deployment) string {
age := time.Since(deployment.ObjectMeta.CreationTimestamp.Time)

return fmt.Sprintf("%d:%d:%d", int(age.Hours()/24), int(age.Hours())%24, int(age.Minutes())%60)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Namespace.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import corev1 "k8s.io/api/core/v1"
Expand All @@ -10,4 +14,4 @@ func NewNamespace(namespace corev1.Namespace) Namespace {
return Namespace{
Name: namespace.Name,
}
}
}
8 changes: 5 additions & 3 deletions App/Backend/cmd/kubernetes/Node.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand All @@ -18,8 +22,6 @@ type Node struct {
IP string
}

//TODO: remove fake clientset and use a real clientset

func NewNode(node v1.Node, clientset IClient) Node {
return Node{
Name: node.Name,
Expand Down Expand Up @@ -65,4 +67,4 @@ func isNodeOnline(node *v1.Node) string {
}
}
return "NO STATUS ❓"
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Pod.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -137,4 +141,4 @@ func calculatePodAge(pod v1.Pod) string {
age := time.Since(pod.CreationTimestamp.Time)

return fmt.Sprintf("%d:%d:%d", int(age.Hours()/24), int(age.Hours())%24, int(age.Minutes())%60)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Secret.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -28,4 +32,4 @@ func calculateSecretAge(secret *v1.Secret) string {
age := time.Since(secret.CreationTimestamp.Time)

return fmt.Sprintf("%d:%d:%d", int(age.Hours()/24), int(age.Hours())%24, int(age.Minutes())%60)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Service.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -42,4 +46,4 @@ func calculateServiceAge(service *v1.Service) string {
age := time.Since(service.CreationTimestamp.Time)

return fmt.Sprintf("%d:%d:%d", int(age.Hours()/24), int(age.Hours())%24, int(age.Minutes())%60)
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/Setup.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package kubernetes

import (
Expand Down Expand Up @@ -310,4 +314,4 @@ func TestFakeClient() IClient {
}

return clientset
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/CreateResources.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -112,4 +116,4 @@ func isCommentsOrWhitespaceOnly(data []byte) bool {

return (whitespaceCount == len(lines)) || hasCommentedLinesOnly

}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetConfigMaps.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -69,4 +73,4 @@ func transformConfigMaps(list *[]v1.ConfigMap) []kubernetes.ConfigMap {

wg.Wait()
return configList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetDeployments.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -69,4 +73,4 @@ func transformDeployments(list *[]v1.Deployment) []kubernetes.Deployment {

wg.Wait()
return deploymentList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetNodes.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -60,4 +64,4 @@ func transformNodes(list *[]v1.Node) []kubernetes.Node {

wg.Wait()
return nodeList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetPods.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -69,4 +73,4 @@ func transformPods(list *[]v1.Pod) []kubernetes.Pod {

wg.Wait()
return podList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetSecrets.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -69,4 +73,4 @@ func transformSecrets(list *[]v1.Secret) []kubernetes.Secret {
wg.Wait()

return secretList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetServices.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -67,4 +71,4 @@ func transformServices(list *[]v1.Service) []kubernetes.Service {
wg.Wait()

return serviceList
}
}
6 changes: 5 additions & 1 deletion App/Backend/cmd/kubernetes/handlers/GetStats.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -30,4 +34,4 @@ func GetStatsForNode(ctx *gin.Context, name string) {
return
}
ctx.JSON(http.StatusOK, metrics)
}
}
7 changes: 5 additions & 2 deletions App/Backend/cmd/kubernetes/handlers/GetTableHandler.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand Down Expand Up @@ -55,5 +59,4 @@ func GetTableHandler(ctx *gin.Context) {
case Secrets:
GetSecretsHandler(ctx)
}

}
}
10 changes: 6 additions & 4 deletions App/Backend/cmd/kubernetes/handlers/util.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package handlers

import (
Expand All @@ -17,8 +21,6 @@ func GetPageSizeAndPageToken(ctx *gin.Context) (int, string) {
pageSizeString, _ := ctx.GetQuery("pageSize")
pageToken, _ := ctx.GetQuery("pageToken")
pageSize, err := strconv.Atoi(pageSizeString)
if err != nil {
pageSize = 20
}
if err != nil pageSize = 20
return pageSize, pageToken
}
}
4 changes: 4 additions & 0 deletions App/Backend/testing/create_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package testing

import (
Expand Down
4 changes: 4 additions & 0 deletions App/Backend/testing/get_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**********************************/
/* @since 01/01/2025 */
/* @author K10s Open Source Team */
/**********************************/
package testing

import (
Expand Down
9 changes: 0 additions & 9 deletions App/Backend/testing/test_yamls/Combined.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# This is a test comment


# To see if the comment validation works

---
apiVersion: v1
kind: Namespace
metadata:
name: testing-namespace

---
apiVersion: v1
kind: ConfigMap
Expand All @@ -17,7 +11,6 @@ metadata:
namespace: testing-namespace
data:
config-key: "custom-value"

---
apiVersion: v1
kind: Secret
Expand All @@ -27,7 +20,6 @@ metadata:
type: Opaque
data:
password: c3VwZXJzZWNyZXQ=

---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -60,7 +52,6 @@ spec:
secretKeyRef:
name: custom-secret
key: password

---
apiVersion: v1
kind: Service
Expand Down
2 changes: 2 additions & 0 deletions App/Backend/testing/test_yamls/ConfigMap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,3 +9,4 @@ data:
key1=value1
key2=value2
log_level: "debug"
---
2 changes: 2 additions & 0 deletions App/Backend/testing/test_yamls/Deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -18,3 +19,4 @@ spec:
image: nginx:latest
ports:
- containerPort: 80
---
Loading

0 comments on commit 5cb52ef

Please sign in to comment.