{
"apiVersion": "template.openshift.io/v1",
"kind": "Template",
"labels": {
"app": "${NAME}",
"template": "jenkins-persistent-monitored"
},
"message": "A Jenkins service (monitored via Prometheus) has been created in your project. Log into Jenkins with your OpenShift account. The tutorial at https://github.com/openshift/origin/blob/master/examples/jenkins/README.md contains more information about using this template.",
"metadata": {
"annotations": {
"description": "Jenkins service, with persistent storage. nn To run this template extra RBAC permissions need to be provideed to the use to be able to create the ServiceMonitor Custom Resource managed by the prometheus-operator. nnNOTE: You must have persistent volumes available in your cluster to use this template.",
"iconClass": "icon-jenkins",
"openshift.io/display-name": "Jenkins Monitored",
"openshift.io/documentation-url": "https://docs.okd.io/latest/using_images/other_images/jenkins.html",
"openshift.io/long-description": "This template deploys a Jenkins server capable of managing OpenShift Pipeline builds and supporting OpenShift-based oauth login and Prometheus monitoring. DISCLAIMER: User needs to have RBAC Permissions to create the Service Monitor.",
"openshift.io/provider-display-name": "Red Hat, Inc.",
"openshift.io/support-url": "https://access.redhat.com",
"samples.operator.openshift.io/version": "4.9.52",
"tags": "instant-app,jenkins"
},
"creationTimestamp": "2022-06-30T13:15:03Z",
"labels": {
"samples.operator.openshift.io/managed": "true"
},
"name": "jenkins-persistent-monitored",
"namespace": "openshift",
"resourceVersion": "413789853",
"uid": "2135b7ab-e42a-41a0-a45e-be37b752e99a"
},
"objects": [
{
"apiVersion": "v1",
"kind": "Route",
"metadata": {
"annotations": {
"haproxy.router.openshift.io/timeout": "4m",
"template.openshift.io/expose-uri": "http://{.spec.host}{.spec.path}"
},
"name": "${JENKINS_SERVICE_NAME}"
},
"spec": {
"tls": {
"insecureEdgeTerminationPolicy": "Redirect",
"termination": "edge"
},
"to": {
"kind": "Service",
"name": "${JENKINS_SERVICE_NAME}"
}
}
},
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
"name": "${JENKINS_SERVICE_NAME}"
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "${VOLUME_CAPACITY}"
}
}
}
},
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"labels": {
"config.openshift.io/inject-trusted-cabundle": "true"
},
"name": "${JENKINS_SERVICE_NAME}-trusted-ca-bundle"
}
},
{
"apiVersion": "v1",
"kind": "DeploymentConfig",
"metadata": {
"annotations": {
"template.alpha.openshift.io/wait-for-ready": "true"
},
"name": "${JENKINS_SERVICE_NAME}"
},
"spec": {
"replicas": 1,
"selector": {
"name": "${JENKINS_SERVICE_NAME}"
},
"strategy": {
"type": "Recreate"
},
"template": {
"metadata": {
"labels": {
"name": "${JENKINS_SERVICE_NAME}"
}
},
"spec": {
"containers": [
{
"capabilities": {},
"env": [
{
"name": "OPENSHIFT_ENABLE_OAUTH",
"value": "${ENABLE_OAUTH}"
},
{
"name": "OPENSHIFT_ENABLE_REDIRECT_PROMPT",
"value": "true"
},
{
"name": "DISABLE_ADMINISTRATIVE_MONITORS",
"value": "${DISABLE_ADMINISTRATIVE_MONITORS}"
},
{
"name": "KUBERNETES_MASTER",
"value": "https://kubernetes.default:443"
},
{
"name": "KUBERNETES_TRUST_CERTIFICATES",
"value": "true"
},
{
"name": "JENKINS_SERVICE_NAME",
"value": "${JENKINS_SERVICE_NAME}"
},
{
"name": "JNLP_SERVICE_NAME",
"value": "${JNLP_SERVICE_NAME}"
},
{
"name": "ENABLE_FATAL_ERROR_LOG_FILE",
"value": "${ENABLE_FATAL_ERROR_LOG_FILE}"
},
{
"name": "JENKINS_UC_INSECURE",
"value": "${JENKINS_UC_INSECURE}"
},
{
"name": "CASC_JENKINS_CONFIG",
"value": "/var/lib/jenkins/proxy.yaml"
}
],
"image": " ",
"imagePullPolicy": "IfNotPresent",
"livenessProbe": {
"failureThreshold": 2,
"httpGet": {
"path": "/login",
"port": 8080
},
"initialDelaySeconds": 420,
"periodSeconds": 360,
"timeoutSeconds": 240
},
"name": "jenkins",
"readinessProbe": {
"httpGet": {
"path": "/login",
"port": 8080
},
"initialDelaySeconds": 3,
"timeoutSeconds": 240
},
"resources": {
"limits": {
"memory": "${MEMORY_LIMIT}"
}
},
"securityContext": {
"capabilities": {},
"privileged": false
},
"terminationMessagePath": "/dev/termination-log",
"volumeMounts": [
{
"mountPath": "/var/lib/jenkins",
"name": "${JENKINS_SERVICE_NAME}-data"
},
{
"mountPath": "/etc/pki/ca-trust/source/anchors",
"name": "all-ca-certs"
}
]
}
],
"dnsPolicy": "ClusterFirst",
"restartPolicy": "Always",
"serviceAccountName": "${JENKINS_SERVICE_NAME}",
"volumes": [
{
"name": "${JENKINS_SERVICE_NAME}-data",
"persistentVolumeClaim": {
"claimName": "${JENKINS_SERVICE_NAME}"
}
},
{
"name": "all-ca-certs",
"projected": {
"sources": [
{
{
"configMap": {
"name": "${JENKINS_SERVICE_NAME}-trusted-ca-bundle",
"items": [
{
"key": "ca-bundle.crt",
"path": "global-ca-bundle.crt"
}
]
}
},
{
"configMap": {
"name": "oauth-serving-cert",
"items": [
{
"key": "ca-bundle.crt",
"path": "oauth-ca-bundle.crt"
}
]
}
}
}
]
}
}
],
"triggers": [
{
"imageChangeParams": {
"automatic": true,
"containerNames": [
"jenkins"
],
"from": {
"kind": "ImageStreamTag",
"name": "${JENKINS_IMAGE_STREAM_TAG}",
"namespace": "${NAMESPACE}"
},
"lastTriggeredImage": ""
},
"type": "ImageChange"
},
{
"type": "ConfigChange"
}
]
}
},
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"annotations": {
"serviceaccounts.openshift.io/oauth-redirectreference.jenkins": "{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"${JENKINS_SERVICE_NAME}"}}"
},
"name": "${JENKINS_SERVICE_NAME}"
}
},
{
"apiVersion": "v1",
"groupNames": null,
"kind": "RoleBinding",
"metadata": {
"name": "${JENKINS_SERVICE_NAME}_edit"
},
"roleRef": {
"name": "edit"
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "${JENKINS_SERVICE_NAME}"
}
]
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "${JNLP_SERVICE_NAME}"
},
"spec": {
"ports": [
{
"name": "agent",
"nodePort": 0,
"port": 50000,
"protocol": "TCP",
"targetPort": 50000
}
],
"selector": {
"name": "${JENKINS_SERVICE_NAME}"
},
"sessionAffinity": "None",
"type": "ClusterIP"
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"annotations": {
"service.alpha.openshift.io/dependencies": "[{"name": "${JNLP_SERVICE_NAME}", "namespace": "", "kind": "Service"}]",
"service.openshift.io/infrastructure": "true"
},
"name": "${JENKINS_SERVICE_NAME}"
},
"spec": {
"ports": [
{
"name": "web",
"nodePort": 0,
"port": 80,
"protocol": "TCP",
"targetPort": 8080
}
],
"selector": {
"name": "${JENKINS_SERVICE_NAME}"
},
"sessionAffinity": "None",
"type": "ClusterIP"
}
},
{
"apiVersion": "monitoring.coreos.com/v1",
"kind": "ServiceMonitor",
"metadata": {
"labels": {
"app": "${NAME}",
"name": "jenkins"
},
"name": "${NAME}-monitored"
},
"spec": {
"endpoints": [
{
"interval": "10s",
"path": "/prometheus/",
"port": "web"
}
],
"selector": {
"matchLabels": {
"app": "${NAME}"
}
}
}
}
],
"parameters": [
{
"description": "Name of the Jenkins instance to be monitored defined by the `app` label",
"displayName": "Name",
"name": "NAME",
"required": true,
"value": "jenkins-persistent"
},
{
"description": "The name of the OpenShift Service exposed for the Jenkins container.",
"displayName": "Jenkins Service Name",
"name": "JENKINS_SERVICE_NAME",
"value": "jenkins"
},
{
"description": "The name of the service used for master/slave communication.",
"displayName": "Jenkins JNLP Service Name",
"name": "JNLP_SERVICE_NAME",
"value": "jenkins-jnlp"
},
{
"description": "Whether to enable OAuth OpenShift integration. If false, the static account 'admin' will be initialized with the password 'password'.",
"displayName": "Enable OAuth in Jenkins",
"name": "ENABLE_OAUTH",
"value": "true"
},
{
"description": "Maximum amount of memory the container can use.",
"displayName": "Memory Limit",
"name": "MEMORY_LIMIT",
"value": "1Gi"
},
{
"description": "Volume space available for data, e.g. 512Mi, 2Gi.",
"displayName": "Volume Capacity",
"name": "VOLUME_CAPACITY",
"required": true,
"value": "1Gi"
},
{
"description": "The OpenShift Namespace where the Jenkins ImageStream resides.",
"displayName": "Jenkins ImageStream Namespace",
"name": "NAMESPACE",
"value": "openshift"
},
{
"description": "Whether to perform memory intensive, possibly slow, synchronization with the Jenkins Update Center on start. If true, the Jenkins core update monitor and site warnings monitor are disabled.",
"displayName": "Disable memory intensive administrative monitors",
"name": "DISABLE_ADMINISTRATIVE_MONITORS",
"value": "false"
},
{
"description": "Name of the ImageStreamTag to be used for the Jenkins image.",
"displayName": "Jenkins ImageStreamTag",
"name": "JENKINS_IMAGE_STREAM_TAG",
"value": "jenkins:2"
},
{
"description": "When a fatal error occurs, an error log is created with information and the state obtained at the time of the fatal error.",
"displayName": "Fatal Error Log File",
"name": "ENABLE_FATAL_ERROR_LOG_FILE",
"value": "false"
},
{
"description": "Whether to allow use of a Jenkins Update Center that uses invalid certificate (self-signed, unknown CA). If any value other than 'false', certificate check is bypassed. By default, certificate check is enforced.",
"displayName": "Allows use of Jenkins Update Center repository with invalid SSL certificate",
"name": "JENKINS_UC_INSECURE",
"value": "false"
}
]
}
Question posted in Json
Our archive of expertly curated questions and answers provides insights and solutions to common problems related to this popular data interchange format. From parsing and manipulating JSON data to integrating it with various programming languages and web services, our archive has got you covered. Start exploring today and take your JSON skills to the next level
Our archive of expertly curated questions and answers provides insights and solutions to common problems related to this popular data interchange format. From parsing and manipulating JSON data to integrating it with various programming languages and web services, our archive has got you covered. Start exploring today and take your JSON skills to the next level
3
Answers
this is a fixed version, but I don’t think that it is a good idea to fix it manually, you have to fix the code that created this json
So this is the broken part:
You are having a second opening curly bracket in line 6, you should have a name there, which shoul be a "string".
In JSON, an opening curly bracket ({) must be followed by a name, followed by a colon (:), followed by a value. It is not allowed to write two opening curly braces directly after each other without having a name or value between them.
The first problem is this bit:
In particular the extra set of opening braces around the contents of the sources array:
This is invalid!
There are other issues here though.