forked from gardener/gardener-extension-registry-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently we are using StatefulSet volumeClaimTemplate to provision the PVC. However the corresponding StatefulSet field that controls the PVC size is immutable. It is not possible to resize/enlarge the underlying PVC through the StatefulSet spec. See kubernetes/enhancements#661 This commit makes the cache size field immutable until we decide how to implement the resize.
- Loading branch information
1 parent
a73babe
commit edff842
Showing
8 changed files
with
392 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package validator | ||
|
||
import ( | ||
"github.com/gardener/gardener/pkg/apis/core" | ||
|
||
"github.com/gardener/gardener-extension-registry-cache/pkg/constants" | ||
) | ||
|
||
// FindRegistryCacheExtension finds the registry-cache extension. | ||
// The first return argument is whether the extension was found. | ||
// The second return argument is index of the extension in the list. -1 is returned if the extension is not found. | ||
// The third return arguement is the extension itself. An empty extension is returned if the extension is not found. | ||
func FindRegistryCacheExtension(extensions []core.Extension) (bool, int, core.Extension) { | ||
for i, ext := range extensions { | ||
if ext.Type == constants.ExtensionType { | ||
return true, i, ext | ||
} | ||
} | ||
|
||
return false, -1, core.Extension{} | ||
} |
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,62 @@ | ||
// Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package validator_test | ||
|
||
import ( | ||
"github.com/gardener/gardener/pkg/apis/core" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
|
||
"github.com/gardener/gardener-extension-registry-cache/pkg/admission/validator" | ||
) | ||
|
||
var _ = Describe("Helpers", func() { | ||
|
||
DescribeTable("#FindRegistryCacheExtension", | ||
func(extensions []core.Extension, expectedOk bool, expectedI int, expectedExt core.Extension) { | ||
ok, i, ext := validator.FindRegistryCacheExtension(extensions) | ||
Expect(ok).To(Equal(expectedOk)) | ||
Expect(i).To(Equal(expectedI)) | ||
Expect(ext).To(Equal(expectedExt)) | ||
}, | ||
|
||
Entry("extensions is nil", | ||
nil, | ||
false, -1, core.Extension{}, | ||
), | ||
Entry("extensions is empty", | ||
[]core.Extension{}, | ||
false, -1, core.Extension{}, | ||
), | ||
Entry("no registry-cache extension", | ||
[]core.Extension{ | ||
{Type: "foo"}, | ||
{Type: "bar"}, | ||
{Type: "baz"}, | ||
}, | ||
false, -1, core.Extension{}, | ||
), | ||
Entry("with registry-cache extension", | ||
[]core.Extension{ | ||
{Type: "foo"}, | ||
{Type: "bar"}, | ||
{Type: "registry-cache", ProviderConfig: &runtime.RawExtension{Raw: []byte(`{"one": "two"}`)}}, | ||
{Type: "baz"}, | ||
}, | ||
true, 2, core.Extension{Type: "registry-cache", ProviderConfig: &runtime.RawExtension{Raw: []byte(`{"one": "two"}`)}}, | ||
), | ||
) | ||
}) |
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.