Skip to content

Commit

Permalink
Allow changing the project creator of the "garden" project (#83)
Browse files Browse the repository at this point in the history
* Allow changing the project creator of the "garden" project

* Update pkg/apis/core/validation/project.go

Co-authored-by: Tim Ebert <[email protected]>

---------

Co-authored-by: Tim Ebert <[email protected]>
  • Loading branch information
2 people authored and ske-prow[bot] committed Jul 24, 2024
1 parent 4e8643e commit 71ba735
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/apis/core/validation/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ func ValidateProjectUpdate(newProject, oldProject *core.Project) field.ErrorList
allErrs = append(allErrs, ValidateProject(newProject)...)

if oldProject.Spec.CreatedBy != nil {
allErrs = append(allErrs, apivalidation.ValidateImmutableField(newProject.Spec.CreatedBy, oldProject.Spec.CreatedBy, field.NewPath("spec", "createdBy"))...)
// allow mutating the creator of the garden project only for the gardener-operator migration
// TODO: drop this change after the migration from yake to gardener-operator
if oldProject.Name != "garden" {
allErrs = append(allErrs, apivalidation.ValidateImmutableField(newProject.Spec.CreatedBy, oldProject.Spec.CreatedBy, field.NewPath("spec", "createdBy"))...)
}
}
if oldProject.Spec.Namespace != nil {
allErrs = append(allErrs, apivalidation.ValidateImmutableField(newProject.Spec.Namespace, oldProject.Spec.Namespace, field.NewPath("spec", "namespace"))...)
Expand Down

0 comments on commit 71ba735

Please sign in to comment.