Hi,
I understand that this is likely going to be rejected, but I'll try anyway :) Something that is really needed to make the nameprefix mechanism work in a OpenShift context, is replacing the name of the target service in Route objects (apiVersion: route.openshift.io/v1). Would you maybe consider doing the nameref subtitution for that too?
A typical route definition looks as follows:
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: frontend
spec:
tls:
termination: edge
to:
kind: Service
name: frontend
See: https://docs.openshift.org/latest/dev_guide/routes.html
This would be solved also by #91 probably
@schweikert Adding name prefix should work for Route kind since kustomize doesn't really check the kind name for prefixing part.
The problem is spec.to.name, which is the name of a service that gets renamed by kustomize
The intended workflow is like this:
You add an annotation to the type.go of Route in the filed spec.to
// +k8s:openapi-gen=x-kubernetes-object-ref-api-version:v1
// +k8s:openapi-gen=x-kubernetes-object-ref-kind:Service
Get the open API definition of it and save it to a file route.json.
Then in kustomization.yaml, add a filed as
crds:
- route.json
Then kustomize build will update the filed spec.to.name as the service referred is renamed.
Awesome, thanks! Looking forward to trying it out.
Let me know if you need any help on this.
For the records: it works for this use case :) Thanks @Liujingfang1 !
I have written here detailed instructions on how to use it for OpenShift routes:
https://github.com/adnovum/kustomize-openshift
Maybe we can extend that repo in the future to contain more tuning tips for using kustomize with openshift.
@Liujingfang1 I realise this request has been addressed/closed but I was wondering if there is an easier way to create JSON CRD files for OpenShift extensions rather than to add the properties by hand? Like, would it be possible to simply generate a Kustomize JSON CRD for the entire DeploymentConfig struct for example?
Most helpful comment
For the records: it works for this use case :) Thanks @Liujingfang1 !
I have written here detailed instructions on how to use it for OpenShift routes:
https://github.com/adnovum/kustomize-openshift
Maybe we can extend that repo in the future to contain more tuning tips for using kustomize with openshift.