Deploying Registry Cache Extension Locally ​
Prerequisites ​
- Make sure that you have a running local Gardener setup. The steps to complete this can be found in the Deploying Gardener Locally guide.
TIP
Ensure that the locally used Gardener version matches the version specified by the github.com/gardener/gardener dependency. The extension’s local setup must run successfully against a local Gardener setup at the version referenced by this dependency, as verified by end-to-end tests.
NOTE
The location of the Gardener project is expected to be under the same root (e.g. ~/go/src/github.com/gardener/). If this is not the case, the location of Gardener project should be specified in GARDENER_REPO_ROOT environment variable:
export GARDENER_REPO_ROOT="<path_to_gardener_project>"Setting up the Registry Cache Extension ​
make extension-upThe corresponding make target will build the extension image, load it into the kind cluster Nodes, and deploy the registry-cache ControllerDeployment and ControllerRegistration resources. The container image in the ControllerDeployment will be the image that was build and loaded into the kind cluster Nodes.
The make target will then deploy the registry-cache admission component. It will build the admission image, load it into the kind cluster Nodes, and finally install the admission component charts to the kind cluster.
Creating a Shoot Cluster ​
NOTE
Make sure that your KUBECONFIG environment variable is targeting the local Gardener cluster (i.e. <path_to_gardener_project>/example/gardener-local/kind/local/kubeconfig).
Once the above step is completed, you can create a Shoot cluster.
example/shoot-registry-cache.yaml contains a Shoot specification with the registry-cache extension:
kubectl create -f example/shoot-registry-cache.yamlexample/shoot-registry-mirror.yaml contains a Shoot specification with the registry-mirror extension:
kubectl create -f example/shoot-registry-mirror.yamlTearing Down the Development Environment ​
To tear down the development environment, delete the Shoot cluster or disable the registry-cache extension in the Shoot's specification. When the extension is not used by the Shoot anymore, you can run:
make extension-downThe make target will delete the ControllerDeployment and ControllerRegistration of the extension, and the registry-cache admission helm deployment.
Alternative Setup Using the gardener-operator Local Setup ​
Alternatively, you can deploy the registry-cache extension in the gardener-operator local setup. To do this, make sure you have a running local setup based on Alternative Way to Set Up Garden and Seed Leveraging gardener-operator.
Creating the registry-cache Extension.operator.gardener.cloud resource: ​
make extension-operator-upThe corresponding make target will build the registry-cache admission and extension container images, OCI artifacts for the admission runtime and application charts, and the extension chart. Then, the container images and the OCI artifacts are pushed into the default skaffold registry (i.e. registry.local.gardener.cloud:5001). Next, the registry-cache Extension.operator.gardener.cloud resource is deployed into the KinD cluster. Based on this resource the gardener-operator will deploy the registry-cache admission component, as well as the registry-cache ControllerDeployment and ControllerRegistration resources.
Creating a Shoot Cluster ​
NOTE
Make sure that your KUBECONFIG environment variable is targeting the virtual Garden cluster (i.e. <path_to_gardener_project>/dev-setup/kubeconfigs/virtual-garden/kubeconfig).
To create a Shoot cluster execute:
kubectl create -f example/shoot-registry-cache.yamlDelete the registry-cache Extension.operator.gardener.cloud resource ​
To tear down the development environment, delete the Shoot cluster or disable the registry-cache extension in the Shoot's specification. When the extension is not used by the Shoot anymore, you can run:
make extension-operator-downThe corresponding make target will delete the Extension.operator.gardener.cloud resource. Consequently, the gardener-operator will delete the registry-cache admission component and registry-cache ControllerDeployment and ControllerRegistration resources.