OpenShift Service Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
=Create a Service=
=Create a Service=


Use a template similar to:
Use a template similar to https://github.com/NovaOrdis/playground/blob/master/openshift/templates/eap7-service-template.yaml.


apiVersion: v1
then
kind: Template
metadata:
  name: novaordis-service-template
parameters:
- name: APPLICATION_NAME
  value: my-app-name
  required: true
objects:
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      openshift.io/generated-by: novaordis-service-template
    labels:
      app: ${APPLICATION_NAME}
      application: ${APPLICATION_NAME}
      template: novaordis-service-template
    name: ${APPLICATION_NAME}
  spec:
    ports:
    - port: 8080
      protocol: TCP
      targetPort: 8080
    selector:
      deploymentConfig: ${APPLICATION_NAME}
    sessionAffinity: None
    type: ClusterIP
  status:


The template is available as https://github.com/NovaOrdis/playground/blob/master/openshift/templates/eap7-service-template.yaml
oc process -p APPLICATION_NAME=my-app-name -p CLUSTER_IP=<''cluster-ip-value''> -f ./novaordis-service-template.yaml | oc create -f -


then
The only method to find a valid cluster IP I could think of was to run oc new-app jenkins-ephemeral in the target project and read the cluster IP from the newly created service definition.


oc process -p APPLICATION_NAME=my-app-name -f ./novaordis-service-template.yaml | oc create -f -
172.30.114.148

Revision as of 09:30, 7 December 2017

Internal

Create a Service

Use a template similar to https://github.com/NovaOrdis/playground/blob/master/openshift/templates/eap7-service-template.yaml.

then

oc process -p APPLICATION_NAME=my-app-name -p CLUSTER_IP=<cluster-ip-value> -f ./novaordis-service-template.yaml | oc create -f -

The only method to find a valid cluster IP I could think of was to run oc new-app jenkins-ephemeral in the target project and read the cluster IP from the newly created service definition.

172.30.114.148