Yes, here is my template:
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "example-requests",
"annotations": {
"description": "Python Kernel",
"tags": "instant-app,python",
"iconClass": "icon-python"
}
},
"labels": {
"template": "example-requests"
},
"objects": [
{
"kind": "HorizontalPodAutoscaler",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "${SERVICE}"
},
"spec": {
"scaleRef": {
"kind": "DeploymentConfig",
"name": "{SERVICE}",
"apiVersion": "v1",
"subresource": "scale"
},
"minReplicas": 1,
"maxReplicas": 3,
"cpuUtilization": {
"targetPercentage": 10
}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "${SERVICE}",
"creationTimestamp": null,
"labels": {
"app": "${SERVICE}"
}
},
"spec": {
"dockerImageRepository": "openshift/image"
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "${SERVICE}"
},
"spec": {
"host": "${DOMAIN}",
"to": {
"kind": "Service",
"name": "${SERVICE}"
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${SERVICE}",
"creationTimestamp": null,
"labels": {
"app": "${SERVICE}"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentconfig": "${SERVICE}"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"deploymentconfig": "${SERVICE}"
}
},
"spec": {
"containers": [
{
"name": "${SERVICE}",
"image": "openshift/image",
"resources": {
"requests": {
"cpu": "100m",
"memory": "200Mi"
},
"limits": {
"cpu": "200m",
"memory": "400Mi"
}
},
"ports": [
{
"containerPort": 8000,
"protocol": "TCP"
}
]
}
]
}
}
},
"status": {}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${SERVICE}",
"creationTimestamp": null,
"labels": {
"app": "${SERVICE}"
}
},
"spec": {
"ports": [
{
"name": "8000-tcp",
"protocol": "TCP",
"port": 8000,
"targetPort": 8000,
"nodePort": 0
}
],
"selector": {
"deploymentconfig": "${SERVICE}"
}
},
"status": {
"loadBalancer": {}
}
}
],
"parameters": [
{
"name": "SERVICE",
"value": "example-requests"
},
{
"name": "DOMAIN",
"value": "example-requests-domain.es"
}
]
}
My oc version:
oc v1.1.1.1
kubernetes v1.1.0-origin-1107-g4c8e6f4
I create the template with the following command. This is successful.
oc create -f example-requests.json
And then, I launch the application via web. The other objects are created.
Cannot create object. Unrecognized kind HorizontalPodAutoscaler
Thanks.
2016-02-16 22:45 GMT+01:00 Ben Parees <[email protected]>:
> Can you provide your full template and the commands you are running?
>
> I modified an existing template to add your HPA object and I was able to
> both oc process it, and oc create the objects that resulted from oc process.
>
> Supplying your "oc version" might be helpful as well.
>
>
> On Mon, Feb 15, 2016 at 8:58 AM, Alejandro Nieto Boza <[email protected]>
> wrote:
>
>> Hi,
>>
>> I'm trying to integrate a hpa in a application template with other
>> resources like ImageStreams, Routes, DeploymentConfigs... These resources
>> use apiversion v1.
>>
>> HPA:
>> {
>> "kind": "HorizontalPodAutoscaler",
>> "apiVersion": "extensions/v1beta1",
>>
>> "metadata": {
>> "name": "${SERVICE}"
>> },
>> "spec": {
>> "scaleRef": {
>> "kind": "DeploymentConfig",
>> "name": "${SERVICE}",
>> "apiVersion": "v1",
>> "subresource": "scale"
>> },
>> "minReplicas": 1,
>> "maxReplicas": 3,
>> "cpuUtilization": {
>> "targetPercentage": 50
>> }
>> }
>> },
>>
>>
>> When I launch the template this error appears to me:
>>
>> Cannot create object. Unrecognized kind HorizontalPodAutoscaler
>>
>>
>> I've tried changing the apiVersion of Template:
>>
>> "kind": "Template",
>> "apiVersion": "extensions/v1beta1",
>>
>> But then this error appears:
>>
>> unable to load "template.json": no kind "Template" is registered for
>> version "extensions/v1beta1"
>>
>> And also I've tried changing the API of HPA to v1. It doesn't work.
>>
>> Is it possible to integrate the hpa with the other resources?
>>
>> I've tried with the hpa in a separated template and it works perfectly.
>>
>>
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>
>>
>
>
> --
> Ben Parees | OpenShift
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users