go test ./pkg/controller/customdomain/ -coverprofile /tmp/cp.out && go tool cover -html /tmp/cp.out
To use osde2e, create a fork, make a local build, then run the following:
./out/osde2e test --cluster-id $CLUSTER_ID --configs stage,e2e-suite --skip-health-check --focus-tests "Custom Domains"
Current test results can be found within testgrid here.
Create CRD
oc apply -f deploy/crds/managed.openshift.io_customdomains_crd.yaml
operator-sdk run --local --namespace '' OR oc create namespace openshift-custom-domains-operator oc apply -f deploy/
If you do not have a wildcard certificate for the custom domain, you can use Let's Encrypt (certbot) to generate a wildcard certificate.
Install certbot and obtain wildcard cert:
brew install certbot
sudo certbot certonly --manual --preferred-challenges=dns --agree-tos --email=<your-email> -d '*.apps.<domain>'
Follow instructions to verify domain ownership in Route53 (or other DNS vendor).
To generate a self signed cert and key follow these steps.
Example of creating a secret and customdomain:
oc create ns my-project
oc create secret tls acme-tls --cert=fullchain.pem --key=privkey.pem -n my-project --as backplane-cluster-admin
oc apply --as backplane-cluster-admin -f <(echo "
apiVersion: managed.openshift.io/v1alpha1
kind: CustomDomain
metadata:
name: acme
spec:
domain: apps.acme.io
certificate:
name: acme-tls
namespace: my-project
")
Example:
oc get customdomain acme --as backplane-cluster-admin -o json | jq -r .status.dnsRecord
*.acme.cluster01.x8s0.s1.openshiftapps.com
If you don't want to update the DNS vendor, skip to the "Testing without DNS vendor updates" section.
Example:
*.apps.acme.io -> _dns.acme.cluster01.x8s0.s1.openshiftapps.com
Example:
oc new-app --docker-image=docker.io/openshift/hello-openshift --as backplane-cluster-admin
$ oc create route edge --service=hello-openshift hello-openshift-tls --hostname hello-openshift-tls-my-project.apps.acme.io
$ curl https://hello-openshift-tls-my-project.apps.acme.io
Hello OpenShift!
Example for creating an app and a route:
oc new-app --docker-image=docker.io/openshift/hello-openshift -n my-project --as backplane-cluster-admin
oc create route edge -n my-project --service=hello-openshift hello-openshift-tls --hostname hello-openshift-tls-my-project.apps.acme.io
To find the IP of the endpoint use this command:
dig +short $(oc get customdomain acme --as backplane-cluster-admin -o json | jq -r .status.endpoint)
To test the app:
curl -k https://hello-openshift-tls-my-project.apps.acme.io --resolve hello-openshift-tls-my-project.apps.acme.io:443:<IP of the endpoint>
Hello OpenShift!