From 08824b294b9402167718951a72af6422134b660a Mon Sep 17 00:00:00 2001
From: Thomas Buchner Packages:
+ Package v1alpha1 contains the v1alpha1 version of the API.memoryone-gardenlinux.os.extensions.gardener.cloud/v1alpha1
+
+
OperatingSystemConfiguration allows to specify configuration for the operating system.
+ +Field | +Description | +
---|---|
+apiVersion
+string |
+
+
+memoryone-gardenlinux.os.extensions.gardener.cloud/v1alpha1
+
+ |
+
+kind
+string
+ |
+OperatingSystemConfiguration |
+
+memoryTopology
+
+string
+
+ |
+
+(Optional)
+ MemoryTopology allows to configure the |
+
+systemMemory
+
+string
+
+ |
+
+(Optional)
+ SystemMemory allows to configure the |
+
+Generated with gen-crd-api-reference-docs +
diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh new file mode 100755 index 000000000..6b9bda2cf --- /dev/null +++ b/hack/update-codegen.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# 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. + +set -o errexit +set -o nounset +set -o pipefail + +# We need to explicitly pass GO111MODULE=off to k8s.io/code-generator as it is significantly slower otherwise, +# see https://github.com/kubernetes/code-generator/issues/100. +export GO111MODULE=off + +rm -f $GOPATH/bin/*-gen + +PROJECT_ROOT=$(dirname $0)/.. + +bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \ + deepcopy,defaulter \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/client \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis \ + "memoryonegardenlinux:v1alpha1" \ + --go-header-file "${PROJECT_ROOT}/vendor/github.com/gardener/gardener/hack/LICENSE_BOILERPLATE.txt" + +bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \ + conversion \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/client \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis \ + github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis \ + "memoryonegardenlinux:v1alpha1" \ + --extra-peer-dirs=github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux,github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime \ + --go-header-file "${PROJECT_ROOT}/vendor/github.com/gardener/gardener/hack/LICENSE_BOILERPLATE.txt" diff --git a/pkg/apis/memoryonegardenlinux/doc.go b/pkg/apis/memoryonegardenlinux/doc.go new file mode 100644 index 000000000..6cdf0e9ef --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/doc.go @@ -0,0 +1,20 @@ +// 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. + +// +k8s:deepcopy-gen=package +// +groupName="memoryone-gardenlinux.os.extensions.gardener.cloud" + +//go:generate ../../../hack/update-codegen.sh + +package memoryonegardenlinux // import "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux" diff --git a/pkg/apis/memoryonegardenlinux/install/install.go b/pkg/apis/memoryonegardenlinux/install/install.go new file mode 100644 index 000000000..d7603b051 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/install/install.go @@ -0,0 +1,43 @@ +// 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 install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux" + "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux/v1alpha1" +) + +var ( + schemeBuilder = runtime.NewSchemeBuilder( + v1alpha1.AddToScheme, + memoryonegardenlinux.AddToScheme, + setVersionPriority, + ) + + // AddToScheme adds all APIs to the scheme. + AddToScheme = schemeBuilder.AddToScheme +) + +func setVersionPriority(scheme *runtime.Scheme) error { + return scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion) +} + +// Install installs all APIs in the scheme. +func Install(scheme *runtime.Scheme) { + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/apis/memoryonegardenlinux/register.go b/pkg/apis/memoryonegardenlinux/register.go new file mode 100644 index 000000000..2b3383e7e --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/register.go @@ -0,0 +1,47 @@ +// 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 memoryonegardenlinux + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "memoryone-gardenlinux.os.extensions.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a pointer to SchemeBuilder.AddToScheme. + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &OperatingSystemConfiguration{}, + ) + return nil +} diff --git a/pkg/apis/memoryonegardenlinux/types.go b/pkg/apis/memoryonegardenlinux/types.go new file mode 100644 index 000000000..b2cbe32d5 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/types.go @@ -0,0 +1,31 @@ +// 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 memoryonegardenlinux + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// OperatingSystemConfiguration infrastructure configuration resource +type OperatingSystemConfiguration struct { + metav1.TypeMeta + + // MemoryTopology allows to configure the `mem_topology` parameter. If not present, it will default to `2`. + MemoryTopology *string + // SystemMemory allows to configure the `system_memory` parameter. If not present, it will default to `6x`. + SystemMemory *string +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/defaults.go b/pkg/apis/memoryonegardenlinux/v1alpha1/defaults.go new file mode 100644 index 000000000..40a1e6b4a --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/defaults.go @@ -0,0 +1,43 @@ +// 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 v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/pointer" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_OperatingSystemConfiguration sets the defaults for the Garden Linux operating system configuration +func SetDefaults_OperatingSystemConfiguration(obj *OperatingSystemConfiguration) { + if isEmptyString(obj.MemoryTopology) { + obj.MemoryTopology = pointer.String("2") + } + + if isEmptyString(obj.SystemMemory) { + obj.SystemMemory = pointer.String("6x") + } +} + +// isEmptyString returns true if pointer to a string is either nil or the string has zero length +func isEmptyString(s *string) bool { + if s == nil || len(*s) == 0 { + return true + } + return false +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/doc.go b/pkg/apis/memoryonegardenlinux/v1alpha1/doc.go new file mode 100644 index 000000000..9cf880e4a --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/doc.go @@ -0,0 +1,24 @@ +// 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. + +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +//go:generate gen-crd-api-reference-docs -api-dir . -config ../../../../hack/api-reference/memoryonegardenlinux.json -template-dir ../../../../vendor/github.com/gardener/gardener/hack/api-reference/template -out-file ../../../../hack/api-reference/memoryonegardenlinux.md + +// Package v1alpha1 contains the v1alpha1 version of the API. +// +groupName=memoryone-gardenlinux.os.extensions.gardener.cloud +package v1alpha1 // import "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux/v1alpha1" diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/register.go b/pkg/apis/memoryonegardenlinux/v1alpha1/register.go new file mode 100644 index 000000000..527888eed --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/register.go @@ -0,0 +1,45 @@ +// 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 v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "memoryone-gardenlinux.os.extensions.gardener.cloud" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = runtime.NewSchemeBuilder(addDefaultingFuncs, addKnownTypes) + // AddToScheme is a pointer to SchemeBuilder.AddToScheme. + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &OperatingSystemConfiguration{}, + ) + return nil +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/types.go b/pkg/apis/memoryonegardenlinux/v1alpha1/types.go new file mode 100644 index 000000000..302243c01 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/types.go @@ -0,0 +1,34 @@ +// 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// OperatingSystemConfiguration allows to specify configuration for the operating system. +type OperatingSystemConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // MemoryTopology allows to configure the `mem_topology` parameter. If not present, it will default to `2`. + // +optional + MemoryTopology *string `json:"memoryTopology,omitempty"` + // SystemMemory allows to configure the `system_memory` parameter. If not present, it will default to `6x`. + // +optional + SystemMemory *string `json:"systemMemory,omitempty"` +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.conversion.go b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000..0be5789d0 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,72 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + memoryonegardenlinux "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*OperatingSystemConfiguration)(nil), (*memoryonegardenlinux.OperatingSystemConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_OperatingSystemConfiguration_To_memoryonegardenlinux_OperatingSystemConfiguration(a.(*OperatingSystemConfiguration), b.(*memoryonegardenlinux.OperatingSystemConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*memoryonegardenlinux.OperatingSystemConfiguration)(nil), (*OperatingSystemConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_memoryonegardenlinux_OperatingSystemConfiguration_To_v1alpha1_OperatingSystemConfiguration(a.(*memoryonegardenlinux.OperatingSystemConfiguration), b.(*OperatingSystemConfiguration), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_OperatingSystemConfiguration_To_memoryonegardenlinux_OperatingSystemConfiguration(in *OperatingSystemConfiguration, out *memoryonegardenlinux.OperatingSystemConfiguration, s conversion.Scope) error { + out.MemoryTopology = (*string)(unsafe.Pointer(in.MemoryTopology)) + out.SystemMemory = (*string)(unsafe.Pointer(in.SystemMemory)) + return nil +} + +// Convert_v1alpha1_OperatingSystemConfiguration_To_memoryonegardenlinux_OperatingSystemConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_OperatingSystemConfiguration_To_memoryonegardenlinux_OperatingSystemConfiguration(in *OperatingSystemConfiguration, out *memoryonegardenlinux.OperatingSystemConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_OperatingSystemConfiguration_To_memoryonegardenlinux_OperatingSystemConfiguration(in, out, s) +} + +func autoConvert_memoryonegardenlinux_OperatingSystemConfiguration_To_v1alpha1_OperatingSystemConfiguration(in *memoryonegardenlinux.OperatingSystemConfiguration, out *OperatingSystemConfiguration, s conversion.Scope) error { + out.MemoryTopology = (*string)(unsafe.Pointer(in.MemoryTopology)) + out.SystemMemory = (*string)(unsafe.Pointer(in.SystemMemory)) + return nil +} + +// Convert_memoryonegardenlinux_OperatingSystemConfiguration_To_v1alpha1_OperatingSystemConfiguration is an autogenerated conversion function. +func Convert_memoryonegardenlinux_OperatingSystemConfiguration_To_v1alpha1_OperatingSystemConfiguration(in *memoryonegardenlinux.OperatingSystemConfiguration, out *OperatingSystemConfiguration, s conversion.Scope) error { + return autoConvert_memoryonegardenlinux_OperatingSystemConfiguration_To_v1alpha1_OperatingSystemConfiguration(in, out, s) +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..3b76dad76 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,61 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatingSystemConfiguration) DeepCopyInto(out *OperatingSystemConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.MemoryTopology != nil { + in, out := &in.MemoryTopology, &out.MemoryTopology + *out = new(string) + **out = **in + } + if in.SystemMemory != nil { + in, out := &in.SystemMemory, &out.SystemMemory + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatingSystemConfiguration. +func (in *OperatingSystemConfiguration) DeepCopy() *OperatingSystemConfiguration { + if in == nil { + return nil + } + out := new(OperatingSystemConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatingSystemConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.defaults.go b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.defaults.go new file mode 100644 index 000000000..ce078561a --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,40 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&OperatingSystemConfiguration{}, func(obj interface{}) { + SetObjectDefaults_OperatingSystemConfiguration(obj.(*OperatingSystemConfiguration)) + }) + return nil +} + +func SetObjectDefaults_OperatingSystemConfiguration(in *OperatingSystemConfiguration) { + SetDefaults_OperatingSystemConfiguration(in) +} diff --git a/pkg/apis/memoryonegardenlinux/zz_generated.deepcopy.go b/pkg/apis/memoryonegardenlinux/zz_generated.deepcopy.go new file mode 100644 index 000000000..8550664a2 --- /dev/null +++ b/pkg/apis/memoryonegardenlinux/zz_generated.deepcopy.go @@ -0,0 +1,61 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package memoryonegardenlinux + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatingSystemConfiguration) DeepCopyInto(out *OperatingSystemConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.MemoryTopology != nil { + in, out := &in.MemoryTopology, &out.MemoryTopology + *out = new(string) + **out = **in + } + if in.SystemMemory != nil { + in, out := &in.SystemMemory, &out.SystemMemory + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatingSystemConfiguration. +func (in *OperatingSystemConfiguration) DeepCopy() *OperatingSystemConfiguration { + if in == nil { + return nil + } + out := new(OperatingSystemConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatingSystemConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/generator/generator.go b/pkg/generator/generator.go index cff986065..00c29de96 100644 --- a/pkg/generator/generator.go +++ b/pkg/generator/generator.go @@ -25,6 +25,7 @@ import ( runtimeutils "k8s.io/apimachinery/pkg/util/runtime" "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator/gardenlinux" + "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator/memoryone" ) var ( @@ -51,20 +52,33 @@ func init() { cloudInitGenerator = &GardenLinuxCloudInitGenerator{ cloudInitGenerator: ostemplate.NewCloudInitGenerator(cloudInitTemplate, ostemplate.DefaultUnitsPath, cmd, additionalValues), } + } // additionalValues provides additional values to the cloud-init template -func additionalValues(*extensionsv1alpha1.OperatingSystemConfig) (map[string]interface{}, error) { - return map[string]interface{}{ +func additionalValues(osc *extensionsv1alpha1.OperatingSystemConfig) (map[string]interface{}, error) { + values := map[string]interface{}{ "unitsToEnable": unitsToEnable, - }, nil + } + + if err := memoryone.MemoryOneValues(osc, values); err != nil { + return nil, err + } + + return values, nil +} + +// isSupportedOscType checks if the OperatingSystemConfig's type is one of those for which this extension is responsbile +func isSupportedOscType(osc *generator.OperatingSystemConfig) bool { + return osc.Object.Spec.Type == gardenlinux.OSTypeGardenLinux || + osc.Object.Spec.Type == memoryone.OSTypeMemoryOneGardenLinux } // Generate generates a Garden Linux specific cloud-init script from the given OperatingSystemConfig. func (g *GardenLinuxCloudInitGenerator) Generate(logger logr.Logger, osc *generator.OperatingSystemConfig) ([]byte, *string, error) { // we are only setting this up if the worker pool is configured with containerd - if osc.Object.Spec.Type == gardenlinux.OSTypeGardenLinux && + if isSupportedOscType(osc) && osc.Object.Spec.Purpose == extensionsv1alpha1.OperatingSystemConfigPurposeReconcile && osc.CRI != nil && osc.CRI.Name == extensionsv1alpha1.CRINameContainerD { diff --git a/pkg/generator/generator_suite_test.go b/pkg/generator/generator_suite_test.go index c3747b69d..080dd30a2 100644 --- a/pkg/generator/generator_suite_test.go +++ b/pkg/generator/generator_suite_test.go @@ -15,13 +15,20 @@ package generator_test import ( + "encoding/json" "testing" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" ) func TestInternal(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Generator Suite") } + +func encode(obj runtime.Object) []byte { + data, _ := json.Marshal(obj) + return data +} diff --git a/pkg/generator/generator_test.go b/pkg/generator/generator_test.go index de67d1d83..e278088e7 100644 --- a/pkg/generator/generator_test.go +++ b/pkg/generator/generator_test.go @@ -21,9 +21,13 @@ import ( "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/pointer" + "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux/v1alpha1" gardenlinux_generator "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator" "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator/gardenlinux" + "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator/memoryone" "github.com/gardener/gardener-extension-os-gardenlinux/pkg/generator/testfiles" ) @@ -61,7 +65,40 @@ dataKey: token`) Name: extensionsv1alpha1.CRINameContainerD, } - osctemplate = commongen.OperatingSystemConfig{ + units = []*commongen.Unit{ + { + Name: unit1, + Content: unitContent, + }, + { + Name: unit2, + Content: unitContent, + DropIns: []*commongen.DropIn{ + { + Name: dropin, + Content: dropinContent, + }, + }, + }, + { + Name: ccdService, + }, + } + + files = []*commongen.File{ + { + Path: filePath, + Content: fileContent, + Permissions: &permissions, + }, + } + + memoryOneOsConfig = &v1alpha1.OperatingSystemConfiguration{ + MemoryTopology: pointer.String("3"), + SystemMemory: pointer.String("7x"), + } + + gardenlinuxOsctemplate = commongen.OperatingSystemConfig{ Object: &extensionsv1alpha1.OperatingSystemConfig{ Spec: extensionsv1alpha1.OperatingSystemConfigSpec{ Purpose: extensionsv1alpha1.OperatingSystemConfigPurposeProvision, @@ -70,32 +107,24 @@ dataKey: token`) }, }, }, - Units: []*commongen.Unit{ - { - Name: unit1, - Content: unitContent, - }, - { - Name: unit2, - Content: unitContent, - DropIns: []*commongen.DropIn{ - { - Name: dropin, - Content: dropinContent, + Units: units, + Files: files, + } + + memoryOneOscTemplate = commongen.OperatingSystemConfig{ + Object: &extensionsv1alpha1.OperatingSystemConfig{ + Spec: extensionsv1alpha1.OperatingSystemConfigSpec{ + Purpose: extensionsv1alpha1.OperatingSystemConfigPurposeProvision, + DefaultSpec: extensionsv1alpha1.DefaultSpec{ + Type: memoryone.OSTypeMemoryOneGardenLinux, + ProviderConfig: &runtime.RawExtension{ + Raw: encode(memoryOneOsConfig), }, }, }, - { - Name: ccdService, - }, - }, - Files: []*commongen.File{ - { - Path: filePath, - Content: fileContent, - Permissions: &permissions, - }, }, + Units: units, + Files: files, } osc commongen.OperatingSystemConfig @@ -103,75 +132,174 @@ dataKey: token`) var _ = Describe("Garden Linux OS Generator Test", func() { - Describe("Conformance Tests Bootstrap", func() { - g := gardenlinux_generator.CloudInitGenerator() - test.DescribeTest(gardenlinux_generator.CloudInitGenerator(), testfiles.Files)() + Context("Garden Linux", func() { - BeforeEach(func() { - osc = osctemplate - osc.Bootstrap = true - osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeProvision - }) + Describe("Conformance Tests Bootstrap", func() { + g := gardenlinux_generator.CloudInitGenerator() + test.DescribeTest(gardenlinux_generator.CloudInitGenerator(), testfiles.Files)() - It("[docker] [bootstrap] should render correctly", func() { - e, err := testfiles.Files.ReadFile("docker-bootstrap") - expectedCloudInit := byteSlice(e) - Expect(err).NotTo(HaveOccurred()) + BeforeEach(func() { + osc = gardenlinuxOsctemplate + osc.Bootstrap = true + osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeProvision + }) - osc.CRI = nil - c, _, err := g.Generate(logger, &osc) - cloudInit := byteSlice(c) + It("[docker] [bootstrap] should render correctly", func() { + e, err := testfiles.Files.ReadFile("docker-bootstrap") + expectedCloudInit := byteSlice(e) + Expect(err).NotTo(HaveOccurred()) - Expect(err).NotTo(HaveOccurred()) - Expect(cloudInit).To(Equal(expectedCloudInit)) + osc.CRI = nil + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) + + It("[containerd] [bootstrap] should render correctly", func() { + e, err := testfiles.Files.ReadFile("containerd-bootstrap") + expectedCloudInit := byteSlice(e) + Expect(err).NotTo(HaveOccurred()) + + osc.CRI = &criConfigContainerd + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) }) - It("[containerd] [bootstrap] should render correctly", func() { - e, err := testfiles.Files.ReadFile("containerd-bootstrap") - expectedCloudInit := byteSlice(e) - Expect(err).NotTo(HaveOccurred()) + Describe("Conformance Tests Reconcile", func() { + var g = gardenlinux_generator.CloudInitGenerator() + + BeforeEach(func() { + osc = gardenlinuxOsctemplate + osc.Bootstrap = false + osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeReconcile + }) + + It("[docker] [reconcile] should render correctly", func() { + e, err := testfiles.Files.ReadFile("docker-reconcile") + Expect(err).NotTo(HaveOccurred()) + expectedCloudInit := byteSlice(e) - osc.CRI = &criConfigContainerd - c, _, err := g.Generate(logger, &osc) - cloudInit := byteSlice(c) + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) - Expect(err).NotTo(HaveOccurred()) - Expect(cloudInit).To(Equal(expectedCloudInit)) + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) + + It("[containerd] [reconcile] should render correctly", func() { + e, err := testfiles.Files.ReadFile("containerd-reconcile") + Expect(err).NotTo(HaveOccurred()) + expectedCloudInit := byteSlice(e) + + osc.CRI = &criConfigContainerd + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) }) }) - Describe("Conformance Tests Reconcile", func() { - var g = gardenlinux_generator.CloudInitGenerator() + Context("MemoryOne on Garden Linux", func() { BeforeEach(func() { - osc = osctemplate - osc.Bootstrap = false - osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeReconcile + osc = memoryOneOscTemplate }) - It("[docker] [reconcile] should render correctly", func() { - e, err := testfiles.Files.ReadFile("docker-reconcile") - Expect(err).NotTo(HaveOccurred()) - expectedCloudInit := byteSlice(e) + Describe("Conformance Tests Bootstrap", func() { + g := gardenlinux_generator.CloudInitGenerator() + test.DescribeTest(gardenlinux_generator.CloudInitGenerator(), testfiles.Files)() + + BeforeEach(func() { + osc.Bootstrap = true + osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeProvision + }) + + It("should render correctly for docker", func() { + e, err := testfiles.Files.ReadFile("memoryone-docker-bootstrap") + expectedCloudInit := byteSlice(e) + Expect(err).NotTo(HaveOccurred()) + + osc.CRI = nil + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) - c, _, err := g.Generate(logger, &osc) - cloudInit := byteSlice(c) + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) - Expect(err).NotTo(HaveOccurred()) - Expect(cloudInit).To(Equal(expectedCloudInit)) + It("should render correctly for containerd", func() { + e, err := testfiles.Files.ReadFile("memoryone-containerd-bootstrap") + expectedCloudInit := byteSlice(e) + Expect(err).NotTo(HaveOccurred()) + + osc.CRI = &criConfigContainerd + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) + + It("should render correctly with default values", func() { + e, err := testfiles.Files.ReadFile("memoryone-containerd-bootstrap-defaults") + expectedCloudInit := byteSlice(e) + Expect(err).NotTo(HaveOccurred()) + + emptyMemoryOneOsConfig := &v1alpha1.OperatingSystemConfiguration{} + + osc.Object.Spec.ProviderConfig = &runtime.RawExtension{ + Raw: encode(emptyMemoryOneOsConfig), + } + + osc.CRI = &criConfigContainerd + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) }) - It("[containerd] [reconcile] should render correctly", func() { - e, err := testfiles.Files.ReadFile("containerd-reconcile") - Expect(err).NotTo(HaveOccurred()) - expectedCloudInit := byteSlice(e) + Describe("Conformance Tests Reconcile", func() { + var g = gardenlinux_generator.CloudInitGenerator() + + BeforeEach(func() { + osc.Bootstrap = false + osc.Object.Spec.Purpose = extensionsv1alpha1.OperatingSystemConfigPurposeReconcile + }) + + It("must not render memoryone contents during reconcile for docker", func() { + e, err := testfiles.Files.ReadFile("docker-reconcile") + Expect(err).NotTo(HaveOccurred()) + expectedCloudInit := byteSlice(e) + + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) + + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) + + It("must not render memoryone contents during reconcile for containerd", func() { + e, err := testfiles.Files.ReadFile("containerd-reconcile") + Expect(err).NotTo(HaveOccurred()) + expectedCloudInit := byteSlice(e) - osc.CRI = &criConfigContainerd - c, _, err := g.Generate(logger, &osc) - cloudInit := byteSlice(c) + osc.CRI = &criConfigContainerd + c, _, err := g.Generate(logger, &osc) + cloudInit := byteSlice(c) - Expect(err).NotTo(HaveOccurred()) - Expect(cloudInit).To(Equal(expectedCloudInit)) + Expect(err).NotTo(HaveOccurred()) + Expect(cloudInit).To(Equal(expectedCloudInit)) + }) }) }) }) diff --git a/pkg/generator/memoryone/contants.go b/pkg/generator/memoryone/contants.go new file mode 100644 index 000000000..e73ef9432 --- /dev/null +++ b/pkg/generator/memoryone/contants.go @@ -0,0 +1,20 @@ +// 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 memoryone + +const ( + // OSTypMemoryOneGardenLinux is a constant for the Garden Linux extension OS type. + OSTypeMemoryOneGardenLinux = "memoryone-gardenlinux" +) diff --git a/pkg/generator/memoryone/values.go b/pkg/generator/memoryone/values.go new file mode 100644 index 000000000..c6b166b30 --- /dev/null +++ b/pkg/generator/memoryone/values.go @@ -0,0 +1,57 @@ +// Copyright (c) 2022 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 memoryone + +import ( + "fmt" + + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + runtimeutils "k8s.io/apimachinery/pkg/util/runtime" + + memoryonegardenlinux "github.com/gardener/gardener-extension-os-gardenlinux/pkg/apis/memoryonegardenlinux/v1alpha1" +) + +var decoder runtime.Decoder + +func init() { + scheme := runtime.NewScheme() + runtimeutils.Must(memoryonegardenlinux.AddToScheme(scheme)) + decoder = serializer.NewCodecFactory(scheme).UniversalDecoder() +} + +func MemoryOneValues(osc *extensionsv1alpha1.OperatingSystemConfig, values map[string]interface{}) error { + if osc.Spec.Type == OSTypeMemoryOneGardenLinux { + if osc.Spec.ProviderConfig == nil { + return nil + } + + obj := &memoryonegardenlinux.OperatingSystemConfiguration{} + if _, _, err := decoder.Decode(osc.Spec.ProviderConfig.Raw, nil, obj); err != nil { + return fmt.Errorf("failed to decode provider config: %+v", err) + } + + if obj.MemoryTopology != nil { + values["MemoryOneMemoryTopology"] = *obj.MemoryTopology + } + + if obj.SystemMemory != nil { + values["MemoryOneSystemMemory"] = *obj.SystemMemory + } + } + + return nil +} diff --git a/pkg/generator/templates/cloud-init.gardenlinux.template b/pkg/generator/templates/cloud-init.gardenlinux.template index 80c9f9d61..75affb9ab 100644 --- a/pkg/generator/templates/cloud-init.gardenlinux.template +++ b/pkg/generator/templates/cloud-init.gardenlinux.template @@ -1,5 +1,20 @@ +{{- if and (eq .Type "memoryone-gardenlinux") .Bootstrap -}} +Content-Type: multipart/mixed; boundary="==BOUNDARY==" +MIME-Version: 1.0 +--==BOUNDARY== +Content-Type: text/x-vsmp; section=vsmp +{{- if .AdditionalValues.MemoryOneSystemMemory }} +system_memory={{ .AdditionalValues.MemoryOneSystemMemory }} +{{- end }} +{{- if .AdditionalValues.MemoryOneMemoryTopology }} +mem_topology={{ .AdditionalValues.MemoryOneMemoryTopology }} +{{- end }} +--==BOUNDARY== +Content-Type: text/x-shellscript #!/bin/bash - +{{- else -}} +#!/bin/bash +{{- end -}} {{- define "put-content" -}} cat << EOF | base64 -d > '{{ .Path }}' {{ .Content }} @@ -65,3 +80,7 @@ systemctl enable containerd && systemctl restart containerd systemctl enable docker && systemctl restart docker systemctl enable cloud-config-downloader && systemctl restart cloud-config-downloader {{- end }} +{{- if and (eq .Type "memoryone-gardenlinux") .Bootstrap }} + +--==BOUNDARY== +{{- end }} diff --git a/pkg/generator/testfiles/embed.go b/pkg/generator/testfiles/embed.go index 900e7a68f..a8763b27a 100644 --- a/pkg/generator/testfiles/embed.go +++ b/pkg/generator/testfiles/embed.go @@ -18,5 +18,5 @@ import "embed" // Files contains the contents of the testfiles directory // -//go:embed cloud-* containerd-* docker-* +//go:embed cloud-* containerd-* docker-* memoryone-* var Files embed.FS diff --git a/pkg/generator/testfiles/memoryone-containerd-bootstrap b/pkg/generator/testfiles/memoryone-containerd-bootstrap new file mode 100644 index 000000000..1a30e6d6e --- /dev/null +++ b/pkg/generator/testfiles/memoryone-containerd-bootstrap @@ -0,0 +1,54 @@ +Content-Type: multipart/mixed; boundary="==BOUNDARY==" +MIME-Version: 1.0 +--==BOUNDARY== +Content-Type: text/x-vsmp; section=vsmp +system_memory=7x +mem_topology=3 +--==BOUNDARY== +Content-Type: text/x-shellscript +#!/bin/bash +if [ ! -s /etc/containerd/config.toml ]; then + mkdir -p /etc/containerd/ + containerd config default > /etc/containerd/config.toml + chmod 0644 /etc/containerd/config.toml +fi + +mkdir -p /etc/systemd/system/containerd.service.d +cat <