Skip to content

Commit 3db5b38

Browse files
kartik-579Shivam-nagar23manish-agrawal-ai
authored
Oss sync (#110)
* handled nil pointer in imagePullSecret service when asserting k8s error type (#3208) * fix: rbac optimisation for creation of policies for devtron app, helm app and cluster (#2948) * change1 * "RBAC Refactoring and Policy Creation Optimisation" * "Removing ClusterType" * "ReFactoring the changes" * removed redundant method * "Changes After Reviews" * "Changes After Reviews 2" * "Changes After Reviews 3" * "Changes After Reviews 4" * "Changes After Reviews 5" * "Changes After Reviews 6" * "Changes After Reviews 6" * "Changes based on entity" * Code Cleaning * Code change 8 * Code change 9 * Code change 9 * Code change 10 * Code change 11 * Code change 12 * Code change 13 * fixed transaction error for creating roles * refactoring - 1 * refactoring * Changes after Resolving conflicts * Changes after Resolving conflicts 2 * Changes after Resolving conflicts 3 * Changes after Resolving access_type to accessType and queries * Final changes * Rbac-Optimimisation Change * Rbac-Optimimisation Final Change * refactoring * Fixing Legacy Bug * Fixing Visiblity issues all pods * Merge with main * Intialisation with capacity and adding logs * Intialisation with capacity and adding logs * Refactoring the changes * Adding logs * Adding logs 1 * Updating the audit logs for create Role * Handling from code instead of script * Merge Main * Deleting Commented Code and adding role group view * Fixing issues caught in Dev-Testing * Removing script queries * Fixing Issues of entity empty * Dev-Testing Changes * Final Changes * Reducing duplication * Reducing duplication * Adding audit logs for superAdmin for user role mappings * Visibility of permissions * Visibility of permissions for devtron-apps * Fixing Legacy issue for deleting roleGroup permissions * deleting group and role mapping from casbin * updated sql script no. --------- Co-authored-by: kartik-579 <[email protected]> * fix: user/role group sql lock fix (#3206) * change1 * "RBAC Refactoring and Policy Creation Optimisation" * "Removing ClusterType" * "ReFactoring the changes" * removed redundant method * "Changes After Reviews" * "Changes After Reviews 2" * "Changes After Reviews 3" * "Changes After Reviews 4" * "Changes After Reviews 5" * "Changes After Reviews 6" * "Changes After Reviews 6" * "Changes based on entity" * Code Cleaning * Code change 8 * Code change 9 * Code change 9 * Code change 10 * Code change 11 * Code change 12 * Code change 13 * fixed transaction error for creating roles * refactoring - 1 * refactoring * Changes after Resolving conflicts * Changes after Resolving conflicts 2 * Changes after Resolving conflicts 3 * Changes after Resolving access_type to accessType and queries * Final changes * Rbac-Optimimisation Change * Rbac-Optimimisation Final Change * refactoring * Fixing Legacy Bug * Fixing Visiblity issues all pods * Merge with main * Intialisation with capacity and adding logs * Intialisation with capacity and adding logs * Refactoring the changes * Adding logs * Adding logs 1 * Updating the audit logs for create Role * Handling from code instead of script * Merge Main * Deleting Commented Code and adding role group view * Fixing issues caught in Dev-Testing * Removing script queries * Fixing Issues of entity empty * Dev-Testing Changes * Final Changes * Reducing duplication * Reducing duplication * Adding audit logs for superAdmin for user role mappings * Visibility of permissions * Visibility of permissions for devtron-apps * Fixing Legacy issue for deleting roleGroup permissions * deleting group and role mapping from casbin * fix deadlock condition for user/role group update * updated sql script no. --------- Co-authored-by: shivam-nagar23 <[email protected]> * fix: label key can be saved without value if saved without propagation (#3190) * fix: length of key increased in global tag * fix: not validating label value required tag as tags can be supplied without value if saved without propagation * sql file renamed * deleted sql scripts --------- Co-authored-by: Shivam-nagar23 <[email protected]> Co-authored-by: shivam-nagar23 <[email protected]> Co-authored-by: Manish Agrawal <[email protected]>
1 parent b1581ff commit 3db5b38

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

api/appbean/AppDetail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type AppMetadata struct {
3333

3434
type AppLabel struct {
3535
Key string `json:"key,notnull" validate:"required"`
36-
Value string `json:"value,notnull" validate:"required"`
36+
Value string `json:"value,notnull"` // intentionally not added required tag as tag can be added without value
3737
Propagate bool `json:"propagate"`
3838
}
3939

pkg/bean/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ type AppLabelDto struct {
649649

650650
type Label struct {
651651
Key string `json:"key" validate:"required"`
652-
Value string `json:"value" validate:"required"`
652+
Value string `json:"value"` // intentionally not added required tag as tag can be added without value
653653
Propagate bool `json:"propagate"`
654654
}
655655

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "public"."global_tag" ALTER COLUMN "key" SET DATA TYPE varchar(100);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "public"."global_tag" ALTER COLUMN "key" SET DATA TYPE varchar(317);

util/K8sUtil.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ import (
44
"errors"
55
"fmt"
66
"k8s.io/apimachinery/pkg/util/validation"
7+
"strings"
78
)
89

910
func CheckIfValidLabel(labelKey string, labelValue string) error {
11+
labelKey = strings.TrimSpace(labelKey)
12+
labelValue = strings.TrimSpace(labelValue)
13+
1014
errs := validation.IsQualifiedName(labelKey)
11-
if len(errs) > 0 {
15+
if len(labelKey) == 0 || len(errs) > 0 {
1216
return errors.New(fmt.Sprintf("Validation error - label key - %s is not satisfying the label key criteria", labelKey))
1317
}
1418

1519
errs = validation.IsValidLabelValue(labelValue)
16-
if len(errs) > 0 {
20+
if len(labelValue) == 0 || len(errs) > 0 {
1721
return errors.New(fmt.Sprintf("Validation error - label value - %s is not satisfying the label value criteria for label key - %s", labelValue, labelKey))
1822
}
1923
return nil

0 commit comments

Comments
 (0)