Skip to content

Commit

Permalink
Remove firewall networks from cloud profile (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Sep 25, 2020
1 parent dd292ec commit ba3090f
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 63 deletions.
4 changes: 2 additions & 2 deletions example/controller-registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
deployment:
type: helm
providerConfig:
chart: H4sIAAAAAAAAA+0ca3PbNjKf+SswynWm7ZxIvSz3NJObcxNf6rnE1jhuOjc3NxmIhCRGFMECpG1dmv9+iwdJkCJFyXbspuW2M6EA7GIB7C52F4AjRq99j7DumsQ4cJ59CegBHB8dyX8Byv/K7/5w1B8cDcZjUQ5fvaNn6OiLcFOChMeYIfSMURrvatdU/5VCVFz/l0vMYnuD18ED9tG0/oP+UWn9R6Ph8BnqPSAPtfAnX38c+e8J4z4NJ+i6b+Eoyn/27P7A7lse4S7zo1gWnqCfSLBGrpATNKcMxUuCXmPmkZAw9FYIEZpqmULkNiahIGaFeE0mqChs1nW5p6eejD8hlPTfo669oA/cR5P+Hw3K9n847vVb/X8McJwFnSyE8uKYINt24P9rEnqUOQs/XiYz26VrZ6EVPP9YYnflpHhdl4Yxo0EAcsTIwucxlIJm23xZ0nlk6z7en16+O7s417/ILV5HAXHq6IgNCb1UldMAh2SiqJ2Fc4ahVeLGCUsLf6FsRZj6YVmOg6bAK14QbbRIiGcB4cgcN0+iiGqDpgv9cCFtm0sZI26MctZQgTUrMql/dSaspP8xgXWAGeEP6Qke7v+NjnrD1v97DKhd/w9LEkSwQdtxdF9fsGH9+4NB2f877g17rf1/DPj0qYs8MvdDgjrCSeug7ufPVmrmu5kH1y35bgIPtgnZ2jKJBHhGAm6DI2mvyEaRkz+SGWEhAdGyfeqIrgo0akhc4yDRPH36hPzQDRIv49RGGnEHI9u4ZQYFlQmqaaH7lz1tj8IPQXhCl0h0+5IEBHNinwNzlZxlrPlr2DAUZwiJGn+OlphPGdTfog5f4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o9zq6IPsTPn2737dvv+5R9bdG1fn7CzGygaqwbduyCq7gxFKH4emNBuFYWm5WVf38p+rxD46kgohGzkdOw1RW84c4lS3kE5l+T51R6vcr/WHP2nomkq9KMgMdTKziMPt/s3sjdVCsL7ipZl1ZYZlPREoPRIznIQF1cdCNcLxM67K3Hz/0XvuKx8KbjvxFR6eHvncGI/S9+E8wUvcwILuLrxRTnvZWXtuvaFhx814orBrG9v347Ha8/i1jh2xo2RcxStWVbpk5yR6dVDBSfi6SWdRYFlgVD0EqqOhHG+m3eophZX+7Qckm0cuWdqGNe+tWtdBCCy200EILLbTQQgsttNBCCy200EILLbTQQgsttNBCCy200EILLbTQQgsttNDCVwz/B5YNy2gAeAAA
values:
image:
tag: v0.12.1
tag: v0.12.6
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/imdario/mergo v0.3.8
github.com/metal-stack/firewall-controller v0.1.8
github.com/metal-stack/machine-controller-manager-provider-metal v0.1.3
github.com/metal-stack/metal-go v0.8.3
github.com/metal-stack/metal-go v0.9.2
github.com/metal-stack/metal-lib v0.6.1
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ github.com/metal-stack/masterdata-api v0.7.3 h1:w2+UlvqQuJGcVlaKUjdWp6sA01ufOY+0
github.com/metal-stack/masterdata-api v0.7.3/go.mod h1:AT5m6KOkP6iyqwbDgGa1aQVdSn9bU7PkifjAmaNDLac=
github.com/metal-stack/metal-go v0.8.3 h1:qY0QVkegUOh8l+wMVvVwDWNekntiD7ZuXuTeKjxrQjY=
github.com/metal-stack/metal-go v0.8.3/go.mod h1:5emMVOjVD2tj6OxCBUYB8Xo1ruBnoP6idwypVV1pzec=
github.com/metal-stack/metal-go v0.9.2 h1:fCbxQamPwaCJLmWFBDRjk5xpyy3/VFyPOKZ++BXnfM4=
github.com/metal-stack/metal-go v0.9.2/go.mod h1:5emMVOjVD2tj6OxCBUYB8Xo1ruBnoP6idwypVV1pzec=
github.com/metal-stack/metal-lib v0.5.0 h1:C3QScS7+wNWMiERB+j0x06WpRuTHW6A3rpuILMOAgss=
github.com/metal-stack/metal-lib v0.5.0/go.mod h1:Vxr1OwM8fef1gtIv9fUiVU4Gq5mkd4ElHMpTjfuuSFQ=
github.com/metal-stack/metal-lib v0.6.1 h1:6MUqkx2gPd5cafc3a5MLkGmoRhW3zb03qYzsZUyh6pU=
Expand Down
5 changes: 1 addition & 4 deletions pkg/apis/metal/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ type MetalControlPlane struct {
}

// Partition contains configuration specific for this metal stack control plane partition
type Partition struct {
// FirewallNetworks contains a map of valid networks within this partition
FirewallNetworks map[string]string
}
type Partition struct{}

// IAMConfig contains the config for all AuthN/AuthZ related components
type IAMConfig struct {
Expand Down
5 changes: 1 addition & 4 deletions pkg/apis/metal/v1alpha1/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ type MetalControlPlane struct {
}

// Partition contains configuration specific for this metal stack control plane partition
type Partition struct {
// FirewallNetworks contains a map of valid networks within this partition
FirewallNetworks map[string]string `json:"firewallNetworks,omitempty"`
}
type Partition struct{}

// IAMConfig contains the config for all AuthN/AuthZ related components
type IAMConfig struct {
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/metal/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions pkg/apis/metal/validation/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gardener/gardener/pkg/apis/core"
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
apismetal "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal"
"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/helper"

apivalidation "k8s.io/apimachinery/pkg/api/validation"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -50,6 +51,11 @@ func ValidateInfrastructureConfigAgainstCloudProfile(infra *apismetal.Infrastruc
allErrs = append(allErrs, field.Invalid(firewallPath.Child("image"), infra.Firewall.Image, fmt.Sprintf("supported values: %v", availableFirewallImages.List())))
}

_, _, err := helper.FindMetalControlPlane(cloudProfileConfig, infra.PartitionID)
if err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("partitionID"), infra.PartitionID, "cloud profile does not define the given shoot partition"))
}

return allErrs
}

Expand Down Expand Up @@ -97,14 +103,21 @@ func ValidateInfrastructureConfig(infra *apismetal.InfrastructureConfig) field.E
}

// ValidateInfrastructureConfigUpdate validates a InfrastructureConfig object.
func ValidateInfrastructureConfigUpdate(oldConfig, newConfig *apismetal.InfrastructureConfig) field.ErrorList {
func ValidateInfrastructureConfigUpdate(oldConfig, newConfig *apismetal.InfrastructureConfig, cloudProfileConfig *apismetal.CloudProfileConfig) field.ErrorList {
allErrs := field.ErrorList{}

allErrs = append(allErrs, apivalidation.ValidateImmutableField(newConfig.ProjectID, oldConfig.ProjectID, field.NewPath("projectID"))...)
allErrs = append(allErrs, apivalidation.ValidateImmutableField(newConfig.PartitionID, oldConfig.PartitionID, field.NewPath("partitionID"))...)

firewallPath := field.NewPath("firewall")

if len(newConfig.Firewall.Networks) == 0 {
allErrs = append(allErrs, field.Required(field.NewPath("firewall.networks"), "at least one external network needs to be defined as otherwise the cluster will under no circumstances be able to bootstrap"))
allErrs = append(allErrs, field.Required(firewallPath.Child("networks"), "at least one external network needs to be defined as otherwise the cluster will under no circumstances be able to bootstrap"))
}

_, _, err := helper.FindMetalControlPlane(cloudProfileConfig, newConfig.PartitionID)
if err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("partitionID"), newConfig.PartitionID, "cloud profile does not define the given shoot partition"))
}

return allErrs
Expand Down
51 changes: 22 additions & 29 deletions pkg/apis/metal/validation/infrastructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ var _ = Describe("InfrastructureConfig validation", func() {
"prod": {
FirewallImages: []string{"image"},
Partitions: map[string]apismetal.Partition{
"partition-a": {
FirewallNetworks: map[string]string{"internet": "partition-a-network"},
},
"partition-a": {},
},
},
},
Expand Down Expand Up @@ -104,17 +102,6 @@ var _ = Describe("InfrastructureConfig validation", func() {
"Detail": Equal("supported values: [image]"),
}))))
})

It("should forbid because no firewall networks given", func() {
infrastructureConfig.Firewall.Networks = nil
errorList := ValidateInfrastructureConfigAgainstCloudProfile(infrastructureConfig, shoot, cloudProfile, cloudProfileConfig, field.NewPath("spec"))

Expect(errorList).To(ContainElement(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("spec.firewall.networks"),
"Detail": Equal("at least one external network needs to be defined as otherwise the cluster will under no circumstances be able to bootstrap"),
}))))
})
})
})

Expand Down Expand Up @@ -183,17 +170,33 @@ var _ = Describe("InfrastructureConfig validation", func() {
})

Describe("#ValidateInfrastructureConfigUpdate", func() {
var (
cloudProfileConfig *apismetal.CloudProfileConfig
)
BeforeEach(func() {
cloudProfileConfig = &apismetal.CloudProfileConfig{
MetalControlPlanes: map[string]apismetal.MetalControlPlane{
"prod": {
FirewallImages: []string{"image"},
Partitions: map[string]apismetal.Partition{
"partition-a": {},
},
},
},
}
})

It("should return no errors for an unchanged config", func() {
Expect(ValidateInfrastructureConfigUpdate(infrastructureConfig, infrastructureConfig)).To(BeEmpty())
Expect(ValidateInfrastructureConfigUpdate(infrastructureConfig, infrastructureConfig, cloudProfileConfig)).To(BeEmpty())
})

It("should not allow changing partition", func() {
newInfrastructureConfig := infrastructureConfig.DeepCopy()
newInfrastructureConfig.PartitionID = "unknown"

errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig)
errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig, cloudProfileConfig)

Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
Expect(errorList).To(ContainElements(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeInvalid),
"Field": Equal("partitionID"),
}))))
Expand All @@ -203,7 +206,7 @@ var _ = Describe("InfrastructureConfig validation", func() {
newInfrastructureConfig := infrastructureConfig.DeepCopy()
newInfrastructureConfig.ProjectID = "unknown"

errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig)
errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig, cloudProfileConfig)

Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeInvalid),
Expand All @@ -215,24 +218,14 @@ var _ = Describe("InfrastructureConfig validation", func() {
newInfrastructureConfig := infrastructureConfig.DeepCopy()
newInfrastructureConfig.Firewall.Networks = []string{}

errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig)
errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig, cloudProfileConfig)

Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("firewall.networks"),
"Detail": Equal("at least one external network needs to be defined as otherwise the cluster will under no circumstances be able to bootstrap"),
}))))
})

It("order of networks does not matter", func() {
infrastructureConfig.Firewall.Networks = []string{"a", "b"}
newInfrastructureConfig := infrastructureConfig.DeepCopy()
newInfrastructureConfig.Firewall.Networks = []string{"b", "a"}

errorList := ValidateInfrastructureConfigUpdate(infrastructureConfig, newInfrastructureConfig)

Expect(errorList).To(BeEmpty())
})
})

})
9 changes: 1 addition & 8 deletions pkg/apis/metal/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ba3090f

Please sign in to comment.