Drupal Operator generated via KubeBuilder to enable managing multiple Drupal installs.
Note: This is vastly outdated and needs a complete refactoring.
The main goals of the operator are:
- Ability to deploy Drupal sites on top of Kubernetes
- Provide best practices for application lifecycle
- Facilitate proper devops (backups, monitoring and high-availability)
Project is currently under active development.
- Drupal Operator (this project)
- Drupal Container Image (https://github.com/drupalwxt/site-wxt)
helm repo add sylus https://sylus.github.io/charts
helm --name drupal-operator install sylus/drupal-operator
First we need to install the mysql-operator
as well as default role bindings.
# Create our namespace
kubectl create ns mysql-operator
# Install via Helm
helm install --name mysql-operator -f values.yaml --namespace mysql-operator .
# Install RoleBindings for appropriate namespace
cat <<EOF | kubectl create -f -
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: mysql-agent
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: mysql-agent
subjects:
- kind: ServiceAccount
name: mysql-agent
namespace: default
EOF
Next we can start to utilize the Drupal operator!
# Deploy the operator (helm chart still being tested)
make deploy
# Leverage our example spec
kubectl apply -f config/samples/drupal_v1beta1_droplet.yaml
# Create initial database
kubectl run mysql-client --image=mysql:5.7 -it --rm --restart=Never -- mysql -h mysite-mysql -uroot -pmy-super-secret-pass -e 'create database drupal;'
# Run Drush and install our site
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/component=drupal" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -n default -- drush si wxt \
--sites-subdir=default \
--account-name=admin \
--account-pass=Drupal@2019 \
[email protected] \
--site-name="Drupal Install Profile (WxT)" \
install_configure_form.update_status_module='array(FALSE,FALSE)' \
--yes
Generated via KubeBuilder with additional code and lessons learned from the WordPress Operator.