--- apiVersion: v1 data: deploy.js: "// Copyright 2018 Tremolo Security, Inc.\n// \n// Licensed under\ \ the Apache License, Version 2.0 (the \"License\");\n// you may not use this\ \ file except in compliance with the License.\n// You may obtain a copy of\ \ the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n\ // \n// Unless required by applicable law or agreed to in writing, software\n\ // distributed under the License is distributed on an \"AS IS\" BASIS,\n//\ \ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\ // See the License for the specific language governing permissions and\n//\ \ limitations under the License.\n\nprint(\"Loading CertUtils\");\nvar CertUtils\ \ = Java.type(\"com.tremolosecurity.kubernetes.artifacts.util.CertUtils\");\n\n\ print(\"Creating openunison keystore\");\n\nk8sDashboardNamespace = \"kube-system\"\ ;\n\nif (nonSecretInProp['K8S_DASHBOARD_NAMESPACE'] != null) {\n print(\"Getting\ \ k8s dashboard namespace from the configuration\");\n k8sDashboardNamespace\ \ = nonSecretInProp['K8S_DASHBOARD_NAMESPACE'];\n}\n\nk8sDashboardSecret = \"\ kubernetes-dashboard-certs\";\n\nif (nonSecretInProp['K8S_DASHBOARD_SECRET'] !=\ \ null) {\n print(\"Getting k8s dashboard secret from the configuration\");\n\ \ k8sDashboardSecret = nonSecretInProp['K8S_DASHBOARD_SECRET'];\n}\n\nk8sDashboardDeleteLabel\ \ = \"k8s-app=kubernetes-dashboard\";\n\nif (nonSecretInProp['K8S_DASHBOARD_LABEL']\ \ != null) {\n print(\"Getting k8s dashboard label from the configuration\");\n\ \ k8sDashboardDeleteLabel = nonSecretInProp['K8S_DASHBOARD_LABEL'];\n}\n\n\n\n\ \nksPassword = inProp['unisonKeystorePassword'];\nouKs = Java.type(\"java.security.KeyStore\"\ ).getInstance(\"PKCS12\");\nouKs.load(null,ksPassword.toCharArray());\n\nuse_k8s_cm\ \ = nonSecretInProp['USE_K8S_CM'] == \"true\";\n\n\ninProp['K8S_DB_SECRET'] =\ \ java.util.UUID.randomUUID().toString();\n\nvar docker_image = 'docker.io/tremolosecurity/openunison-k8s-login-activedirectory:latest';\n\ \nif (nonSecretInProp['image'] != null) {\n docker_image = nonSecretInProp['image'];\n\ \ delete nonSecretInProp['image'];\n}\n\n\nprint(\"Runing kubectl create\");\n\ k8s.kubectlCreate(deploymentTemplate);\nprint(\"kubectl complete\");\n\n\n\n\n\ \nou_cr = {\n \"apiVersion\": \"openunison.tremolo.io/v1\",\n \"kind\": \"OpenUnison\"\ ,\n \"metadata\": {\n \"name\": \"orchestra\"\n },\n \"spec\": {\n \ \ \"dest_secret\": \"orchestra\",\n \"enable_activemq\": false,\n \ \ \"hosts\": [\n {\n \"ingress_name\": \"openunison\",\n\ \ \"names\": [\n {\n \"env_var\"\ : \"OU_HOST\",\n \"name\": nonSecretInProp['OU_HOST']\n \ \ },\n {\n \"env_var\":\"\ K8S_DASHBOARD_HOST\",\n \"name\": nonSecretInProp['K8S_DASHBOARD_HOST']\n\ \ }\n ],\n \"secret_name\":\"ou-tls-certificate\"\ \n }\n ],\n \"key_store\": {\n \"update_controller\"\ :{\n \"image\" : \"docker.io/tremolosecurity/kubernetes-artifact-deployment:1.1.0\"\ ,\n \"schedule\" : \"0 2 * * *\",\n \"days_to_expire\" : 10\n\ \ },\n \"key_pairs\" : {\n \"create_keypair_template\"\ : [\n {\n \"name\": \"ou\",\n \"value\"\ : nonSecretInProp['OU_CERT_OU']\n },\n {\n \ \ \"name\": \"o\",\n \"value\": nonSecretInProp['OU_CERT_O']\n\ \ },\n {\n \"name\": \"l\",\n \ \ \"value\": nonSecretInProp['OU_CERT_L']\n },\n {\n\ \ \"name\": \"st\",\n \"value\": nonSecretInProp['OU_CERT_ST']\n\ \ },\n {\n \"name\": \"c\",\n \ \ \"value\": nonSecretInProp['OU_CERT_C']\n }\n ],\n \ \ \"keys\" : []\n },\n \"static_keys\":[],\n \"trusted_certificates\"\ :[]\n },\n \"non_secret_data\":[],\n \"openunison_network_configuration\"\ : {\n \"activemq_dir\": \"/tmp/amq\",\n \"allowed_client_names\"\ : [],\n \"ciphers\": [\n \"TLS_RSA_WITH_RC4_128_SHA\",\n \ \ \"TLS_RSA_WITH_AES_128_CBC_SHA\",\n \"TLS_RSA_WITH_AES_256_CBC_SHA\"\ ,\n \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\",\n \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\ ,\n \"TLS_RSA_WITH_AES_256_CBC_SHA256\"\n ],\n \"client_auth\"\ : \"none\",\n \"force_to_secure\": true,\n \"open_external_port\"\ : 80,\n \"open_port\": 8080,\n \"path_to_deployment\": \"/usr/local/openunison/work\"\ ,\n \"path_to_env_file\": \"/etc/openunison/ou.env\",\n \"quartz_dir\"\ : \"/tmp/quartz\",\n \"secure_external_port\": 443,\n \"secure_key_alias\"\ : \"unison-tls\",\n \"secure_port\": 8443\n },\n \"replicas\": 1,\n\ \ \"secret_data\": [],\n \"source_secret\": \"orchestra-secrets-source\"\ ,\n \"image\": docker_image\n }\n};\n\n\n\nprint(\"Generating openunison tls\ \ certificate\");\n\noutls = {\n \"create_data\" : {\n \"ca_cert\":true,\n\ \ \"key_size\":2048,\n \"server_name\":\"openunison.openunison.svc.cluster.local\"\ ,\n \"sign_by_k8s_ca\":use_k8s_cm,\n \"subject_alternative_names\":[]\n\ \ },\n \"import_into_ks\" : \"keypair\",\n \"name\": \"unison-tls\"\n\n};\n\ \nou_cr.spec.key_store.key_pairs.keys.push(outls);\n\n\noutls = {\n \"create_data\"\ \ : {\n \"ca_cert\":true,\n \"key_size\":2048,\n \"server_name\":nonSecretInProp['OU_HOST'],\n\ \ \"sign_by_k8s_ca\":false,\n \"subject_alternative_names\":[\n nonSecretInProp['K8S_DASHBOARD_HOST']\n\ \ ]\n },\n \"import_into_ks\" : \"certificate\",\n \"name\": \"unison-ca\"\ ,\n \"tls_secret_name\":\"ou-tls-certificate\"\n\n};\n\nou_cr.spec.key_store.key_pairs.keys.push(outls);\n\ \nprint(\"Generating the dashboard certificate\");\n\noutls = {\n \"create_data\"\ \ : {\n \"ca_cert\":(! use_k8s_cm),\n \"key_size\":2048,\n \"server_name\"\ :\"kubernetes-dashboard.\" + k8sDashboardNamespace + \".svc.cluster.local\",\n\ \ \"sign_by_k8s_ca\":use_k8s_cm,\n \"subject_alternative_names\":[],\n \ \ \"target_namespace\": k8sDashboardNamespace,\n \"secret_info\":{\n \ \ \"type_of_secret\":\"Opaque\",\n \"cert_name\":\"dashboard.crt\",\n \ \ \"key_name\":\"dashboard.key\"\n \n },\n \"delete_pods_labels\"\ \ : [k8sDashboardDeleteLabel]\n },\n \"import_into_ks\" : (use_k8s_cm ? \"none\"\ \ : \"certificate\"),\n \"name\": \"kubernetes-dashboard\",\n \"tls_secret_name\"\ :k8sDashboardSecret,\n \"replace_if_exists\": true\n \n\n};\n\nou_cr.spec.key_store.key_pairs.keys.push(outls);\n\ \n\nprint(\"Saving certificate to keystore\");\n\nou_cr.spec.key_store.static_keys.push({\n\ \ \"name\":\"session-unison\",\n \"version\":1\n});\n\nou_cr.spec.key_store.static_keys.push({\n\ \ \"name\":\"lastmile-oidc\",\n \"version\":1\n});\n\n\n\nprint(\"Generating\ \ OIDC Certificate\");\n\noutls = {\n \"create_data\" : {\n \"ca_cert\":true,\n\ \ \"key_size\":2048,\n \"server_name\":\"unison-saml2-rp-sig\",\n \"\ sign_by_k8s_ca\":false,\n \"subject_alternative_names\":[]\n },\n \"import_into_ks\"\ \ : \"keypair\",\n \"name\": \"unison-saml2-rp-sig\"\n\n};\n\nou_cr.spec.key_store.key_pairs.keys.push(outls);\n\ \n\n\nouNS = {\n \"apiVersion\":\"v1\",\n \"kind\":\"Namespace\",\n \"\ metadata\":{\n \"creationTimestamp\":null,\n \"name\":\"openunison\"\ \n },\n \"spec\":{},\n \"status\":{}\n};\n\nk8s.postWS('/api/v1/namespaces',JSON.stringify(ouNS));\n\ \nprint(\"Create operator rbac policies\");\n\nk8s_obj = {\n \"apiVersion\":\ \ \"rbac.authorization.k8s.io/v1\",\n \"kind\": \"Role\",\n \"metadata\": {\n\ \ \"name\": \"openunison-operator-role\"\n },\n \"rules\": [\n {\n \ \ \"apiGroups\": [\n \"openunison.tremolo.io\",\n \"\",\n \ \ \"apps\",\n \"rbac.authorization.k8s.io\",\n \"extensions\"\ ,\n \"apps.openshift.io\",\n \"build.openshift.io\",\n \"\ image.openshift.io\",\n \"route.openshift.io\",\n \"user.openshift.io\"\ ,\n \"batch\"\n ],\n \"resources\": [\n \"routes/custom-host\"\ ,\n \"imagestreamimports\",\n \"users\",\n \"groups\",\n\ \ \"routes\",\n \"images\",\n \"imagestreams\",\n \ \ \"builds\",\n \"buildconfigs\",\n \"deploymentconfigs\",\n \ \ \"openunisons\",\n \"openunisons/status\",\n \"pods\",\n \ \ \"deployments\",\n \"secrets\",\n \"configmaps\",\n \ \ \"services\",\n \"serviceaccounts\",\n \"roles\",\n \ \ \"rolebindings\",\n \"ingresses\",\n \"cronjobs\"\n ],\n\ \ \"verbs\": [\n \"*\"\n ]\n }\n ]\n};\n\n\n\nk8s.postWS('/apis/rbac.authorization.k8s.io/v1/namespaces/openunison/roles',JSON.stringify(k8s_obj));\n\ \nprint(\"Creating rbac binding\");\n\nk8s_obj = {\n \"apiVersion\": \"rbac.authorization.k8s.io/v1\"\ ,\n \"kind\": \"RoleBinding\",\n \"metadata\": {\n \"name\": \"openunison-operator-rolebinding\"\ \n },\n \"roleRef\": {\n \"apiGroup\": \"rbac.authorization.k8s.io\",\n \ \ \"kind\": \"Role\",\n \"name\": \"openunison-operator-role\"\n },\n \"\ subjects\": [\n {\n \"kind\": \"ServiceAccount\",\n \"name\": \"\ openunison-operator\",\n \"namespace\":\"openunison\"\n }\n ]\n};\n\n\ k8s.postWS('/apis/rbac.authorization.k8s.io/v1/namespaces/openunison/rolebindings',JSON.stringify(k8s_obj));\n\ \nprint(\"Creating the operator service account\");\n\nk8s_obj = {\n \"apiVersion\"\ : \"v1\",\n \"kind\": \"ServiceAccount\",\n \"metadata\": {\n \"name\": \"\ openunison-operator\"\n }\n};\n\nk8s.postWS('/api/v1/namespaces/openunison/serviceaccounts',JSON.stringify(k8s_obj));\n\ \n\n\nobj = {\n \"kind\": \"Role\",\n \"apiVersion\": \"rbac.authorization.k8s.io/v1\"\ ,\n \"metadata\": {\n \"namespace\": k8sDashboardNamespace,\n \ \ \"name\": \"orchestra-dashboard\"\n },\n \"rules\": [\n {\n \ \ \"apiGroups\": [\n \"\"\n ],\n \ \ \"resources\": [\n \"secrets\",\n \"pods\"\n\ \ ],\n \"verbs\": [\n \"*\"\n \ \ ]\n }\n ]\n};\n\nk8s.postWS('/apis/rbac.authorization.k8s.io/v1/namespaces/'\ \ + k8sDashboardNamespace + '/roles',JSON.stringify(obj));\n\nobj = {\n \"\ kind\": \"RoleBinding\",\n \"apiVersion\": \"rbac.authorization.k8s.io/v1\"\ ,\n \"metadata\": {\n \"name\": \"orchestra-dashboard\",\n \"\ namespace\": k8sDashboardNamespace\n },\n \"subjects\": [\n {\n \ \ \"kind\": \"ServiceAccount\",\n \"name\": \"openunison-operator\"\ ,\n \"namespace\": \"openunison\"\n }\n ],\n \"roleRef\"\ : {\n \"kind\": \"Role\",\n \"name\": \"orchestra-dashboard\",\n\ \ \"apiGroup\": \"rbac.authorization.k8s.io\"\n }\n};\n\nk8s.postWS('/apis/rbac.authorization.k8s.io/v1/namespaces/'\ \ + k8sDashboardNamespace + '/rolebindings',JSON.stringify(obj));\n\n\nobj = {\n\ \ \"kind\": \"ClusterRole\",\n \"apiVersion\": \"rbac.authorization.k8s.io/v1\"\ ,\n \"metadata\": {\n \"name\": \"orchestra-certs\"\n },\n \"rules\":\ \ [\n {\n \"apiGroups\": [\n \"certificates.k8s.io\"\ ,\n ],\n \"resources\": [\n \"certificatesigningrequests\"\ ,\n \"certificatesigningrequests/approval\"\n\n ],\n \ \ \"verbs\": [\n \"*\"\n ]\n }\n ]\n};\n\nk8s.postWS('/apis/rbac.authorization.k8s.io/v1/clusterroles',JSON.stringify(obj));\n\ \nobj = {\n \"kind\": \"ClusterRoleBinding\",\n \"apiVersion\": \"rbac.authorization.k8s.io/v1\"\ ,\n \"metadata\": {\n \"name\": \"orchestra-certs\"\n },\n \"subjects\"\ : [\n {\n \"kind\": \"ServiceAccount\",\n \"name\": \"\ openunison-operator\",\n \"namespace\": \"openunison\"\n }\n ],\n\ \ \"roleRef\": {\n \"kind\": \"ClusterRole\",\n \"name\": \"orchestra-certs\"\ ,\n \"apiGroup\": \"rbac.authorization.k8s.io\"\n }\n};\n\nk8s.postWS('/apis/rbac.authorization.k8s.io/v1/clusterrolebindings',JSON.stringify(obj));\n\ \n\n\nprint(\"Creating the operator deployment\");\n\nk8s_obj = {\n \"apiVersion\"\ : \"apps/v1\",\n \"kind\": \"Deployment\",\n \"metadata\": {\n \"labels\"\ : {\n \"app\": \"openunison-operator\"\n },\n \"name\": \"openunison-operator\"\ \n },\n \"spec\": {\n \"progressDeadlineSeconds\": 600,\n \"replicas\"\ : 1,\n \"revisionHistoryLimit\": 10,\n \"selector\": {\n \"matchLabels\"\ : {\n \"app\": \"openunison-operator\"\n }\n },\n \"strategy\"\ : {\n \"rollingUpdate\": {\n \"maxSurge\": \"25%\",\n \"maxUnavailable\"\ : \"25%\"\n },\n \"type\": \"RollingUpdate\"\n },\n \"template\"\ : {\n \"metadata\": {\n \"creationTimestamp\": null,\n \"labels\"\ : {\n \"app\": \"openunison-operator\"\n }\n },\n \"\ spec\": {\n \"containers\": [\n {\n \"env\": [\n \ \ {\n \"name\": \"JAVA_OPTS\",\n \"value\"\ : \"-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom\"\n \ \ },\n {\n \"name\": \"NAMESPACE\",\n \ \ \"valueFrom\": {\n \"fieldRef\": {\n \ \ \"fieldPath\": \"metadata.namespace\"\n }\n \ \ }\n },\n {\n \"name\":\"EXTRA_JS\"\ ,\n \"value\":\"/usr/local/openunison/js-external\"\n \ \ }\n ],\n \"image\": \"docker.io/tremolosecurity/openunison-k8s-operator\"\ ,\n \"command\": [\n \"java\",\n \"-jar\"\ ,\n \"/usr/local/openunison/javascript-operator.jar\",\n \ \ \"-tokenPath\",\n \"/var/run/secrets/kubernetes.io/serviceaccount/token\"\ ,\n \"-rootCaPath\",\n \"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\"\ ,\n \"-kubernetesURL\",\n \"https://kubernetes.default.svc.cluster.local\"\ ,\n \"-namespace\",\n \"NAMESPACE\",\n \ \ \"-apiGroup\",\n \"openunison.tremolo.io/v1\",\n \"\ -objectType\",\n \"openunisons\",\n \"-jsPath\",\n \ \ \"/usr/local/openunison/js\",\n \"-configMaps\",\n\ \ \"/etc/extraMaps\"\n ],\n \"imagePullPolicy\"\ : \"Always\",\n \"name\": \"openunison-operator\",\n \"\ resources\": {\n },\n \"terminationMessagePath\": \"/dev/termination-log\"\ ,\n \"terminationMessagePolicy\": \"File\",\n \"volumeMounts\"\ : [\n {\n \"mountPath\": \"/etc/extraMaps\",\n \ \ \"name\": \"extra-maps\",\n \"readOnly\": true\n\ \ }\n ]\n }\n ],\n \"dnsPolicy\"\ : \"ClusterFirst\",\n \"restartPolicy\": \"Always\",\n \"terminationGracePeriodSeconds\"\ : 30,\n \"serviceAccount\": \"openunison-operator\",\n \"volumes\"\ : [\n {\n \"name\": \"extra-maps\",\n \"emptyDir\"\ : {\n }\n }\n ]\n }\n }\n }\n};\n\nk8s.postWS('/apis/apps/v1/namespaces/openunison/deployments',JSON.stringify(k8s_obj));\n\ \n//k8s.postWS('/apis/openunison.tremolo.io/v1/namespaces/openunison/openunisons',JSON.stringify(k8s_obj));\n\ \n\nprint(\"Create OpenUnison Source Secret\");\n\n\nouSecrets = {\n \"apiVersion\"\ :\"v1\",\n \"kind\":\"Secret\",\n \"type\":\"Opaque\",\n \"metadata\"\ : {\n \"name\":\"orchestra-secrets-source\",\n \"namespace\":\"\ openunison\"\n },\n \"data\":{\n \n }\n}\n\nfor each (var key in\ \ inProp.keySet()) {\n \n ouSecrets.data[key] = java.util.Base64.getEncoder().encodeToString(inProp[key].getBytes(\"\ UTF-8\"));\n ou_cr.spec.secret_data.push(key);\n \n}\n\nk8s.postWS('/api/v1/namespaces/openunison/secrets',JSON.stringify(ouSecrets));\n\ \nprint(\"Adding non-secret properties to CR\");\n\nfor each (var key in nonSecretInProp.keySet())\ \ {\n \n ou_cr.spec.non_secret_data.push( {\n \"name\": key,\n \"\ value\": nonSecretInProp[key]\n });\n \n}\n\nprint(\"Adding trusted certs\ \ to the cr\");\n\nvar trusted_certs = k8s.getExtraCerts();\n\nfor each (var key\ \ in trusted_certs.keySet()) {\n ou_cr.spec.key_store.trusted_certificates.push({\n\ \ \"name\" : key,\n \"pem_data\" : trusted_certs[key]\n });\n}\n\nprint(JSON.stringify(ou_cr));\n\ \n\nprint(\"Creating post deployment configmap\");\n\noidcFlags = \"--oidc-issuer-url=https://\"\ \ + nonSecretInProp[\"OU_HOST\"] + \"/auth/idp/k8sIdp\\n\" +\n \"--oidc-client-id=kubernetes\\\ n\" +\n \"--oidc-username-claim=sub\\n\" + \n \"--oidc-groups-claim=groups\\\ n\" +\n \"--oidc-ca-file=/etc/kubernetes/pki/ou-ca.pem\";\n\nprint(\"\ Runing kubectl create\");\nk8s.kubectlCreate(k8s.processTemplate(deploymentTemplate,inProp));\n\ print(\"kubectl complete\");\n\ncfgMap = {\n \"apiVersion\":\"v1\",\n \"\ kind\":\"ConfigMap\",\n \"metadata\":{\n \"name\":\"api-server-config\"\ ,\n \"namespace\":\"openunison\"\n },\n \"data\":{\n \"oidc-api-server-flags\"\ :oidcFlags\n }\n};\n\nk8s.postWS('/api/v1/namespaces/openunison/configmaps',JSON.stringify(cfgMap));\n\ \n\nprint(\"Waiting for the OpenUnison operator to be deployed\");\n\nk8s.callWS('/api/v1/namespaces/openunison/pods?labelSelector=app%3Dopenunison-operator&limit=500',\"\ check_ws_response = (JSON.parse(ws_response_json).items[0].status.phase == 'Running')\ \ \",20);\n\n\n\nprint(\"Deploying the CR\");\n\nprint(k8s.postWS('/apis/openunison.tremolo.io/v1/namespaces/openunison/openunisons',JSON.stringify(ou_cr))[\"\ data\"]);\n\n\nprint(\"Deleting cluster role binding\");\nk8s.deleteWS('/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/artifact-deployment');\n\ \nprint(\"Artifacts Created, to configure the API server run 'kubectl describe\ \ configmap api-server-config -n openunison'\");" openunison.yaml: "---\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n\ metadata:\n name: users.openunison.tremolo.io\nspec:\n group: openunison.tremolo.io\n\ \ versions:\n - name: v1\n served: true\n storage: true\n version:\ \ v1\n scope: Namespaced\n names:\n plural: users\n singular: user\n \ \ kind: User\n shortNames:\n - usr\n validation:\n # openAPIV3Schema\ \ is the schema for validating custom objects.\n openAPIV3Schema:\n properties:\n\ \ spec:\n properties:\n sub:\n type: string\n\ \ groups:\n type: array\n items:\n \ \ type: string\n first_name:\n type: string\n\ \ last_name:\n type: string\n email:\n \ \ type: string\n---\napiVersion: apiextensions.k8s.io/v1beta1\nkind:\ \ CustomResourceDefinition\nmetadata:\n name: oidc-sessions.openunison.tremolo.io\n\ spec:\n group: openunison.tremolo.io\n versions:\n - name: v1\n served:\ \ true\n storage: true\n version: v1\n scope: Namespaced\n names:\n \ \ plural: oidc-sessions\n singular: oidc-session\n kind: OidcSession\n\ \ shortNames:\n - oidc\n validation:\n # openAPIV3Schema is the schema\ \ for validating custom objects.\n openAPIV3Schema:\n properties:\n \ \ spec:\n properties:\n session_id:\n type:\ \ string\n client_id:\n type: string\n encrypted_id_token:\n\ \ type: string\n encrypted_access_token:\n \ \ type: string\n expires:\n type: string\n \ \ user_dn:\n type: string\n refresh_token:\n \ \ type: string\n---\nkind: Role\napiVersion: rbac.authorization.k8s.io/v1\n\ metadata:\n namespace: openunison\n name: oidc-user-sessions\nrules:\n- apiGroups:\ \ [\"openunison.tremolo.io\"]\n resources: [\"oidc-sessions\",\"users\"]\n verbs:\ \ [\"*\"]\n---\nkind: RoleBinding\napiVersion: rbac.authorization.k8s.io/v1\n\ metadata:\n name: oidc-user-sessions\n namespace: openunison\nsubjects:\n- kind:\ \ ServiceAccount\n name: openunison-orchestra\n namespace: openunison\nroleRef:\n\ \ kind: Role\n name: oidc-user-sessions\n apiGroup: rbac.authorization.k8s.io\n\ ---\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n\ metadata:\n name: openunisons.openunison.tremolo.io\nspec:\n group: openunison.tremolo.io\n\ \ versions:\n - name: v1\n served: true\n storage: true\n version:\ \ v1\n scope: Namespaced\n subresources:\n status: {}\n names:\n plural:\ \ openunisons\n singular: openunison\n kind: OpenUnison\n shortNames:\n\ \ - ou\n validation:\n # openAPIV3Schema is the schema for validating custom\ \ objects.\n openAPIV3Schema:\n properties:\n spec:\n \ \ properties:\n image:\n type: string\n replicas:\n\ \ type: integer\n enable_activemq:\n type:\ \ boolean\n activemq_image:\n type: string\n \ \ dest_secret:\n type: string\n source_secret:\n \ \ type: string\n secret_data:\n type: array\n\ \ items:\n type: string\n openshift:\n\ \ type: object\n properties:\n git:\n\ \ type: object\n properties:\n \ \ repo:\n type: string\n branch:\ \ \n type: string\n dir:\n \ \ type: string\n builder_image:\n type:\ \ string\n hosts:\n type: array\n items:\n\ \ type: object\n properties:\n \ \ names:\n type: array\n items:\n \ \ type: object\n properties:\n \ \ name:\n type: string\n \ \ env_var:\n type: string\n ingress_name:\ \ \n type: string\n secret_name:\n \ \ type: string\n node_selectors:\n \ \ type: array\n items:\n type: object\n\ \ properties:\n name: \n \ \ type: string\n value:\n \ \ type: string\n non_secret_data:\n type:\ \ array\n items:\n type: object\n properties:\n\ \ name:\n type: string\n \ \ value:\n type: string\n openunison_network_configuration:\n\ \ type: object\n properties:\n force_to_lower_case:\n\ \ type: boolean\n open_port:\n \ \ type: integer\n open_external_port:\n type:\ \ integer\n secure_port:\n type: integer\n \ \ secure_external_port:\n type: integer\n \ \ force_to_secure:\n type: boolean\n activemq_dir:\n\ \ type: string\n client_auth:\n \ \ type: string\n allowed_client_names:\n type:\ \ array\n items:\n type: string\n \ \ ciphers:\n type: array\n items:\n \ \ type: string\n path_to_deployment:\n \ \ type: string\n path_to_env_file:\n \ \ type: string\n secure_key_alias:\n type: string\n\ \ allowed_tls_protocols:\n type: array\n \ \ items:\n type: string\n quartz_dir:\n\ \ type: string\n context_root:\n \ \ type: string\n disable_http2:\n type: boolean\n\ \ allow_un_escaped_chars:\n type: string\n \ \ welecome_pages:\n type: array\n \ \ items:\n type: string\n error_pages:\n \ \ type: array\n items:\n type:\ \ object\n properties:\n code:\n \ \ type: integer\n location:\n \ \ type: string\n redirect_to_context_root:\n \ \ type: boolean\n saml_remote_idp:\n type:\ \ array\n items:\n type: object\n properties:\n\ \ source:\n type: object\n \ \ properties:\n url:\n type: string\n\ \ xml:\n type: string\n \ \ mapping:\n type: object\n properties:\n\ \ entity_id:\n type: string\n \ \ post_url:\n type: string\n \ \ redirect_url:\n type: string\n \ \ logout_url:\n type: string\n \ \ signing_cert_alis:\n type: string\n \ \ encryption_cert_alias:\n type: string\n \ \ run_sql:\n type: string\n key_store:\n \ \ type: object\n properties:\n update_controller:\n\ \ type: object\n properties:\n \ \ image:\n type: string\n schedule:\n\ \ type: string\n days_to_expire:\n \ \ type: integer\n static_keys:\n \ \ type: array\n items:\n type: object\n\ \ properties:\n name:\n \ \ type: string\n version:\n \ \ type: integer\n trusted_certificates:\n type:\ \ array\n items:\n type: object\n \ \ properties:\n name:\n \ \ type: string\n pem_data:\n type:\ \ string\n key_pairs:\n type: object\n \ \ properties:\n create_keypair_template:\n \ \ type: array\n items:\n \ \ type: object\n properties:\n \ \ name:\n type: string\n \ \ value:\n type: string\n \ \ keys:\n type: array\n items:\n \ \ type: object\n properties:\n \ \ name:\n type: string\n \ \ tls_secret_name:\n type: string\n\ \ import_into_ks:\n type:\ \ string\n enum:\n - keypair\n\ \ - certificate\n - none\n\ \ replace_if_exists:\n type:\ \ boolean\n create_data:\n \ \ type: object\n properties:\n \ \ sign_by_k8s_ca:\n type: boolean\n \ \ server_name:\n type:\ \ string\n subject_alternative_names:\n \ \ type: array\n items:\n\ \ type: string\n \ \ key_size:\n type: integer\n \ \ ca_cert:\n type: boolean\n \ \ delete_pods_labels:\n \ \ type: array\n items:\n \ \ type: string\n secret_info:\n \ \ type: object\n properties:\n\ \ type_of_secret:\n \ \ type: string\n cert_name:\n \ \ type: string\n \ \ key_name:\n type: string\n \ \ \n \n \n \n \ \ " kind: ConfigMap metadata: name: deployment-scripts namespace: openunison-deploy --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: artifact-deployment roleRef: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount namespace: openunison-deploy name: default --- apiVersion: batch/v1 kind: Job metadata: name: artifact-deployment namespace: openunison-deploy spec: template: spec: containers: - name: artifact-deployment imagePullPolicy: Always image: docker.io/tremolosecurity/kubernetes-artifact-deployment:1.1.0 command: ["java", "-jar", "/usr/local/artifactdeploy/artifact-deploy.jar", "-extraCertsPath","/etc/extracerts","-installScriptURL", "file:///etc/input-maps/deploy.js","-kubernetesURL","https://kubernetes.default.svc.cluster.local","-rootCaPath","/var/run/secrets/kubernetes.io/serviceaccount/ca.crt","-secretsPath","/etc/secrets/input.props","-tokenPath","/var/run/secrets/kubernetes.io/serviceaccount/token","-deploymentTemplate","file:///etc/input-maps/openunison.yaml"] volumeMounts: - name: secrets-dir mountPath: "/etc/secrets" readOnly: true - name: extra-certs-dir mountPath: "/etc/extracerts" readOnly: true - name: input-maps mountPath: "/etc/input-maps" readOnly: true restartPolicy: Never volumes: - name : secrets-dir secret: secretName: input - name : extra-certs-dir configMap: name: extracerts - name: input-maps configMap: name: deployment-scripts backoffLimit: 1