Skip to content

Trustify Operator manages the deployment and life cycle of Trustify on Kubernetes and OpenShift.

Notifications You must be signed in to change notification settings

trustification/trustify-operator

Repository files navigation

Local development

Minikube

  • Start minikube:
minikube start --addons=ingress,dashboard
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0
  • Setup ServiceAccount + Role + RoleBinding:
kubectl apply -f scripts/rbac.yaml
  • Start server in dev mode
mvn compile quarkus:dev
  • Create an instance of the operator:
kubectl apply -f scripts/trustify.yaml

At this point the container images will be generated by the operator.

Test Operator

export IMG=quay.io/${USER}/trustify-operator:v0.0.0
export BUNDLE_IMG=quay.io/${USER}/trustify-operator-bundle:v0.0.0
export CATALOG_IMG=quay.io/${USER}/trustify-operator-catalog:v0.0.0

use export DOCKERFILE=Dockerfile.jvm if you want to be faster and create an operator based on JVM

  • Create operator:
make docker-build docker-push
  • Create bundle:
make bundle-build bundle-push
  • Create catalog:
make catalog-build catalog-push

Instantiate Catalog

  • If you are using Minikube:
CATALOG_NAMESPACE=olm
  • If you are using OCP:
CATALOG_NAMESPACE=openshift-marketplace
  • Instantiate catalog:
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: trustify-catalog-source
  namespace: $CATALOG_NAMESPACE
spec:
  sourceType: grpc
  image: $CATALOG_IMG
EOF

At this point you can see the Operator in the marketplace of OCP ready for you to test it.

Create subscription

  • Create namespace:
kubectl create ns trustify
  • Create group
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: operatorgroup
  namespace: trustify
spec:
  targetNamespaces:
    - trustify
EOF
  • Create subscription:
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: trustify-subscription
  namespace: trustify
spec:
  channel: alpha
  name: trustify-operator
  source: trustify-catalog-source
  sourceNamespace: ${CATALOG_NAMESPACE}
EOF

Instantiate Trustify

cat <<EOF | kubectl apply -n trustify -f -
apiVersion: "org.trustify/v1alpha1"
kind: "Trustify"
metadata:
  name: myapp
spec: { }
EOF

Kubernetes & OCP version compatibility

Red Hat OpenShift version Kubernetes version
4.15 1.28
4.14 1.27
4.13 1.26
4.12 1.25
4.11 1.24
4.10 1.23

References: