-
Notifications
You must be signed in to change notification settings - Fork 181
feat: static team settings page #2024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
826c8b5
feat: replaced regex patterns for strings
dennisvankekem f0830ce
fix: debug versions
dennisvankekem c0b93eb
Merge branch 'main' into APL-540
dennisvankekem 16b42b5
Merge branch 'main' into APL-540
dennisvankekem 60adb9d
feat: setup value changes
ElderMatt 7afe342
ci: change values-migrate env dir
j-zimnowoda f255729
Merge remote-tracking branch 'origin/main' into APL-540
j-zimnowoda 76728fd
feat: migrate team settings
ElderMatt b638b35
fix: values schema changes
dennisvankekem 2a30a93
fix: teamSettings migration
ferruhcihan 2c0317c
fix: cspell lint errors
ferruhcihan 76ef1f2
Merge branch 'main' into APL-540
j-zimnowoda 2cfd4dd
fix: values changes version
dennisvankekem f70c8f1
fix: remove opsgenie and email migration
dennisvankekem 272798f
fix: teamSettingsMigration test
dennisvankekem 0550987
Merge branch 'main' into APL-540
dennisvankekem c19cc9c
fix: test fixtures
dennisvankekem 5b03f32
Merge branch 'main' into APL-540
dennisvankekem c8ee5b9
fix: reverted resourceQuota
dennisvankekem 9c729e9
Merge branch 'main' into APL-540
dennisvankekem 0c8beae
fix: added specVersion
dennisvankekem e514737
fix: removed duplicated slack key
dennisvankekem 5152107
fix: removed email from secret settings
dennisvankekem d4664fb
Merge branch 'main' into APL-540
dennisvankekem 6a93249
fix: removed async from teamSettingsMigration
dennisvankekem e8999dd
fix: auto migrate oopsie
dennisvankekem 85b47d2
fix: reverted versions to main
dennisvankekem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -567,3 +567,102 @@ describe('Build image name migration', () => { | |
| expect(deps.writeValues).toBeCalledWith(expectedValues, true) | ||
| }, 20000) | ||
| }) | ||
|
|
||
| describe('teamSettingsMigration', () => { | ||
| // Create a mock values object representing teams with settings that need migration. | ||
| const getTeamSettingsMockValues = (): any => ({ | ||
| versions: { specVersion: 1 }, | ||
| teamConfig: { | ||
| team1: { | ||
| settings: { | ||
| alerts: { | ||
| email: '[email protected]', | ||
| opsgenie: 'ops_value', | ||
| teams: 'keep this alert', | ||
| }, | ||
| selfService: { | ||
| service: ['ingress'], | ||
| access: ['downloadKubeConfig', 'shell'], | ||
| policies: ['edit policies'], | ||
| apps: ['argocd', 'gitea'], | ||
| }, | ||
| }, | ||
| }, | ||
| team2: { | ||
| settings: { | ||
| alerts: { | ||
| teams: 'team2 alert', | ||
| }, | ||
| selfService: { | ||
| service: [], | ||
| access: [], | ||
| policies: [], | ||
| apps: ['argocd'], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| // Expected values after migration: | ||
| // - The alerts block should have the 'email' and 'opsgenie' keys removed. | ||
| // - The selfService arrays ('service', 'access', 'policies', 'apps') are replaced with a new | ||
| // teamMembers object with the correct boolean values. | ||
| const getTeamSettingsExpectedValues = (): any => ({ | ||
| versions: { specVersion: 2 }, | ||
| teamConfig: { | ||
| team1: { | ||
| settings: { | ||
| alerts: { | ||
| teams: 'keep this alert', | ||
| }, | ||
| selfService: { | ||
| teamMembers: { | ||
| createServices: true, // 'ingress' was present in service. | ||
| editSecurityPolicies: true, // 'edit policies' was present in policies. | ||
| useCloudShell: true, // 'shell' was present in access. | ||
| downloadKubeconfig: true, // 'downloadKubeConfig' was present in access. | ||
| downloadDockerLogin: false, // 'downloadDockerConfig' was not provided. | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| team2: { | ||
| settings: { | ||
| alerts: { | ||
| teams: 'team2 alert', | ||
| }, | ||
| selfService: { | ||
| teamMembers: { | ||
| createServices: false, | ||
| editSecurityPolicies: false, | ||
| useCloudShell: false, | ||
| downloadKubeconfig: false, | ||
| downloadDockerLogin: false, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| // Set up the values and changes flag to trigger the teamSettingsMigration. | ||
| const teamSettingValues: any = getTeamSettingsMockValues() | ||
| const valuesChanges: any = { | ||
| version: 2, | ||
| teamSettingsMigration: true, | ||
| } | ||
| const deps: any = { | ||
| cd: jest.fn(), | ||
| rename: jest.fn(), | ||
| hfValues: jest.fn().mockReturnValue(teamSettingValues), | ||
| terminal, | ||
| writeValues: jest.fn(), | ||
| } | ||
|
|
||
| it('should migrate team settings correctly', async () => { | ||
| await applyChanges([valuesChanges], false, deps) | ||
| const expectedValues = getTeamSettingsExpectedValues() | ||
| expect(deps.writeValues).toBeCalledWith(expectedValues, true) | ||
| }, 20000) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ metadata: | |
| name: alerts | ||
| labels: {} | ||
| spec: | ||
| email: {} | ||
| msteams: {} | ||
| receivers: | ||
| - slack | ||
| - msteams | ||
| msteams: {} | ||
| slack: {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,10 @@ | ||
| kind: AplAlertSet | ||
| spec: | ||
| email: | ||
| critical: [email protected] | ||
| nonCritical: [email protected] | ||
| slack: | ||
| url: https://hooks.slack.com/services/id | ||
| msteams: | ||
| highPrio: https://xxxxxxx.com | ||
| lowPrio: https://xxxxxxxx.com | ||
| slack: | ||
| url: https://hooks.slack.com/services/id | ||
| name: alerts | ||
| metadata: | ||
| name: alerts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,6 @@ kind: AplTeamSettingSet | |
| spec: | ||
| password: somesecretvalue | ||
| alerts: | ||
| email: | ||
| critical: [email protected] | ||
| nonCritical: [email protected] | ||
| slack: | ||
| url: https://slack.con | ||
| name: demo | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,6 @@ metadata: | |
| apl.io/teamId: demo | ||
| spec: | ||
| alerts: | ||
| email: | ||
| critical: [email protected] | ||
| nonCritical: [email protected] | ||
| receivers: | ||
| - slack | ||
| repeatInterval: 3h | ||
|
|
@@ -30,14 +27,9 @@ spec: | |
| - name: services.loadbalancers | ||
| value: '0' | ||
| selfService: | ||
| access: | ||
| - shell | ||
| - downloadCertificateAuthority | ||
| apps: [] | ||
| policies: | ||
| - edit policies | ||
| service: | ||
| - ingress | ||
| team: | ||
| - alerts | ||
| password: somesecretvalue | ||
| teamMembers: | ||
| createServices: true | ||
| editSecurityPolicies: true | ||
| useCloudShell: true | ||
| downloadKubeconfig: false | ||
| downloadDockerLogin: false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.