From 2b3fb21808946620f77a2752c4d8e4aa864b6d7b Mon Sep 17 00:00:00 2001 From: Sven Pfennig Date: Wed, 8 Jan 2025 09:02:50 +0100 Subject: [PATCH] refactor(domain-name): replace kwasm.sh with spinkube.dev Signed-off-by: Sven Pfennig --- CONTRIBUTING.md | 4 +- Makefile | 4 +- PROJECT | 8 +- api/v1alpha1/groupversion_info.go | 4 +- cmd/node-installer/config.go | 2 +- cmd/node-installer/detect_test.go | 14 +- cmd/node-installer/install.go | 10 +- cmd/node-installer/install_test.go | 4 +- cmd/node-installer/root.go | 16 +- cmd/node-installer/uninstall.go | 4 +- cmd/rcm/main.go | 2 +- config/crd/bases/runtime.kwasm.sh_shims.yaml | 4 +- .../crd/bases/runtime.spinkube.dev_shims.yaml | 173 ++++++++++++++++++ config/crd/kustomization.yaml | 2 +- config/rbac/role.yaml | 6 +- config/rbac/shim_editor_role.yaml | 4 +- config/rbac/shim_viewer_role.yaml | 4 +- config/samples/test_shim_lunatic.yaml | 2 +- config/samples/test_shim_slight.yaml | 2 +- config/samples/test_shim_spin.yaml | 2 +- config/samples/test_shim_wws.yaml | 2 +- deploy/helm/README.md | 2 +- deploy/helm/crds/runtime.kwasm.sh_shims.yaml | 4 +- deploy/helm/templates/clusterrole.yaml | 4 +- images/installer/Dockerfile | 8 +- internal/containerd/configure.go | 2 +- internal/containerd/configure_test.go | 20 +- internal/controller/job_controller.go | 6 +- internal/controller/node_controller.go | 20 +- internal/controller/shim_controller.go | 20 +- internal/shim/install.go | 4 +- internal/shim/install_test.go | 22 +-- internal/shim/shim.go | 6 +- internal/shim/uninstall.go | 2 +- internal/shim/uninstall_test.go | 18 +- internal/state/shim_test.go | 12 +- internal/state/state.go | 4 +- internal/state/state_test.go | 22 +-- jobs.yaml | 75 -------- test-crd.yaml | 45 ----- test.yaml | 93 ---------- .../etc/containerd/config.toml | 4 +- .../opt/kwasm/bin/containerd-shim-spin-v1 | 3 - .../kwasm-lock.json => rcm/rcm-lock.json} | 4 +- .../kwasm-lock.json => rcm/rcm-lock.json} | 4 +- .../opt/kwasm/bin/containerd-shim-spin-v1 | 3 - .../kwasm-lock.json => rcm/rcm-lock.json} | 4 +- 47 files changed, 318 insertions(+), 366 deletions(-) create mode 100644 config/crd/bases/runtime.spinkube.dev_shims.yaml delete mode 100644 jobs.yaml delete mode 100644 test-crd.yaml delete mode 100644 test.yaml delete mode 100644 testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/bin/containerd-shim-spin-v1 rename testdata/node-installer/containerd/existing-containerd-shim-config/opt/{kwasm/kwasm-lock.json => rcm/rcm-lock.json} (68%) rename testdata/node-installer/shim-missing-binary/opt/{kwasm/kwasm-lock.json => rcm/rcm-lock.json} (68%) delete mode 100644 testdata/node-installer/shim/opt/kwasm/bin/containerd-shim-spin-v1 rename testdata/node-installer/shim/opt/{kwasm/kwasm-lock.json => rcm/rcm-lock.json} (68%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78805469..ac3b67c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,12 +52,12 @@ registry: ghcr.io/your-gh-username/runtime-class-manager The `Tiltfile` included in this repository will take care of the following: -- Create the `kwasm` namespace and install the controller helm-chart in it. +- Create the `runtime-class-manager` namespace and install the controller helm-chart in it. - Inject the development image in the deployment. - Automatically reload the controller when you make changes to the code. To run the controller, you just need to run the following command against an empty cluster: ```console -$ tilt up --stream +tilt up --stream ``` diff --git a/Makefile b/Makefile index c7f0ec9a..0ab7ca08 100644 --- a/Makefile +++ b/Makefile @@ -198,11 +198,11 @@ $(ENVTEST): $(LOCALBIN) .PHONY: create-test-cluster create-kind-cluster: - kind create cluster --config ./hack/kind.yaml --name kwasm + kind create cluster --config ./hack/kind.yaml --name rcm .PHONY: kind-delete kind-delete: - kind delete cluster --name kwasm + kind delete cluster --name rcm .PHONY: kind kind: create-kind-cluster install diff --git a/PROJECT b/PROJECT index e7221601..48ba6d5c 100644 --- a/PROJECT +++ b/PROJECT @@ -2,7 +2,7 @@ # This file is used to track the info used to scaffold your project # and allow the plugins properly work. # More info: https://book.kubebuilder.io/reference/project-config.html -domain: kwasm.sh +domain: spinkube.dev layout: - go.kubebuilder.io/v4 projectName: runtime-class-manager @@ -12,18 +12,18 @@ resources: crdVersion: v1 namespaced: true controller: true - domain: kwasm.sh + domain: spinkube.dev group: runtime kind: Shim path: github.com/spinkube/runtime-class-manager/api/v1alpha1 version: v1alpha1 - controller: true - domain: kwasm.sh + domain: spinkube.dev group: runtime kind: Node version: v1alpha1 - controller: true - domain: kwasm.sh + domain: spinkube.dev group: runtime kind: Job version: v1alpha1 diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 34d82fc5..51c25475 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -16,7 +16,7 @@ limitations under the License. // Package v1alpha1 contains API Schema definitions for the runtime v1alpha1 API group // +kubebuilder:object:generate=true -// +groupName=runtime.kwasm.sh +// +groupName=runtime.spinkube.dev package v1alpha1 import ( @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "runtime.kwasm.sh", Version: "v1alpha1"} + GroupVersion = schema.GroupVersion{Group: "runtime.spinkube.dev", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/cmd/node-installer/config.go b/cmd/node-installer/config.go index c3677aec..d7d3dc3c 100644 --- a/cmd/node-installer/config.go +++ b/cmd/node-installer/config.go @@ -21,7 +21,7 @@ type Config struct { Name string ConfigPath string } - Kwasm struct { + RCM struct { Path string AssetPath string } diff --git a/cmd/node-installer/detect_test.go b/cmd/node-installer/detect_test.go index e86195e6..e4f8c850 100644 --- a/cmd/node-installer/detect_test.go +++ b/cmd/node-installer/detect_test.go @@ -49,7 +49,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/default"), @@ -68,7 +68,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/default"), @@ -87,7 +87,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/unsupported"), @@ -106,7 +106,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/microk8s"), @@ -125,7 +125,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/k0s"), @@ -144,7 +144,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/k3s"), @@ -163,7 +163,7 @@ func Test_DetectDistro(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{""}, }, tests.FixtureFs("../../testdata/node-installer/distros/rke2"), diff --git a/cmd/node-installer/install.go b/cmd/node-installer/install.go index 0aaa3405..0f1d2fb7 100644 --- a/cmd/node-installer/install.go +++ b/cmd/node-installer/install.go @@ -58,13 +58,13 @@ var installCmd = &cobra.Command{ } func init() { - installCmd.Flags().StringVarP(&config.Kwasm.AssetPath, "asset-path", "a", "/assets", "Path to the asset to install") + installCmd.Flags().StringVarP(&config.RCM.AssetPath, "asset-path", "a", "/assets", "Path to the asset to install") rootCmd.AddCommand(installCmd) } func RunInstall(config Config, rootFs, hostFs afero.Fs, restarter containerd.Restarter) error { // Get file or directory information. - info, err := rootFs.Stat(config.Kwasm.AssetPath) + info, err := rootFs.Stat(config.RCM.AssetPath) if err != nil { return err } @@ -72,18 +72,18 @@ func RunInstall(config Config, rootFs, hostFs afero.Fs, restarter containerd.Res var files []fs.FileInfo // Check if the path is a directory. if info.IsDir() { - files, err = afero.ReadDir(rootFs, config.Kwasm.AssetPath) + files, err = afero.ReadDir(rootFs, config.RCM.AssetPath) if err != nil { return err } } else { // If the path is not a directory, add the file to the list of files. files = append(files, info) - config.Kwasm.AssetPath = path.Dir(config.Kwasm.AssetPath) + config.RCM.AssetPath = path.Dir(config.RCM.AssetPath) } containerdConfig := containerd.NewConfig(hostFs, config.Runtime.ConfigPath, restarter) - shimConfig := shim.NewConfig(rootFs, hostFs, config.Kwasm.AssetPath, config.Kwasm.Path) + shimConfig := shim.NewConfig(rootFs, hostFs, config.RCM.AssetPath, config.RCM.Path) anythingChanged := false for _, file := range files { diff --git a/cmd/node-installer/install_test.go b/cmd/node-installer/install_test.go index 8dc8fa78..3ce314e5 100644 --- a/cmd/node-installer/install_test.go +++ b/cmd/node-installer/install_test.go @@ -53,7 +53,7 @@ func Test_RunInstall(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{"/containerd/missing-containerd-shim-config"}, }, tests.FixtureFs("../../testdata/node-installer"), @@ -72,7 +72,7 @@ func Test_RunInstall(t *testing.T) { struct { Path string AssetPath string - }{"/opt/kwasm", "/assets"}, + }{"/opt/rcm", "/assets"}, struct{ RootPath string }{"/containerd/existing-containerd-shim-config"}, }, tests.FixtureFs("../../testdata/node-installer"), diff --git a/cmd/node-installer/root.go b/cmd/node-installer/root.go index 42b1d8a5..f7254889 100644 --- a/cmd/node-installer/root.go +++ b/cmd/node-installer/root.go @@ -27,14 +27,12 @@ import ( "github.com/spf13/viper" ) -var ( - config Config -) +var config Config // rootCmd represents the base command when called without any subcommands. var rootCmd = &cobra.Command{ - Use: "kwasm-node-installer", - Short: "kwasm-node-installer manages containerd shims", + Use: "rcm-node-installer", + Short: "rcm-node-installer manages containerd shims", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { return initializeConfig(cmd) }, @@ -52,14 +50,14 @@ func Execute() { func init() { rootCmd.PersistentFlags().StringVarP(&config.Runtime.Name, "runtime", "r", "containerd", "Set the container runtime to configure (containerd, cri-o)") rootCmd.PersistentFlags().StringVarP(&config.Runtime.ConfigPath, "runtime-config", "c", "", "Path to the runtime config file. Will try to autodetect if left empty") - rootCmd.PersistentFlags().StringVarP(&config.Kwasm.Path, "kwasm-path", "k", "/opt/kwasm", "Working directory for kwasm on the host") + rootCmd.PersistentFlags().StringVarP(&config.RCM.Path, "rcm-path", "k", "/opt/rcm", "Working directory for the RuntimeClassManager on the host") rootCmd.PersistentFlags().StringVarP(&config.Host.RootPath, "host-root", "H", "/", "Path to the host root path") } func initializeConfig(cmd *cobra.Command) error { v := viper.New() - v.SetConfigName("kwasm") + v.SetConfigName("rcm") v.AddConfigPath(".") v.AddConfigPath("/etc") @@ -70,8 +68,8 @@ func initializeConfig(cmd *cobra.Command) error { } } - // Environment variables are prefixed with KWASM_ - v.SetEnvPrefix("KWASM") + // Environment variables are prefixed with RCM_ + v.SetEnvPrefix("RCM") // - is replaced with _ in environment variables v.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) diff --git a/cmd/node-installer/uninstall.go b/cmd/node-installer/uninstall.go index ec076532..03e8edd9 100644 --- a/cmd/node-installer/uninstall.go +++ b/cmd/node-installer/uninstall.go @@ -59,10 +59,10 @@ func init() { func RunUninstall(config Config, rootFs, hostFs afero.Fs, restarter containerd.Restarter) error { slog.Info("uninstall called", "shim", config.Runtime.Name) shimName := config.Runtime.Name - runtimeName := path.Join(config.Kwasm.Path, "bin", shimName) + runtimeName := path.Join(config.RCM.Path, "bin", shimName) containerdConfig := containerd.NewConfig(hostFs, config.Runtime.ConfigPath, restarter) - shimConfig := shim.NewConfig(rootFs, hostFs, config.Kwasm.AssetPath, config.Kwasm.Path) + shimConfig := shim.NewConfig(rootFs, hostFs, config.RCM.AssetPath, config.RCM.Path) binPath, err := shimConfig.Uninstall(shimName) if err != nil { diff --git a/cmd/rcm/main.go b/cmd/rcm/main.go index ca5dcca9..8eb14640 100644 --- a/cmd/rcm/main.go +++ b/cmd/rcm/main.go @@ -72,7 +72,7 @@ func main() { Metrics: metricsserver.Options{BindAddress: metricsAddr}, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "7584d300.kwasm.sh", + LeaderElectionID: "7584d300.spinkube.dev", // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily // when the Manager ends. This requires the binary to immediately end when the // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly diff --git a/config/crd/bases/runtime.kwasm.sh_shims.yaml b/config/crd/bases/runtime.kwasm.sh_shims.yaml index 61f9cc05..1ecf6a15 100644 --- a/config/crd/bases/runtime.kwasm.sh_shims.yaml +++ b/config/crd/bases/runtime.kwasm.sh_shims.yaml @@ -4,9 +4,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.16.3 - name: shims.runtime.kwasm.sh + name: shims.runtime.spinkube.dev spec: - group: runtime.kwasm.sh + group: runtime.spinkube.dev names: kind: Shim listKind: ShimList diff --git a/config/crd/bases/runtime.spinkube.dev_shims.yaml b/config/crd/bases/runtime.spinkube.dev_shims.yaml new file mode 100644 index 00000000..1ecf6a15 --- /dev/null +++ b/config/crd/bases/runtime.spinkube.dev_shims.yaml @@ -0,0 +1,173 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.3 + name: shims.runtime.spinkube.dev +spec: + group: runtime.spinkube.dev + names: + kind: Shim + listKind: ShimList + plural: shims + singular: shim + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .spec.runtimeClass.name + name: RuntimeClass + type: string + - jsonPath: .status.nodesReady + name: Ready + type: integer + - jsonPath: .status.nodes + name: Nodes + type: integer + name: v1alpha1 + schema: + openAPIV3Schema: + description: Shim is the Schema for the shims API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ShimSpec defines the desired state of Shim + properties: + fetchStrategy: + properties: + anonHttp: + properties: + location: + type: string + required: + - location + type: object + type: + type: string + required: + - anonHttp + - type + type: object + nodeSelector: + additionalProperties: + type: string + type: object + rolloutStrategy: + properties: + rolling: + properties: + maxUpdate: + type: integer + required: + - maxUpdate + type: object + type: + enum: + - rolling + - recreate + type: string + required: + - type + type: object + runtimeClass: + properties: + handler: + type: string + name: + type: string + required: + - handler + - name + type: object + required: + - fetchStrategy + - rolloutStrategy + - runtimeClass + type: object + status: + description: ShimStatus defines the observed state of Shim + properties: + conditions: + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + nodes: + type: integer + nodesReady: + type: integer + required: + - nodes + - nodesReady + type: object + type: object + served: true + storage: true + subresources: {} diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 96e86087..ac1b0113 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -2,7 +2,7 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/runtime.kwasm.sh_shims.yaml +- bases/runtime.spinkube.dev_shims.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 2e79c10b..ec4ed177 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -31,7 +31,7 @@ rules: - patch - update - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims verbs: @@ -43,13 +43,13 @@ rules: - update - watch - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims/finalizers verbs: - update - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims/status verbs: diff --git a/config/rbac/shim_editor_role.yaml b/config/rbac/shim_editor_role.yaml index 1d5c113c..a0d3df93 100644 --- a/config/rbac/shim_editor_role.yaml +++ b/config/rbac/shim_editor_role.yaml @@ -12,7 +12,7 @@ metadata: name: shim-editor-role rules: - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims verbs: @@ -24,7 +24,7 @@ rules: - update - watch - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims/status verbs: diff --git a/config/rbac/shim_viewer_role.yaml b/config/rbac/shim_viewer_role.yaml index ea2175a6..ae482ec7 100644 --- a/config/rbac/shim_viewer_role.yaml +++ b/config/rbac/shim_viewer_role.yaml @@ -12,7 +12,7 @@ metadata: name: shim-viewer-role rules: - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims verbs: @@ -20,7 +20,7 @@ rules: - list - watch - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims/status verbs: diff --git a/config/samples/test_shim_lunatic.yaml b/config/samples/test_shim_lunatic.yaml index d28a5b7d..5a61074b 100644 --- a/config/samples/test_shim_lunatic.yaml +++ b/config/samples/test_shim_lunatic.yaml @@ -1,4 +1,4 @@ -apiVersion: runtime.kwasm.sh/v1alpha1 +apiVersion: runtime.spinkube.dev/v1alpha1 kind: Shim metadata: name: lunatic-v1 diff --git a/config/samples/test_shim_slight.yaml b/config/samples/test_shim_slight.yaml index 7a430824..eecfd6d7 100644 --- a/config/samples/test_shim_slight.yaml +++ b/config/samples/test_shim_slight.yaml @@ -1,4 +1,4 @@ -apiVersion: runtime.kwasm.sh/v1alpha1 +apiVersion: runtime.spinkube.dev/v1alpha1 kind: Shim metadata: name: slight-v1 diff --git a/config/samples/test_shim_spin.yaml b/config/samples/test_shim_spin.yaml index c709e5fa..b91d40e9 100644 --- a/config/samples/test_shim_spin.yaml +++ b/config/samples/test_shim_spin.yaml @@ -1,4 +1,4 @@ -apiVersion: runtime.kwasm.sh/v1alpha1 +apiVersion: runtime.spinkube.dev/v1alpha1 kind: Shim metadata: name: spin-v2 diff --git a/config/samples/test_shim_wws.yaml b/config/samples/test_shim_wws.yaml index d74465c2..b1c9df08 100644 --- a/config/samples/test_shim_wws.yaml +++ b/config/samples/test_shim_wws.yaml @@ -1,4 +1,4 @@ -apiVersion: runtime.kwasm.sh/v1alpha1 +apiVersion: runtime.spinkube.dev/v1alpha1 kind: Shim metadata: name: wws-v1 diff --git a/deploy/helm/README.md b/deploy/helm/README.md index 121e9b3d..e6adbeb8 100644 --- a/deploy/helm/README.md +++ b/deploy/helm/README.md @@ -1,6 +1,6 @@ # runtime-class-manager -runtime-class-manager is a Kubernetes operator that manages installation of Wasm shims onto nodes and related Runtimeclasses via [Shim custom resources](../../config/crd/bases/runtime.kwasm.sh_shims.yaml). +runtime-class-manager is a Kubernetes operator that manages installation of Wasm shims onto nodes and related Runtimeclasses via [Shim custom resources](../../config/crd/bases/runtime.spinkube.dev_shims.yaml). ## Prerequisites diff --git a/deploy/helm/crds/runtime.kwasm.sh_shims.yaml b/deploy/helm/crds/runtime.kwasm.sh_shims.yaml index 8b8cb649..efd63ce4 100644 --- a/deploy/helm/crds/runtime.kwasm.sh_shims.yaml +++ b/deploy/helm/crds/runtime.kwasm.sh_shims.yaml @@ -4,9 +4,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.13.0 - name: shims.runtime.kwasm.sh + name: shims.runtime.spinkube.dev spec: - group: runtime.kwasm.sh + group: runtime.spinkube.dev names: kind: Shim listKind: ShimList diff --git a/deploy/helm/templates/clusterrole.yaml b/deploy/helm/templates/clusterrole.yaml index 2173fa3e..add26553 100644 --- a/deploy/helm/templates/clusterrole.yaml +++ b/deploy/helm/templates/clusterrole.yaml @@ -29,7 +29,7 @@ rules: - patch - apiGroups: - - runtime.kwasm.sh + - runtime.spinkube.dev resources: - shims verbs: @@ -48,4 +48,4 @@ rules: - watch - create - delete - - patch \ No newline at end of file + - patch diff --git a/images/installer/Dockerfile b/images/installer/Dockerfile index 37af4eb0..3a52e776 100644 --- a/images/installer/Dockerfile +++ b/images/installer/Dockerfile @@ -7,10 +7,10 @@ RUN go mod download COPY . . -RUN CGO_ENABLED=0 go build -o kwasm-node-installer ./cmd/node-installer -RUN /app/kwasm-node-installer -h +RUN CGO_ENABLED=0 go build -o rcm-node-installer ./cmd/node-installer +RUN /app/rcm-node-installer -h FROM scratch -COPY --from=builder /app/kwasm-node-installer /kwasm-node-installer +COPY --from=builder /app/rcm-node-installer /rcm-node-installer -ENTRYPOINT ["/kwasm-node-installer"] +ENTRYPOINT ["/rcm-node-installer"] diff --git a/internal/containerd/configure.go b/internal/containerd/configure.go index 9aedad7e..c41f15f3 100644 --- a/internal/containerd/configure.go +++ b/internal/containerd/configure.go @@ -115,7 +115,7 @@ func (c *Config) RestartRuntime() error { func generateConfig(shimPath string, runtimeName string) string { return fmt.Sprintf(` -# KWASM runtime config for %s +# RCM runtime config for %s [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.%s] runtime_type = "%s" `, runtimeName, runtimeName, shimPath) diff --git a/internal/containerd/configure_test.go b/internal/containerd/configure_test.go index 0f1625df..fb85adef 100644 --- a/internal/containerd/configure_test.go +++ b/internal/containerd/configure_test.go @@ -43,7 +43,7 @@ func TestConfig_AddRuntime(t *testing.T) { {"missing shim config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins] + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, false, `[plugins] [plugins."io.containerd.monitor.v1.cgroups"] no_prometheus = false [plugins."io.containerd.service.v1.diff-service"] @@ -61,18 +61,18 @@ func TestConfig_AddRuntime(t *testing.T) { blockio_config_file = "" rdt_config_file = "" -# KWASM runtime config for spin-v1 +# RCM runtime config for spin-v1 [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin-v1] -runtime_type = "/opt/kwasm/bin/containerd-shim-spin-v1" +runtime_type = "/opt/rcm/bin/containerd-shim-spin-v1" `}, {"missing config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, true, ``}, + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, true, ``}, {"existing shim config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins] + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, false, `[plugins] [plugins."io.containerd.monitor.v1.cgroups"] no_prometheus = false [plugins."io.containerd.service.v1.diff-service"] @@ -90,9 +90,9 @@ runtime_type = "/opt/kwasm/bin/containerd-shim-spin-v1" blockio_config_file = "" rdt_config_file = "" -# KWASM runtime config for spin-v1 +# RCM runtime config for spin-v1 [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin-v1] -runtime_type = "/opt/kwasm/bin/containerd-shim-spin-v1" +runtime_type = "/opt/rcm/bin/containerd-shim-spin-v1" `}, } for _, tt := range tests { @@ -136,7 +136,7 @@ func TestConfig_RemoveRuntime(t *testing.T) { {"missing shim config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins] + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, false, `[plugins] [plugins."io.containerd.monitor.v1.cgroups"] no_prometheus = false [plugins."io.containerd.service.v1.diff-service"] @@ -157,11 +157,11 @@ func TestConfig_RemoveRuntime(t *testing.T) { {"missing config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, true, ``}, + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, true, ``}, {"existing shim config", fields{ hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"), configPath: "/etc/containerd/config.toml", - }, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins] + }, args{"/opt/rcm/bin/containerd-shim-spin-v1"}, false, `[plugins] [plugins."io.containerd.monitor.v1.cgroups"] no_prometheus = false [plugins."io.containerd.service.v1.diff-service"] diff --git a/internal/controller/job_controller.go b/internal/controller/job_controller.go index 2d0a8113..a684b3b2 100644 --- a/internal/controller/job_controller.go +++ b/internal/controller/job_controller.go @@ -74,11 +74,11 @@ func (jr *JobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. return ctrl.Result{}, fmt.Errorf("failed to get Job: %w", err) } - if _, exists := job.Labels["kwasm.sh/shimName"]; !exists { + if _, exists := job.Labels["spinkube.dev/shimName"]; !exists { return ctrl.Result{}, nil } - shimName := job.Labels["kwasm.sh/shimName"] + shimName := job.Labels["spinkube.dev/shimName"] node, err := jr.getNode(ctx, job.Spec.Template.Spec.NodeName) if err != nil { @@ -105,7 +105,7 @@ func (jr *JobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. case batchv1.JobComplete: log.Info().Msgf("Job %s is Completed.", job.Name) - installOrUninstall := job.Annotations["kwasm.sh/operation"] + installOrUninstall := job.Annotations["spinkube.dev/operation"] switch installOrUninstall { case INSTALL: diff --git a/internal/controller/node_controller.go b/internal/controller/node_controller.go index c66932aa..20ef3153 100644 --- a/internal/controller/node_controller.go +++ b/internal/controller/node_controller.go @@ -41,11 +41,11 @@ package controller // Scheme *runtime.Scheme // } -// const ControllerPrefix = "kwasm.sh/" +// const ControllerPrefix = "spinkube.dev/" -// //+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=nodes,verbs=get;list;watch;create;update;patch;delete -// //+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=nodes/status,verbs=get;update;patch -// //+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=nodes/finalizers,verbs=update +// //+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=nodes,verbs=get;list;watch;create;update;patch;delete +// //+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=nodes/status,verbs=get;update;patch +// //+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=nodes/finalizers,verbs=update // // Reconcile is part of the main kubernetes reconciliation loop which aims to // // move the current state of the cluster closer to the desired state. @@ -76,8 +76,8 @@ package controller // // Get all Annotations that contain a Shim name // // This are annotations like -// // * "kwasm.sh/" -// // * example: "kwasm.sh/shim-spin-v2" where is the name of the shim resource +// // * "spinkube.dev/" +// // * example: "spinkube.dev/shim-spin-v2" where is the name of the shim resource // var shimList []string // for i := range node.Annotations { // if strings.HasPrefix(i, ControllerPrefix) { @@ -102,8 +102,8 @@ package controller // } // // Check if node has provisioned labels for every shim -// // * "kwasm.sh/" = "provisioned" -// // * example: "kwasm.sh/shim-spin-v2" = "provisioned" means node has "shim-spin-v2" installed +// // * "spinkube.dev/" = "provisioned" +// // * example: "spinkube.dev/shim-spin-v2" = "provisioned" means node has "shim-spin-v2" installed // log.Info().Msgf("%s> Check if Shim provisioned...", node.Name) // for _, shimName := range shimList { @@ -239,8 +239,8 @@ package controller // Name: name[:nameMax], // Namespace: os.Getenv("CONTROLLER_NAMESPACE"), // Labels: map[string]string{ -// "kwasm.sh/job": "true", -// "kwasm.sh/" + shimName: "true", +// "spinkube.dev/job": "true", +// "spinkube.dev/" + shimName: "true", // "node": node.Name, // }, // }, diff --git a/internal/controller/shim_controller.go b/internal/controller/shim_controller.go index 36beff75..3ad3999a 100644 --- a/internal/controller/shim_controller.go +++ b/internal/controller/shim_controller.go @@ -66,9 +66,9 @@ type opConfig struct { args []string } -//+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=shims,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=shims/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=runtime.kwasm.sh,resources=shims/finalizers,verbs=update +//+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=shims,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=shims/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=runtime.spinkube.dev,resources=shims/finalizers,verbs=update // SetupWithManager sets up the controller with the Manager. func (sr *ShimReconciler) SetupWithManager(mgr ctrl.Manager) error { @@ -398,15 +398,15 @@ func (sr *ShimReconciler) createJobManifest(shim *rcmv1.Shim, node *corev1.Node, Name: name[:nameMax], Namespace: os.Getenv("CONTROLLER_NAMESPACE"), Annotations: map[string]string{ - "kwasm.sh/nodeName": node.Name, - "kwasm.sh/shimName": shim.Name, - "kwasm.sh/operation": operation, + "spinkube.dev/nodeName": node.Name, + "spinkube.dev/shimName": shim.Name, + "spinkube.dev/operation": operation, }, Labels: map[string]string{ - name[:nameMax]: "true", - "kwasm.sh/shimName": shim.Name, - "kwasm.sh/operation": operation, - "kwasm.sh/job": "true", + name[:nameMax]: "true", + "spinkube.dev/shimName": shim.Name, + "spinkube.dev/operation": operation, + "spinkube.dev/job": "true", }, }, Spec: batchv1.JobSpec{ diff --git a/internal/shim/install.go b/internal/shim/install.go index 965f6840..6638346e 100644 --- a/internal/shim/install.go +++ b/internal/shim/install.go @@ -32,7 +32,7 @@ func (c *Config) Install(shimName string) (filePath string, changed bool, err er if err != nil { return "", false, err } - dstFilePath := path.Join(c.kwasmPath, "bin", shimName) + dstFilePath := path.Join(c.rcmPath, "bin", shimName) err = c.hostFs.MkdirAll(path.Dir(dstFilePath), 0o775) //nolint:mnd // file permissions if err != nil { @@ -44,7 +44,7 @@ func (c *Config) Install(shimName string) (filePath string, changed bool, err er return "", false, err } - st, err := state.Get(c.hostFs, c.kwasmPath) + st, err := state.Get(c.hostFs, c.rcmPath) if err != nil { return "", false, err } diff --git a/internal/shim/install_test.go b/internal/shim/install_test.go index fc363f42..1317173b 100644 --- a/internal/shim/install_test.go +++ b/internal/shim/install_test.go @@ -34,7 +34,7 @@ func TestConfig_Install(t *testing.T) { rootFs afero.Fs hostFs afero.Fs assetPath string - kwasmPath string + rcmPath string } type args struct { shimName string @@ -52,11 +52,11 @@ func TestConfig_Install(t *testing.T) { tests.FixtureFs("../../testdata/node-installer"), afero.NewMemMapFs(), "/assets", - "/opt/kwasm", + "/opt/rcm", }, args{"containerd-shim-slight-v1"}, wants{ - "/opt/kwasm/bin/containerd-shim-slight-v1", + "/opt/rcm/bin/containerd-shim-slight-v1", true, }, false, @@ -67,11 +67,11 @@ func TestConfig_Install(t *testing.T) { tests.FixtureFs("../../testdata/node-installer"), tests.FixtureFs("../../testdata/node-installer/shim"), "/assets", - "/opt/kwasm", + "/opt/rcm", }, args{"containerd-shim-spin-v1"}, wants{ - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", false, }, false, @@ -82,11 +82,11 @@ func TestConfig_Install(t *testing.T) { tests.FixtureFs("../../testdata/node-installer"), tests.FixtureFs("../../testdata/node-installer/shim"), "/assets", - "/opt/kwasm", + "/opt/rcm", }, args{"containerd-shim-slight-v1"}, wants{ - "/opt/kwasm/bin/containerd-shim-slight-v1", + "/opt/rcm/bin/containerd-shim-slight-v1", true, }, false, @@ -97,7 +97,7 @@ func TestConfig_Install(t *testing.T) { afero.NewMemMapFs(), tests.FixtureFs("../../testdata/node-installer/shim"), "/assets", - "/opt/kwasm", + "/opt/rcm", }, args{"some-shim"}, wants{ @@ -112,11 +112,11 @@ func TestConfig_Install(t *testing.T) { tests.FixtureFs("../../testdata/node-installer"), afero.NewReadOnlyFs(tests.FixtureFs("../../testdata/node-installer/shim")), "/assets", - "/opt/kwasm", + "/opt/rcm", }, args{"containerd-shim-spin-v1"}, wants{ - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", false, }, true, @@ -128,7 +128,7 @@ func TestConfig_Install(t *testing.T) { rootFs: tt.fields.rootFs, hostFs: tt.fields.hostFs, assetPath: tt.fields.assetPath, - kwasmPath: tt.fields.kwasmPath, + rcmPath: tt.fields.rcmPath, } filepath, changed, err := c.Install(tt.args.shimName) diff --git a/internal/shim/shim.go b/internal/shim/shim.go index 56668356..4b3cf087 100644 --- a/internal/shim/shim.go +++ b/internal/shim/shim.go @@ -26,15 +26,15 @@ type Config struct { rootFs afero.Fs hostFs afero.Fs assetPath string - kwasmPath string + rcmPath string } -func NewConfig(rootFs afero.Fs, hostFs afero.Fs, assetPath string, kwasmPath string) *Config { +func NewConfig(rootFs afero.Fs, hostFs afero.Fs, assetPath string, rcmPath string) *Config { return &Config{ rootFs: rootFs, hostFs: hostFs, assetPath: assetPath, - kwasmPath: kwasmPath, + rcmPath: rcmPath, } } diff --git a/internal/shim/uninstall.go b/internal/shim/uninstall.go index cc98ee75..cf6c7e23 100644 --- a/internal/shim/uninstall.go +++ b/internal/shim/uninstall.go @@ -9,7 +9,7 @@ import ( ) func (c *Config) Uninstall(shimName string) (string, error) { - st, err := state.Get(c.hostFs, c.kwasmPath) + st, err := state.Get(c.hostFs, c.rcmPath) if err != nil { return "", err } diff --git a/internal/shim/uninstall_test.go b/internal/shim/uninstall_test.go index 94b861b8..630efde1 100644 --- a/internal/shim/uninstall_test.go +++ b/internal/shim/uninstall_test.go @@ -25,8 +25,8 @@ import ( func TestConfig_Uninstall(t *testing.T) { type fields struct { - hostFs afero.Fs - kwasmPath string + hostFs afero.Fs + rcmPath string } type args struct { shimName string @@ -42,7 +42,7 @@ func TestConfig_Uninstall(t *testing.T) { "shim not installed", fields{ tests.FixtureFs("../../testdata/node-installer/shim"), - "/opt/kwasm", + "/opt/rcm", }, args{"not-existing-shim"}, "", @@ -52,28 +52,28 @@ func TestConfig_Uninstall(t *testing.T) { "missing shim binary", fields{ tests.FixtureFs("../../testdata/node-installer/shim-missing-binary"), - "/opt/kwasm", + "/opt/rcm", }, args{"spin-v1"}, - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", false, }, { "successful shim uninstallation", fields{ tests.FixtureFs("../../testdata/node-installer/shim"), - "/opt/kwasm", + "/opt/rcm", }, args{"spin-v1"}, - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &Config{ - hostFs: tt.fields.hostFs, - kwasmPath: tt.fields.kwasmPath, + hostFs: tt.fields.hostFs, + rcmPath: tt.fields.rcmPath, } got, err := c.Uninstall(tt.args.shimName) diff --git a/internal/state/shim_test.go b/internal/state/shim_test.go index b2b0c4fd..72fdf05d 100644 --- a/internal/state/shim_test.go +++ b/internal/state/shim_test.go @@ -22,9 +22,9 @@ func TestShim_MarshalJSON(t *testing.T) { "default", fields{ Sha256: []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - Path: "/opt/kwasm/bin/containerd-shim-spin-v1", + Path: "/opt/rcm/bin/containerd-shim-spin-v1", }, - `{"sha256":"6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52","path":"/opt/kwasm/bin/containerd-shim-spin-v1"}`, + `{"sha256":"6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52","path":"/opt/rcm/bin/containerd-shim-spin-v1"}`, false, }, } @@ -62,10 +62,10 @@ func TestShim_UnmarshalJSON(t *testing.T) { { "default", args{ - `{"sha256":"6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52","path":"/opt/kwasm/bin/containerd-shim-spin-v1"}`, + `{"sha256":"6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52","path":"/opt/rcm/bin/containerd-shim-spin-v1"}`, }, wants{ - path: "/opt/kwasm/bin/containerd-shim-spin-v1", + path: "/opt/rcm/bin/containerd-shim-spin-v1", sha256: []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, }, false, @@ -73,10 +73,10 @@ func TestShim_UnmarshalJSON(t *testing.T) { { "broken sha", args{ - `{"sha256":"2","path":"/opt/kwasm/bin/containerd-shim-spin-v1"}`, + `{"sha256":"2","path":"/opt/rcm/bin/containerd-shim-spin-v1"}`, }, wants{ - path: "/opt/kwasm/bin/containerd-shim-spin-v1", + path: "/opt/rcm/bin/containerd-shim-spin-v1", sha256: nil, }, true, diff --git a/internal/state/state.go b/internal/state/state.go index 4ca1a5d2..bf62ced0 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -17,10 +17,10 @@ type State struct { lockFilePath string } -func Get(fs afero.Fs, kwasmPath string) (*State, error) { +func Get(fs afero.Fs, rcmPath string) (*State, error) { out := State{ Shims: make(map[string]*Shim), - lockFilePath: filepath.Join(kwasmPath, "kwasm-lock.json"), + lockFilePath: filepath.Join(rcmPath, "rcm-lock.json"), fs: fs, } content, err := afero.ReadFile(fs, out.lockFilePath) diff --git a/internal/state/state_test.go b/internal/state/state_test.go index ee7cfa89..a7406449 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -12,8 +12,8 @@ import ( func TestGet(t *testing.T) { type args struct { - fs afero.Fs - kwasmPath string + fs afero.Fs + rcmPath string } tests := []struct { name string @@ -25,13 +25,13 @@ func TestGet(t *testing.T) { "existing state", args{ tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"), - "/opt/kwasm", + "/opt/rcm", }, &state.State{ Shims: map[string]*state.Shim{ "spin-v1": { Sha256: []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - Path: "/opt/kwasm/bin/containerd-shim-spin-v1", + Path: "/opt/rcm/bin/containerd-shim-spin-v1", }, }, }, @@ -41,7 +41,7 @@ func TestGet(t *testing.T) { "missing state", args{ tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"), - "/opt/kwasm", + "/opt/rcm", }, &state.State{ Shims: map[string]*state.Shim{}, @@ -51,7 +51,7 @@ func TestGet(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := state.Get(tt.args.fs, tt.args.kwasmPath) + got, err := state.Get(tt.args.fs, tt.args.rcmPath) if tt.wantErr { require.Error(t, err) } else { @@ -72,7 +72,7 @@ func TestShimChanged(t *testing.T) { Shims: map[string]*state.Shim{ "spin-v1": { Sha256: []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - Path: "/opt/kwasm/bin/containerd-shim-spin-v1", + Path: "/opt/rcm/bin/containerd-shim-spin-v1", }, }, } @@ -87,7 +87,7 @@ func TestShimChanged(t *testing.T) { args{ "spin-v1", []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", }, false, }, @@ -96,7 +96,7 @@ func TestShimChanged(t *testing.T) { args{ "spin-v1", []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 83}, - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", }, true, }, @@ -105,7 +105,7 @@ func TestShimChanged(t *testing.T) { args{ "spin-v1", []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - "/opt/kwasm/bin/containerd-shim-spin-v2", + "/opt/rcm/bin/containerd-shim-spin-v2", }, true, }, @@ -114,7 +114,7 @@ func TestShimChanged(t *testing.T) { args{ "non-existing", []byte{109, 165, 232, 241, 122, 155, 250, 156, 176, 76, 242, 44, 135, 182, 71, 83, 148, 236, 236, 58, 244, 253, 195, 55, 247, 45, 109, 191, 51, 25, 234, 82}, - "/opt/kwasm/bin/containerd-shim-spin-v1", + "/opt/rcm/bin/containerd-shim-spin-v1", }, true, }, diff --git a/jobs.yaml b/jobs.yaml deleted file mode 100644 index d0fb6e19..00000000 --- a/jobs.yaml +++ /dev/null @@ -1,75 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - annotations: - batch.kubernetes.io/job-tracking: "" - creationTimestamp: "2024-01-27T21:29:34Z" - generation: 1 - labels: - kwasm.sh/job: "true" - name: wasmtime-spin-v2-provisioner - namespace: default - ownerReferences: - - apiVersion: v1 - blockOwnerDeletion: true - controller: true - kind: Node - name: kind-control-plane - uid: 16f99ef3-ac14-4517-ac4d-25da238b2172 - resourceVersion: "667" - uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 -spec: - backoffLimit: 6 - completionMode: NonIndexed - completions: 1 - parallelism: 1 - selector: - matchLabels: - batch.kubernetes.io/controller-uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - suspend: false - template: - metadata: - creationTimestamp: null - labels: - batch.kubernetes.io/controller-uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - batch.kubernetes.io/job-name: wasmtime-spin-v2-provisioner - controller-uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - job-name: wasmtime-spin-v2-provisioner - spec: - containers: - - env: - - name: NODE_ROOT - value: /mnt/node-root - - name: SHIM_LOCATION - value: https://github.com/deislabs/containerd-wasm-shims/releases/download/v0.10.0/containerd-wasm-shims-v2-spin-linux-aarch64.tar.gz - - name: SHIM_FETCH_STRATEGY - value: /mnt/node-root - image: voigt/kwasm-node-installer:new - imagePullPolicy: IfNotPresent - name: kwasm-provision - resources: {} - securityContext: - privileged: true - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - volumeMounts: - - mountPath: /mnt/node-root - name: root-mount - dnsPolicy: ClusterFirst - hostPID: true - nodeName: wasmtime-spin-v2 - restartPolicy: Never - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 - volumes: - - hostPath: - path: / - type: "" - name: root-mount -status: - active: 1 - failed: 2 - ready: 0 - startTime: "2024-01-27T21:29:34Z" - uncountedTerminatedPods: {} diff --git a/test-crd.yaml b/test-crd.yaml deleted file mode 100644 index cf1eb010..00000000 --- a/test-crd.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: runtime.kwasm.sh/v1beta1 -kind: Shim -metadata: - # The Shim resource is a cluster wide resource, no namespace. - name: my-shim-v0.1.2 -spec: - # optional: label selector for nodes to target with shim. - # If not supplied, the shim should be installed on all nodes. - nodeSelector: - wasm: "true" - - # required: The method for fetching a shim. - # This could be any number of strategies for fetching. For example, OCI. - fetchStrategy: - anonHttp: - location: https://github.com/some-org/some-project/releases/v0.8.0/shims.tar.gz - - # required: The runtime class to be applied in the cluster for the shim. - # - # The validation for this structure should also validate the `handler` - # will map to the name / path of the shim binary that is installed on the node. - # - # Upon installation of a shim to a node, a label should be added to the node - # to indicate a specific shim is installed on the node. This label must be - # used to inform the K8s scheduler where to schedule workloads for the given - # runtime class. - # - # --- - # apiVersion: node.k8s.io/v1 - # kind: RuntimeClass - # metadata: - # name: myshim-v0.1.2 - # handler: myshim_v0_1_2 - # scheduling: - # nodeSelector: - # myshim_v0_1_2: "true" - runtimeClass: - name: my-shim-v0.1.2 - - # rolloutStrategy describes how a change to this shim will be applied to nodes. - rolloutStrategy: - type: rolling - rolling: - maxUpdate: 5 # could also be a percentage of nodes, like 10% of nodes. - # conditions should provide the status of the resource and it's progression diff --git a/test.yaml b/test.yaml deleted file mode 100644 index 0f96dc57..00000000 --- a/test.yaml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - creationTimestamp: "2024-01-27T21:30:43Z" - finalizers: - - batch.kubernetes.io/job-tracking - generateName: wasmtime-spin-v2-provisioner- - labels: - batch.kubernetes.io/controller-uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - batch.kubernetes.io/job-name: wasmtime-spin-v2-provisioner - controller-uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - job-name: wasmtime-spin-v2-provisioner - name: wasmtime-spin-v2-provisioner-8mz2r - namespace: default - ownerReferences: - - apiVersion: batch/v1 - blockOwnerDeletion: true - controller: true - kind: Job - name: wasmtime-spin-v2-provisioner - uid: 6ae1debc-e68f-4f76-a589-38065c01ce88 - resourceVersion: "592" - uid: 1e325f9c-806e-4983-9a8d-bdc73b62b6ce -spec: - containers: - - env: - - name: NODE_ROOT - value: /mnt/node-root - - name: SHIM_LOCATION - value: https://github.com/deislabs/containerd-wasm-shims/releases/download/v0.10.0/containerd-wasm-shims-v2-spin-linux-aarch64.tar.gz - - name: SHIM_FETCH_STRATEGY - value: /mnt/node-root - image: voigt/kwasm-node-installer:new - imagePullPolicy: IfNotPresent - name: kwasm-provision - resources: {} - securityContext: - privileged: true - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - volumeMounts: - - mountPath: /mnt/node-root - name: root-mount - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - name: kube-api-access-x4twh - readOnly: true - dnsPolicy: ClusterFirst - enableServiceLinks: true - hostPID: true - nodeName: wasmtime-spin-v2 - preemptionPolicy: PreemptLowerPriority - priority: 0 - restartPolicy: Never - schedulerName: default-scheduler - securityContext: {} - serviceAccount: default - serviceAccountName: default - terminationGracePeriodSeconds: 30 - tolerations: - - effect: NoExecute - key: node.kubernetes.io/not-ready - operator: Exists - tolerationSeconds: 300 - - effect: NoExecute - key: node.kubernetes.io/unreachable - operator: Exists - tolerationSeconds: 300 - volumes: - - hostPath: - path: / - type: "" - name: root-mount - - name: kube-api-access-x4twh - projected: - defaultMode: 420 - sources: - - serviceAccountToken: - expirationSeconds: 3607 - path: token - - configMap: - items: - - key: ca.crt - path: ca.crt - name: kube-root-ca.crt - - downwardAPI: - items: - - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - path: namespace -status: - phase: Pending - qosClass: BestEffort diff --git a/testdata/node-installer/containerd/existing-containerd-shim-config/etc/containerd/config.toml b/testdata/node-installer/containerd/existing-containerd-shim-config/etc/containerd/config.toml index 927d2582..cf7f6ccc 100644 --- a/testdata/node-installer/containerd/existing-containerd-shim-config/etc/containerd/config.toml +++ b/testdata/node-installer/containerd/existing-containerd-shim-config/etc/containerd/config.toml @@ -16,6 +16,6 @@ blockio_config_file = "" rdt_config_file = "" -# KWASM runtime config for spin-v1 +# RCM runtime config for spin-v1 [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin-v1] -runtime_type = "/opt/kwasm/bin/containerd-shim-spin-v1" +runtime_type = "/opt/rcm/bin/containerd-shim-spin-v1" diff --git a/testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/bin/containerd-shim-spin-v1 b/testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/bin/containerd-shim-spin-v1 deleted file mode 100644 index 2eea0226..00000000 --- a/testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/bin/containerd-shim-spin-v1 +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -echo "Hello from spin shim" \ No newline at end of file diff --git a/testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/kwasm-lock.json b/testdata/node-installer/containerd/existing-containerd-shim-config/opt/rcm/rcm-lock.json similarity index 68% rename from testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/kwasm-lock.json rename to testdata/node-installer/containerd/existing-containerd-shim-config/opt/rcm/rcm-lock.json index a9baf29a..0573b85f 100644 --- a/testdata/node-installer/containerd/existing-containerd-shim-config/opt/kwasm/kwasm-lock.json +++ b/testdata/node-installer/containerd/existing-containerd-shim-config/opt/rcm/rcm-lock.json @@ -2,7 +2,7 @@ "shims": { "spin-v1": { "sha256": "6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52", - "path": "/opt/kwasm/bin/containerd-shim-spin-v1" + "path": "/opt/rcm/bin/containerd-shim-spin-v1" } } -} \ No newline at end of file +} diff --git a/testdata/node-installer/shim-missing-binary/opt/kwasm/kwasm-lock.json b/testdata/node-installer/shim-missing-binary/opt/rcm/rcm-lock.json similarity index 68% rename from testdata/node-installer/shim-missing-binary/opt/kwasm/kwasm-lock.json rename to testdata/node-installer/shim-missing-binary/opt/rcm/rcm-lock.json index a9baf29a..0573b85f 100644 --- a/testdata/node-installer/shim-missing-binary/opt/kwasm/kwasm-lock.json +++ b/testdata/node-installer/shim-missing-binary/opt/rcm/rcm-lock.json @@ -2,7 +2,7 @@ "shims": { "spin-v1": { "sha256": "6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52", - "path": "/opt/kwasm/bin/containerd-shim-spin-v1" + "path": "/opt/rcm/bin/containerd-shim-spin-v1" } } -} \ No newline at end of file +} diff --git a/testdata/node-installer/shim/opt/kwasm/bin/containerd-shim-spin-v1 b/testdata/node-installer/shim/opt/kwasm/bin/containerd-shim-spin-v1 deleted file mode 100644 index 2eea0226..00000000 --- a/testdata/node-installer/shim/opt/kwasm/bin/containerd-shim-spin-v1 +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -echo "Hello from spin shim" \ No newline at end of file diff --git a/testdata/node-installer/shim/opt/kwasm/kwasm-lock.json b/testdata/node-installer/shim/opt/rcm/rcm-lock.json similarity index 68% rename from testdata/node-installer/shim/opt/kwasm/kwasm-lock.json rename to testdata/node-installer/shim/opt/rcm/rcm-lock.json index a9baf29a..0573b85f 100644 --- a/testdata/node-installer/shim/opt/kwasm/kwasm-lock.json +++ b/testdata/node-installer/shim/opt/rcm/rcm-lock.json @@ -2,7 +2,7 @@ "shims": { "spin-v1": { "sha256": "6da5e8f17a9bfa9cb04cf22c87b6475394ecec3af4fdc337f72d6dbf3319ea52", - "path": "/opt/kwasm/bin/containerd-shim-spin-v1" + "path": "/opt/rcm/bin/containerd-shim-spin-v1" } } -} \ No newline at end of file +}