From 4d930819d3741e52c4feae77aeea138cec67a665 Mon Sep 17 00:00:00 2001 From: Tim Ebert Date: Fri, 3 Nov 2023 17:22:47 +0100 Subject: [PATCH] [WIP] Adapt webhosting-operator to external sharding implementation --- docs/getting-started.md | 5 ++++ .../manager/clusterring/clusterring.yaml | 15 ++++++++++++ .../manager/clusterring/kustomization.yaml | 5 ++++ webhosting-operator/go.mod | 2 +- webhosting-operator/go.sum | 4 ++-- webhosting-operator/skaffold.yaml | 24 +++++++++++++++++++ 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 webhosting-operator/config/manager/clusterring/clusterring.yaml create mode 100644 webhosting-operator/config/manager/clusterring/kustomization.yaml diff --git a/docs/getting-started.md b/docs/getting-started.md index 81ee7ee1..75c7b736 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -8,6 +8,11 @@ To experience how they work, the webhosting-operator is deployed in the followin While webhosting-operator is developed in the same repository, it only serves as an example. Sharding support can be implemented in any other controller and programming language as well, so that it works well with the sharding components from this project. +> [!NOTE] +> The external sharding components are work in progress. +> While the following steps also deploy the new sharding components, they are not activated for now (no `ClusterRing` object is created). +> Instead, the existing sharding implementation in controller-runtime embedded in webhosting-operator is used. + ## Quick Start ```bash diff --git a/webhosting-operator/config/manager/clusterring/clusterring.yaml b/webhosting-operator/config/manager/clusterring/clusterring.yaml new file mode 100644 index 00000000..961e7c82 --- /dev/null +++ b/webhosting-operator/config/manager/clusterring/clusterring.yaml @@ -0,0 +1,15 @@ +apiVersion: sharding.timebertt.dev/v1alpha1 +kind: ClusterRing +metadata: + name: operator +spec: + kinds: + - apiGroup: webhosting.timebertt.dev + kind: Website + controlledKinds: + - apiGroup: apps + kind: Deployment + - kind: ConfigMap + - kind: Service + - apiGroup: networking.k8s.io + kind: Ingress diff --git a/webhosting-operator/config/manager/clusterring/kustomization.yaml b/webhosting-operator/config/manager/clusterring/kustomization.yaml new file mode 100644 index 00000000..9e4a7e12 --- /dev/null +++ b/webhosting-operator/config/manager/clusterring/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- clusterring.yaml diff --git a/webhosting-operator/go.mod b/webhosting-operator/go.mod index b56e374e..4e7de40e 100644 --- a/webhosting-operator/go.mod +++ b/webhosting-operator/go.mod @@ -25,7 +25,7 @@ require ( ) // https://github.com/timebertt/controller-runtime/tree/sharding-0.15 -replace sigs.k8s.io/controller-runtime => github.com/timebertt/controller-runtime v0.6.1-0.20230910160759-61c8e6d9a2de +replace sigs.k8s.io/controller-runtime => github.com/timebertt/controller-runtime v0.6.1-0.20231103173444-c2f2d2ddd36b require ( github.com/beorn7/perks v1.0.1 // indirect diff --git a/webhosting-operator/go.sum b/webhosting-operator/go.sum index f343a2f6..688e979a 100644 --- a/webhosting-operator/go.sum +++ b/webhosting-operator/go.sum @@ -149,8 +149,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/timebertt/controller-runtime v0.6.1-0.20230910160759-61c8e6d9a2de h1:LxfB3lU0Su0pjmdqB3NsI5oIF4835lhFqPH+RNbJ1mM= -github.com/timebertt/controller-runtime v0.6.1-0.20230910160759-61c8e6d9a2de/go.mod h1:dC7gCD9Y6rWUT9YaaCuR/kHLZqppXydmPLCc/2KffF4= +github.com/timebertt/controller-runtime v0.6.1-0.20231103173444-c2f2d2ddd36b h1:6lRmAbgfx8z5A+7y6JgNIIQ//l7RBIm00UJzu6l8KfQ= +github.com/timebertt/controller-runtime v0.6.1-0.20231103173444-c2f2d2ddd36b/go.mod h1:LBDKEuL9yGGrRraKBF6dSprE/R33ehmfCDYnh3fexwA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= diff --git a/webhosting-operator/skaffold.yaml b/webhosting-operator/skaffold.yaml index ff3b2d59..ea1f76da 100644 --- a/webhosting-operator/skaffold.yaml +++ b/webhosting-operator/skaffold.yaml @@ -80,6 +80,30 @@ profiles: path: /manifests/kustomize/paths/0 value: config/manager/shoot-non-sharded --- +# This is an optional module that activates the external sharding implementation by deploying the ClusterRing object. +# Set the USE_CLUSTERRING env var to true to activate this module. +# We keep this optional for now until the external sharding implementation is fully implemented so that we don't break +# trying out the existing implementation. +apiVersion: skaffold/v4beta6 +kind: Config +metadata: + name: clusterring +profiles: +- name: clusterring + activation: + - command: USE_CLUSTERRING=true + manifests: + kustomize: + paths: + - config/manager/clusterring + deploy: + kubectl: + defaultNamespace: "" + flags: + apply: + - --server-side + - --force-conflicts +--- apiVersion: skaffold/v4beta6 kind: Config metadata: