-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ROX-22354: autorotate DP secrets if data has changed (#1933)
* autorotate DP secrets if data has changed * add DB migration
- Loading branch information
1 parent
a3a7734
commit db7e4e0
Showing
16 changed files
with
219 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
2 changes: 2 additions & 0 deletions
2
internal/dinosaur/pkg/api/private/model_data_plane_central_status.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 9 additions & 8 deletions
17
internal/dinosaur/pkg/api/private/model_managed_central_all_of_metadata.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
...l/dinosaur/pkg/migrations/20240703120000_add_secret_data_sha256_sum_to_central_request.go
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package migrations | ||
|
||
// Migrations should NEVER use types from other packages. Types can change | ||
// and then migrations run on a _new_ database will fail or behave unexpectedly. | ||
// Instead of importing types, always re-create the type in the migration, as | ||
// is done here, even though the same type is defined in pkg/api | ||
|
||
import ( | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"github.com/pkg/errors" | ||
"github.com/stackrox/acs-fleet-manager/pkg/db" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func addSecretDataSha256SumToCentralRequest() *gormigrate.Migration { | ||
type CentralRequest struct { | ||
db.Model | ||
SecretDataSha256Sum string `json:"secret_data_sha256_sum"` | ||
} | ||
migrationID := "20240703120000" | ||
|
||
return &gormigrate.Migration{ | ||
ID: migrationID, | ||
Migrate: func(tx *gorm.DB) error { | ||
return addColumnIfNotExists(tx, &CentralRequest{}, "secret_data_sha256_sum") | ||
}, | ||
Rollback: func(tx *gorm.DB) error { | ||
return errors.Wrap( | ||
tx.Migrator().DropColumn(&CentralRequest{}, "secret_data_sha256_sum"), | ||
"failed to drop secret_data_sha256_sum column", | ||
) | ||
}, | ||
} | ||
} |
This file contains 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 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 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.