Open slaskawi opened 7 years ago
Most modules have a resource_defintion
parameter that you can use to basically copy and paste your templates too instead of figuring out the parameters for each module.
It seems to work but only partially...
Here's an example - it's a copy/paste from running DeploymentConfig
:
- name: Create Deployment Config
openshift_v1_deployment_config:
name: infinispan-app
namespace: '{{ namespace }}'
labels:
application: infinispan-app
resource_definition:
replicas: 1
selector:
deploymentConfig: infinispan-app
strategy:
rollingParams:
intervalSeconds: 20
maxSurge: 1
maxUnavailable: 1
timeoutSeconds: 1200
updatePeriodSeconds: 20
type: Rolling
template:
metadata:
labels:
application: infinispan-app
deploymentConfig: infinispan-app
name: infinispan-app
spec:
containers:
- env:
- name: OPENSHIFT_KUBE_PING_LABELS
value: application=infinispan-app
- name: OPENSHIFT_KUBE_PING_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: KUBERNETES_LABELS
value: application=infinispan-app
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: docker-registry.engineering.redhat.com/jboss-dataservices/dataservices72-caching-service
imagePullPolicy: Always
livenessProbe:
exec:
command:
- /opt/datagrid/bin/livenessProbe.sh
failureThreshold: 5
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 25
name: infinispan-app
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 8888
name: ping
protocol: TCP
- containerPort: 11222
name: hotrod
protocol: TCP
- containerPort: 11211
name: memcached
protocol: TCP
readinessProbe:
exec:
command:
- /opt/datagrid/bin/readinessProbe.sh
failureThreshold: 5
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 2
timeoutSeconds: 25
resources:
requests:
cpu: 500m
memory: 512Mi
serviceAccount: infinispan-app
serviceAccountName: infinispan-app
terminationGracePeriodSeconds: 60
This resulted in the following error:
TASK [provision-datagrid-online-services-apb : Create Deployment Config] *******
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error parsing resource definition. Encountered selector_deployment_config, which does not map to a module parameter. If this looks like a problem with the module, please open an issue at github.com/openshift/openshift-restclient-python/issues"}
to retry, use: --limit @/opt/apb/actions/provision.retry
After commenting selector
part, I got another error:
TASK [provision-datagrid-online-services-apb : Create Deployment Config] *******
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error parsing resource definition. Encountered template_spec_termination_grace_period_seconds, which does not map to a module parameter. If this looks like a problem with the module, please open an issue at github.com/openshift/openshift-restclient-python/issues"}
to retry, use: --limit @/opt/apb/actions/provision.retry
So it seems not all sections are interpreted correctly...
Well the error message tells you some good next steps.
If this looks like a problem with the module, please open an issue at github.com/openshift/openshift-restclient-python/issues
I'm currently migrating our templates into Ansible Service Broker. The API seems very similar but in some cases it's a bit different.
Here are just a few examples:
Migrated part into Ansible:
Note that
exec
was changed to_exec
,livenessProbe
toliveness_probe
etc. This actually makes copy/pasting pretty hard and error prone. Are there any plans to unify Ansible parser with k8s api?