To develop Certman Operator you will need the following:
- Access to the hive repo, https://github.com/openshift/hive
- Let’s Encrypt account id and private key
- AWS keys and secret keys for the account you’re using.
- An OpenShift test cluster
We don't need a running Hive to test and develop with. But we will need some CRDs from the project. Most importantly Certman Operator watches for ClusterDeployments and responds to that CR when the status is 'true'.
git clone git@github.com:openshift/hive.git
oc create -f hive/config/crdsThis is the object Certman Operator creates and uses to track certs it creates.
git clone git@github.com:openshift/certman-operator.git
oc create -f certman-operator/deploy/crds/certman.managed.openshift.io_certificaterequests.yamlThis where all of the Certman Operator objects will live
.If using OpenShift
oc new-project certman-operator
oc project certman-operatorCertman Operator uses a ConfigMap to store options. At the moment, there are 2 items that can be configured using ConfigMap, Let's Encrypt environment, and the default notification email.
Example:
oc create configmap certman-operator \
--from-literal=default_notification_email_address=foo@bar.com- default_notification_email_address - Email address to which Let's Encrypt certificate expiry notifications should be sent.
Two Secrets are required. One is the AWS credentials that we'll need for working with Route53.
oc create secret generic aws-iam-secret --from-literal=aws_access_key_id=XXX --from-literal=aws_secret_access_key=YYYYAnother Secret is used to store Let's Encrypt account url and keys. we will use Let's Encrypt staging api if it's an staging account, and use production api if it's an production account.
oc create secret generic lets-encrypt-account \
--from-file=private-key=private-key.pem \
--from-file=account-url=account.txtoc create -f deploy/service_account.yaml
oc create -f deploy/role.yaml
oc create -f deploy/role_binding.yaml
oc create -f deploy/operator.yamlFor local developement the easiest way is the use the operator-sdk cli. This will run from the local directory and use local KUBECONFIG environment variable, default ~/.kube/config
WATCH_NAMESPACE="certman-operator" OPERATOR_NAME="certman-operator" go run main.goBuild the image using documentation and push to Quay registry in the testing account.
Edit the operator.yaml with your tag. Then deploy to cluster.
oc create -f deploy/operator.yamlHappy Developing!