├── src ├── test │ ├── resources │ │ ├── samples │ │ │ ├── config │ │ │ │ ├── utv │ │ │ │ │ ├── pv.json │ │ │ │ │ ├── ah.json │ │ │ │ │ ├── web.json │ │ │ │ │ ├── job.json │ │ │ │ │ ├── simple.json │ │ │ │ │ ├── whoami.json │ │ │ │ │ ├── template.json │ │ │ │ │ ├── about.json │ │ │ │ │ ├── complex.json │ │ │ │ │ ├── easy.json │ │ │ │ │ ├── about-alternate.json │ │ │ │ │ └── python.json │ │ │ │ ├── easy.json │ │ │ │ ├── include │ │ │ │ │ ├── simple.json │ │ │ │ │ ├── include.json │ │ │ │ │ └── about.json │ │ │ │ ├── about.json │ │ │ │ ├── about-alternative2.json │ │ │ │ ├── template.json │ │ │ │ ├── about-alternative1.json │ │ │ │ ├── pv.json │ │ │ │ ├── web.json │ │ │ │ ├── whoami.json │ │ │ │ ├── simple.json │ │ │ │ ├── ah.json │ │ │ │ ├── python.json │ │ │ │ ├── include.json │ │ │ │ └── job.json │ │ │ └── result │ │ │ │ └── utv │ │ │ │ ├── ah │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── route.json │ │ │ │ ├── secret-db.json │ │ │ │ └── imagestream.json │ │ │ │ ├── job │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── secret-job-foo-vault.json │ │ │ │ ├── storagegridobjectarea-job-default.json │ │ │ │ └── secret-job-default-s3.json │ │ │ │ ├── web │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── imagestream.json │ │ │ │ ├── configmap-toxiproxy.json │ │ │ │ ├── route.json │ │ │ │ └── route-webseal.json │ │ │ │ ├── complex │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-edit.json │ │ │ │ ├── rolebinding-view.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── secret-secret-mount.json │ │ │ │ ├── secret-komplex-foo-vault.json │ │ │ │ ├── bigip.json │ │ │ │ ├── secret-komplex-hec.json │ │ │ │ ├── sgoa.json │ │ │ │ ├── auroraazureapp-komplex.json │ │ │ │ ├── route-path.json │ │ │ │ ├── secret-foo-db.json │ │ │ │ ├── secret-komplex-db.json │ │ │ │ ├── route-bigip.json │ │ │ │ ├── route-komplex-managed.json │ │ │ │ └── route.json │ │ │ │ ├── python │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── route.json │ │ │ │ ├── secret-db.json │ │ │ │ ├── sgoa.json │ │ │ │ ├── secret-s3.json │ │ │ │ ├── secret-sts.json │ │ │ │ └── imagestream.json │ │ │ │ ├── simple │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── route.json │ │ │ │ ├── secret-db.json │ │ │ │ ├── sgoa.json │ │ │ │ ├── secret-s3.json │ │ │ │ ├── secret-sts.json │ │ │ │ └── imagestream.json │ │ │ │ ├── whoami │ │ │ │ ├── projectrequest.json │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── configmap-whoami-toxiproxy-config.json │ │ │ │ └── secret-db.json │ │ │ │ ├── pv │ │ │ │ ├── projectrequest-paas-utv.json │ │ │ │ ├── namespace-paas-utv.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── persistentvolumeclaim-postgres.json │ │ │ │ └── imagestream-postgres.json │ │ │ │ ├── template │ │ │ │ ├── projectrequest-paas-utv.json │ │ │ │ ├── namespace-paas-utv.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── route-template.json │ │ │ │ └── imagestream-template.json │ │ │ │ └── easy │ │ │ │ ├── namespace.json │ │ │ │ ├── rolebinding-admin.json │ │ │ │ ├── imagestreamimport.json │ │ │ │ ├── route.json │ │ │ │ ├── secret-db.json │ │ │ │ ├── secret-s3.json │ │ │ │ ├── secret-sts.json │ │ │ │ ├── sgoa.json │ │ │ │ └── imagestream.json │ │ ├── no │ │ │ └── skatteetaten │ │ │ │ └── aurora │ │ │ │ └── boober │ │ │ │ ├── facade │ │ │ │ ├── DeployFacadeTest │ │ │ │ │ ├── ad.json │ │ │ │ │ ├── fionaResponse.json │ │ │ │ │ ├── keystore.jks │ │ │ │ │ ├── response_version.json │ │ │ │ │ ├── users.json │ │ │ │ │ ├── cantusManifestResponse.json │ │ │ │ │ ├── template-spec.txt │ │ │ │ │ ├── pv-spec.txt │ │ │ │ │ ├── namespace.json │ │ │ │ │ ├── project.json │ │ │ │ │ ├── web-spec.txt │ │ │ │ │ ├── whoami-spec.txt │ │ │ │ │ ├── ah-spec.txt │ │ │ │ │ ├── groups.json │ │ │ │ │ ├── simple-spec.txt │ │ │ │ │ ├── dbhResponse.json │ │ │ │ │ ├── job-spec.txt │ │ │ │ │ ├── python-spec.txt │ │ │ │ │ └── herkimerResponseBucketAdminSG.json │ │ │ │ └── StsRenewFacadeTest │ │ │ │ │ └── keystore.jks │ │ │ │ ├── unit │ │ │ │ ├── resourceprovisioning │ │ │ │ │ ├── DatabaseSchemaProvisionerTest │ │ │ │ │ │ ├── schema_empty_response.json │ │ │ │ │ │ ├── schema_fd59dba9-7d67-4ea2-bb98-081a5df8c387_not_found.json │ │ │ │ │ │ └── schema_fd59dba9-7d67-4ea2-bb98-081a5df8c387.json │ │ │ │ │ └── StsProvisionerTest │ │ │ │ │ │ └── keystore.jks │ │ │ │ ├── OpenShiftObjectResourceGeneratorTest │ │ │ │ │ └── keystore.jks │ │ │ │ ├── ResourceMergerTest │ │ │ │ │ ├── namespace-new.json │ │ │ │ │ ├── namespace.json │ │ │ │ │ ├── configmap-new.json │ │ │ │ │ ├── configmap.json │ │ │ │ │ ├── auroracname-new.json │ │ │ │ │ ├── auroraazurecname-new.json │ │ │ │ │ ├── auroracname.json │ │ │ │ │ ├── auroraazurecname.json │ │ │ │ │ ├── pvc-new.json │ │ │ │ │ ├── pvc.json │ │ │ │ │ ├── service-new.json │ │ │ │ │ └── service.json │ │ │ │ ├── OpenShiftClientTest │ │ │ │ │ └── response_version.json │ │ │ │ ├── OpenShiftCommandServiceCreateDeleteCommandsTest │ │ │ │ │ └── response_version.json │ │ │ │ └── OpenShiftCommandServiceTest │ │ │ │ │ ├── route.json │ │ │ │ │ ├── route-with-new-host.json │ │ │ │ │ ├── route-with-new-path.json │ │ │ │ │ └── webseal-route-generated.json │ │ │ │ └── feature │ │ │ │ ├── StsFeatureTest │ │ │ │ └── keystore.jks │ │ │ │ ├── CertificateFeatureTest │ │ │ │ └── keystore.jks │ │ │ │ ├── HerkimerVaultFeatureTest │ │ │ │ ├── secret-fus.json │ │ │ │ ├── secret-pros.json │ │ │ │ └── secret-ski.json │ │ │ │ ├── TemplateFeatureTest │ │ │ │ ├── route.json │ │ │ │ ├── is.json │ │ │ │ └── service.json │ │ │ │ ├── LocalTemplateFeatureTest │ │ │ │ ├── route.json │ │ │ │ ├── is.json │ │ │ │ └── service.json │ │ │ │ ├── RouteFeatureTest │ │ │ │ ├── aurora-cname-simple.json │ │ │ │ ├── aurora-cname.json │ │ │ │ ├── aurora-cname-azure.json │ │ │ │ ├── foo-aurora-cname.json │ │ │ │ ├── simple-foo-aurora-cname.json │ │ │ │ ├── aurora-cname-specific-host.json │ │ │ │ ├── aurora-cname-azure-specific-host.json │ │ │ │ ├── not-just-default-aurora-cname.json │ │ │ │ ├── fqdn-route.json │ │ │ │ ├── foo-route.json │ │ │ │ ├── route.json │ │ │ │ ├── bar-route.json │ │ │ │ ├── route-with-cname-simple.json │ │ │ │ ├── route-with-cname.json │ │ │ │ ├── foo-route-with-cname.json │ │ │ │ ├── route-with-specific-cname.json │ │ │ │ ├── path-route.json │ │ │ │ ├── foo-route-with-not-default-cname.json │ │ │ │ ├── annotations-route.json │ │ │ │ ├── tls-route.json │ │ │ │ ├── foo-tls-route.json │ │ │ │ ├── route-with-azure.json │ │ │ │ ├── route-with-azure-cname-simple.json │ │ │ │ └── route-with-azure-specific-host.json │ │ │ │ ├── FluentbitSidecarFeatureTest │ │ │ │ └── secret.json │ │ │ │ ├── BigIpFeatureTest │ │ │ │ ├── MultipleRoutes │ │ │ │ │ ├── bigip-1.json │ │ │ │ │ ├── bigip-2.json │ │ │ │ │ ├── route-1.json │ │ │ │ │ └── route-2.json │ │ │ │ ├── bigip.json │ │ │ │ ├── route.json │ │ │ │ ├── legacy-spec-default.json │ │ │ │ └── spec-default.json │ │ │ │ ├── ToxiproxySidecarFeatureTest │ │ │ │ ├── config.json │ │ │ │ ├── configWithDatabaseMapping.json │ │ │ │ ├── configWithNamedDatabaseProxiesMapping.json │ │ │ │ ├── configWithMultipleDatabasesMapping.json │ │ │ │ ├── configWithServerAndPortMapping.json │ │ │ │ └── configWithEndpointMapping.json │ │ │ │ ├── ToxiproxySidecarFeatureNoDbTest │ │ │ │ └── config.json │ │ │ │ ├── AuroraAzureAppSubPartTest │ │ │ │ ├── aurora-azure-app.json │ │ │ │ ├── aurora-azure-app-with-clinger.json │ │ │ │ ├── aurora-azure-app-with-env.json │ │ │ │ ├── aurora-azure-app-with-webseal.json │ │ │ │ ├── aurora-azure-managed-route.json │ │ │ │ ├── aurora-azure-managed-route-with-env.json │ │ │ │ ├── webseal-route.json │ │ │ │ ├── aurora-azure-route-timeout.json │ │ │ │ └── webseal-saksmappe-route.json │ │ │ │ ├── JwtToStsConverterSubPartTest │ │ │ │ ├── auroraazureapp.json │ │ │ │ └── webseal-route.json │ │ │ │ ├── AuroraAzureApimSubPartTest │ │ │ │ ├── aurora-azure-apim.json │ │ │ │ ├── aurora-azure-apim-v2.json │ │ │ │ └── aurora-azure-apim-with-policies.json │ │ │ │ ├── WebSealFeatureTest │ │ │ │ ├── route.json │ │ │ │ ├── route-custom.json │ │ │ │ └── route-timeout.json │ │ │ │ ├── WebDeployFeatureTest │ │ │ │ ├── is.json │ │ │ │ └── service.json │ │ │ │ ├── JavaDeployFeatureTest │ │ │ │ ├── is-1.json │ │ │ │ ├── service-no-prometheus.json │ │ │ │ ├── is.json │ │ │ │ └── service.json │ │ │ │ ├── PythonDeployFeatureTest │ │ │ │ ├── is-1.json │ │ │ │ ├── is.json │ │ │ │ ├── service-no-prometheus.json │ │ │ │ └── service.json │ │ │ │ ├── JobFeatureTest │ │ │ │ ├── job.json │ │ │ │ └── cronjob.json │ │ │ │ └── ConfigFeatureTest │ │ │ │ └── configMap.json │ │ ├── junit-platform.properties │ │ └── logback-test.xml │ └── kotlin │ │ └── no │ │ └── skatteetaten │ │ └── aurora │ │ └── boober │ │ ├── utils │ │ ├── GitServiceHelper.kt │ │ ├── CollectionUtilsTest.kt │ │ ├── FolderHelper.kt │ │ ├── StringUtilsTest.kt │ │ └── SecretUtilsTest.kt │ │ ├── feature │ │ ├── WebsealFeatureDisabledTest.kt │ │ ├── StsFeatureDisabledTest.kt │ │ ├── CertificateFeatureDisabledTest.kt │ │ ├── DatabaseFeatureDisabledTest.kt │ │ └── S3FeatureDisabledTest.kt │ │ ├── unit │ │ ├── S3StorageGridProvisionerTest.kt │ │ ├── ImageStreamImportGeneratorTest.kt │ │ └── FeatureContextTest.kt │ │ └── controller │ │ └── v1 │ │ └── AuroraConfigNamesControllerV1Test.kt └── main │ ├── http │ ├── get_clientconfig.http │ ├── http-client.env.json │ ├── inspect.http │ ├── deploy_history.http │ ├── get_auroradeployspec.http │ ├── get_auroraconfig_file.http │ ├── validate_auroraconfig_remote.http │ ├── get_vault_file.http │ ├── post_reencrypt_vaultcollection.http │ ├── deploy.http │ ├── put_auroraconfig_file.http │ ├── put_vault_file.http │ ├── post_renew_cert.http │ └── validate_auroraconfig_illegal_type.http │ ├── kotlin │ └── no │ │ └── skatteetaten │ │ └── aurora │ │ └── boober │ │ ├── controller │ │ ├── NoSuchResourceException.kt │ │ ├── v1 │ │ │ ├── AuroraConfigNamesControllerV1.kt │ │ │ ├── RequestHelper.kt │ │ │ └── ClientConfigControllerV1.kt │ │ ├── security │ │ │ └── SpringSecurityThreadContextElement.kt │ │ └── internal │ │ │ └── responses.kt │ │ ├── model │ │ ├── PreconditionFailureException.kt │ │ ├── AuroraVersion.kt │ │ ├── Paths.kt │ │ ├── AuroraDeployCommand.kt │ │ ├── AuroraConfigException.kt │ │ ├── PortNumbers.kt │ │ ├── AuroraVersioningException.kt │ │ ├── AuroraContextCommand.kt │ │ └── openshift │ │ │ └── ImageStreamImport.kt │ │ ├── service │ │ ├── openshift │ │ │ ├── token │ │ │ │ ├── TokenProvider.kt │ │ │ │ └── UserDetailsTokenProvider.kt │ │ │ └── OpenShiftRestTemplateWrapper.kt │ │ ├── resourceprovisioning │ │ │ └── SgoaWithCredentials.kt │ │ ├── UserDetailsProvider.kt │ │ └── IdService.kt │ │ ├── utils │ │ ├── BooleanUtils.kt │ │ ├── Instants.kt │ │ ├── UUIDGenerator.kt │ │ ├── ImageStreamUtils.kt │ │ └── RouteUtils.kt │ │ ├── Main.kt │ │ ├── AuroraRestTemplateTagsProvider.kt │ │ └── feature │ │ └── JavaDeployFeature.kt │ ├── dist │ └── metadata │ │ └── openshift.json │ └── resources │ ├── banner.txt │ └── templates │ └── jenkins-build-config.json.vm ├── settings.gradle ├── gradle.properties ├── docs └── images │ ├── boober.png │ └── boober-deploy.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── dev.sh ├── .gitignore └── Jenkinsfile /src/test/resources/samples/config/utv/pv.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = artifactId 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/ah.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/web.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/easy.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/job.json: -------------------------------------------------------------------------------- 1 | {} 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/simple.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/whoami.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/include/simple.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/template.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /src/main/http/get_clientconfig.http: -------------------------------------------------------------------------------- 1 | GET {{apiUrl}}/v1/clientconfig 2 | 3 | ### -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster": "utv" 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/ad.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/include/include.json: -------------------------------------------------------------------------------- 1 | { 2 | "s3": false 3 | } 4 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=local-SNAPSHOT 2 | groupId=no.skatteetaten.aurora 3 | artifactId=boober -------------------------------------------------------------------------------- /src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.testinstance.lifecycle.default=per_class -------------------------------------------------------------------------------- /docs/images/boober.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/docs/images/boober.png -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/complex.json: -------------------------------------------------------------------------------- 1 | { 2 | "envFile": "about-alternate.json" 3 | } 4 | -------------------------------------------------------------------------------- /docs/images/boober-deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/docs/images/boober-deploy.png -------------------------------------------------------------------------------- /src/main/http/http-client.env.json: -------------------------------------------------------------------------------- 1 | { 2 | "development": { 3 | "apiUrl": "http://localhost:8080" 4 | } 5 | } -------------------------------------------------------------------------------- /src/main/http/inspect.http: -------------------------------------------------------------------------------- 1 | GET {{apiUrl}}/v1/apply-result/paas/f28ed8e 2 | Authorization: Bearer {{token}} 3 | 4 | ### -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/http/deploy_history.http: -------------------------------------------------------------------------------- 1 | GET {{apiUrl}}}/v1/apply-result/paas/ 2 | Authorization: Bearer {{token}}} 3 | 4 | ### -------------------------------------------------------------------------------- /src/main/http/get_auroradeployspec.http: -------------------------------------------------------------------------------- 1 | GET {{apiUrl}}//v1/auroradeployspec/aup/utv04/boober 2 | Authorization:Bearer {{token}} 3 | 4 | ### -------------------------------------------------------------------------------- /src/main/http/get_auroraconfig_file.http: -------------------------------------------------------------------------------- 1 | GET {{apiUrl}}/v1/auroraconfig/paas/verify-github-users/about.json 2 | Authorization:Bearer {{token}} 3 | 4 | ### -------------------------------------------------------------------------------- /src/test/resources/samples/config/include/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "includeEnvFile": "utv/about-alternate.json", 3 | "globalFile": "about-alternative1.json" 4 | } 5 | -------------------------------------------------------------------------------- /src/main/http/validate_auroraconfig_remote.http: -------------------------------------------------------------------------------- 1 | PUT {{apiUrl}}/v1/auroraconfig/aup/validate?mergeWithRemoteConfig=true&reference=m96405 2 | Authorization:Bearer {{token}} 3 | 4 | ### -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/easy.json: -------------------------------------------------------------------------------- 1 | { 2 | "baseFile": "simple.json", 3 | "database": { 4 | "easy": { 5 | "applicationLabel": "simple" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/fionaResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "accessKey": "accesskey", 3 | "secretKey": "some-key", 4 | "host": "http://fiona" 5 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/resourceprovisioning/DatabaseSchemaProvisionerTest/schema_empty_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "OK", 3 | "totalCount": 0, 4 | "items": [] 5 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/whoami/projectrequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/NoSuchResourceException.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller 2 | 3 | class NoSuchResourceException(message: String) : Exception(message) 4 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/pv/projectrequest-paas-utv.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/template/projectrequest-paas-utv.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "ProjectRequest", 4 | "metadata": { 5 | "name": "paas-utv" 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/StsFeatureTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/feature/StsFeatureTest/keystore.jks -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/PreconditionFailureException.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | open class PreconditionFailureException(message: String) : RuntimeException(message) 4 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/openshift/token/TokenProvider.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service.openshift.token 2 | 3 | interface TokenProvider { 4 | fun getToken(): String 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/keystore.jks -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/StsRenewFacadeTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/facade/StsRenewFacadeTest/keystore.jks -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/CertificateFeatureTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/feature/CertificateFeatureTest/keystore.jks -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/whoami/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/pv/namespace-paas-utv.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/template/namespace-paas-utv.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas" 7 | }, 8 | "name": "paas-utv" 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftObjectResourceGeneratorTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftObjectResourceGeneratorTest/keystore.jks -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/resourceprovisioning/StsProvisionerTest/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skatteetaten/boober/HEAD/src/test/resources/no/skatteetaten/aurora/boober/unit/resourceprovisioning/StsProvisionerTest/keystore.jks -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://nexus.sits.no/repository/gradle-distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/main/http/get_vault_file.http: -------------------------------------------------------------------------------- 1 | #GET {{apiUrl}}/v1/vault/paas/secret/foobar.prop 2 | #GET {{apiUrl}}/v1/vault/paas/flotus/yo.json 3 | GET {{apiUrl}}/v1/vault/paas/flotus/potus.txt 4 | #GET {{apiUrl}}/v1/vault/paas/flotus/potus 5 | Authorization:Bearer {{token}} 6 | 7 | ### -------------------------------------------------------------------------------- /src/test/resources/samples/config/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "v1", 3 | "permissions": { 4 | "admin": "APP_PaaS_drift APP_PaaS_utv" 5 | }, 6 | "affiliation": "paas", 7 | "segment": "aurora", 8 | "type": "deploy", 9 | "cluster": "utv" 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas", 7 | "removeAfter": "86400" 8 | }, 9 | "name": "paas-utv" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/about-alternative2.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "v1", 3 | "permissions": { 4 | "admin": "APP_PaaS_drift APP_PaaS_utv" 5 | }, 6 | "affiliation": "paas", 7 | "segment": "aurora", 8 | "cluster": "utv", 9 | "type": "deploy" 10 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template", 3 | "version": "1", 4 | "type": "template", 5 | "template": "atomhopper", 6 | "releaseTo": "something", 7 | "parameters": { 8 | "FEED_NAME": "test", 9 | "DB_NAME": "test" 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/AuroraVersion.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | object AuroraVersion { 4 | 5 | fun isFullAuroraVersion(tag: String): Boolean { 6 | return Regex("^.*-b(.*)-([a-z]*)-(.*)$").matches(tag) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/utils/BooleanUtils.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | fun Boolean.whenTrue(fn: () -> T?): T? = this.takeIf { this }?.let { fn() } 4 | fun Boolean.whenFalse(fn: () -> T?): T? = this.takeUnless { this }?.let { fn() } 5 | -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/about-alternative1.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "v1", 3 | "permissions": { 4 | "admin": "APP_PaaS_drift APP_PaaS_utv" 5 | }, 6 | "affiliation": "paas", 7 | "segment": "aurora", 8 | "cluster": "utv", 9 | "type": "development" 10 | } 11 | -------------------------------------------------------------------------------- /src/main/http/post_reencrypt_vaultcollection.http: -------------------------------------------------------------------------------- 1 | POST {{apiUrl}}/v1/vault/paas/ 2 | Authorization: Bearer {{token}} 3 | Content-Type: application/json 4 | 5 | { 6 | "operationName": "reencrypt", 7 | "parameters": { 8 | "encryptionKey": "komogsyngensang" 9 | } 10 | } 11 | 12 | ### -------------------------------------------------------------------------------- /src/main/http/deploy.http: -------------------------------------------------------------------------------- 1 | PUT {{apiUrl}}/v1/apply/paas 2 | Authorization: Bearer {{token}} 3 | Content-Type: application/json 4 | 5 | { 6 | "applicationDeploymentRefs": [ 7 | { 8 | "environment": "", 9 | "application": "referanse-kotlin" 10 | } 11 | ] 12 | } 13 | 14 | ### -------------------------------------------------------------------------------- /src/main/http/put_auroraconfig_file.http: -------------------------------------------------------------------------------- 1 | PUT {{apiUrl}}/v1/auroraconfig/paas/verify-github-users/about.json 2 | Authorization: Bearer {{token}} 3 | Content-Type: application/json 4 | If-Match: "ae584afdfdebe2dae1e87c506aa2c200" 5 | 6 | { 7 | "content": "{\"cluster\":\"utv\"}" 8 | } 9 | 10 | ### -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/resourceprovisioning/DatabaseSchemaProvisionerTest/schema_fd59dba9-7d67-4ea2-bb98-081a5df8c387_not_found.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "Failed", 3 | "totalCount": 1, 4 | "items": [ 5 | "No such schema fd59dba9-7d67-4ea2-bb98-081a5df8c387" 6 | ] 7 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/pv.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pv", 3 | "type": "template", 4 | "template": "aurora-postgres-ocp4-pv", 5 | "version": "13", 6 | "parameters": { 7 | "NAME": "postgres", 8 | "POSTGRESQL_USER": "postgres", 9 | "POSTGRESQL_PASSWORD": "postgres" 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/http/put_vault_file.http: -------------------------------------------------------------------------------- 1 | PUT {{apiUrl}}/v1/vault/paas/secret/foobar.prop 2 | Authorization: Bearer {{token}} 3 | Content-Type: application/json 4 | If-Match: "dd4843dbd7f8672280db56c527f352d3" 5 | 6 | { 7 | "contents": "RGV0dGUgZXIgZW4gdGVrc3RmaWwgc29tIGVyIGJhc2U2NCBlbmNvZGVk" 8 | } 9 | 10 | ### -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/namespace-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "paas", 7 | "removeAfter": "86400" 8 | }, 9 | "name": "paas-utv" 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/http/post_renew_cert.http: -------------------------------------------------------------------------------- 1 | POST {{apiUrl}}/v1/sts 2 | Authorization: Bearer {{token}} 3 | Content-Type: application/json 4 | 5 | { 6 | "name": "referanse", 7 | "commonName": "no.skatteetaten.aurora.openshift.referanse", 8 | "namespace": "paas-sts", 9 | "affiliation": "paas" 10 | } 11 | 12 | ### -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/about-alternate.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster": "utv", 3 | "permissions": { 4 | "edit": "APP_PaaS_edit", 5 | "view": "APP_PaaS_view" 6 | }, 7 | "env": { 8 | "ttl": "1d" 9 | }, 10 | "databaseDefaults": { 11 | "generate": false, 12 | "ignoreMissingSchema": true 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/utils/GitServiceHelper.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import org.eclipse.jgit.api.Git 4 | import java.io.File 5 | 6 | fun recreateRepo(folder: File): Git { 7 | recreateFolder(folder) 8 | return Git.init().setDirectory(folder).setBare(true).call() 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/web.json: -------------------------------------------------------------------------------- 1 | { 2 | "applicationPlatform": "web", 3 | "groupId": "org.test", 4 | "version": "develop-SNAPSHOT", 5 | "type": "development", 6 | "route": true, 7 | "config": { 8 | "foo2": "baz" 9 | }, 10 | "webseal": { 11 | "strict": false 12 | }, 13 | "toxiproxy": true 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/HerkimerVaultFeatureTest/secret-fus.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "v1", 3 | "kind" : "Secret", 4 | "metadata" : { 5 | "name" : "simple-fus-oracle-credentials", 6 | "namespace" : "paas-utv" 7 | }, 8 | "data" : { 9 | "foo" : "YmF6", 10 | "bar" : "Zm9v" 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/TemplateFeatureTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "to": { 10 | "kind": "Service", 11 | "name": "simple" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/HerkimerVaultFeatureTest/secret-pros.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "v1", 3 | "kind" : "Secret", 4 | "metadata" : { 5 | "name" : "simple-pros-postgres-credentials", 6 | "namespace" : "paas-utv" 7 | }, 8 | "data" : { 9 | "foo" : "YmF6", 10 | "bar" : "Zm9v" 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/HerkimerVaultFeatureTest/secret-ski.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "v1", 3 | "kind" : "Secret", 4 | "metadata" : { 5 | "name" : "simple-ski-postgres-credentials", 6 | "namespace" : "paas-utv" 7 | }, 8 | "data" : { 9 | "foo" : "YmFy", 10 | "bar" : "YmF6" 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/LocalTemplateFeatureTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "to": { 10 | "kind": "Service", 11 | "name": "simple" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/whoami.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "groupId": "org.test", 4 | "type": "deploy", 5 | "deployState": "deployment", 6 | "database": true, 7 | "notification": { 8 | "mattermost": { 9 | "test100": { 10 | "enabled": true 11 | } 12 | } 13 | }, 14 | "toxiproxy": true 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "groupId": "org.test", 4 | "databaseDefaults": { 5 | "tryReuse": true 6 | }, 7 | "database": true, 8 | "s3Defaults": { 9 | "bucketName": "mybucket", 10 | "objectArea": "default" 11 | }, 12 | "s3": true, 13 | "sts": true, 14 | "route": true 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/ah.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "localTemplate", 3 | "templateFile": "templates/atomhopper.json", 4 | "database": true, 5 | "version": "1.3.4", 6 | "parameters": { 7 | "FEED_NAME": "feed", 8 | "DOMAIN_NAME": "localhost", 9 | "DB_NAME": "feed" 10 | }, 11 | "config": { 12 | "FOO": "bar" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/resourceprovisioning/SgoaWithCredentials.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service.resourceprovisioning 2 | 3 | import no.skatteetaten.aurora.boober.model.openshift.StorageGridObjectArea 4 | 5 | data class SgoaWithCredentials(val sgoas: List, val credentials: List) 6 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/aurora-cname-simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "test.foo", 10 | "cname": "simple-paas-utv", 11 | "ttl": 300 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/aurora-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "test.foo", 10 | "cname": "simple-specific-cname", 11 | "ttl": 300 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/Paths.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | object Paths { 4 | 5 | const val basePath = "/u01" 6 | const val logPath = "$basePath/logs" 7 | const val binPath = "$basePath/bin" 8 | const val secretsPath = "$basePath/secrets/app" 9 | const val configPath = "$basePath/config" 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/utils/Instants.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import java.time.Instant 4 | 5 | object Instants { 6 | 7 | // Don't change this function. Only to be used in tests! 8 | var determineNow: () -> Instant = { Instant.now() } 9 | 10 | val now: Instant 11 | get() = determineNow() 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/response_version.json: -------------------------------------------------------------------------------- 1 | { 2 | "major": "1", 3 | "minor": "18+", 4 | "gitVersion": "v1.18.3+65bd32d", 5 | "gitCommit": "65bd32d", 6 | "gitTreeState": "clean", 7 | "buildDate": "2021-01-27T04:24:26Z", 8 | "goVersion": "go1.13.15", 9 | "compiler": "gc", 10 | "platform": "linux/amd64" 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/aurora-cname-azure.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "azure.foo", 10 | "cname": "simple-paas-utv", 11 | "ttl": 300 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftClientTest/response_version.json: -------------------------------------------------------------------------------- 1 | { 2 | "major": "1", 3 | "minor": "18+", 4 | "gitVersion": "v1.18.3+65bd32d", 5 | "gitCommit": "65bd32d", 6 | "gitTreeState": "clean", 7 | "buildDate": "2021-01-27T04:24:26Z", 8 | "goVersion": "go1.13.15", 9 | "compiler": "gc", 10 | "platform": "linux/amd64" 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/AuroraDeployCommand.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | data class AuroraDeployCommand( 4 | val headerResources: Set, 5 | val resources: Set, 6 | val context: AuroraDeploymentContext, 7 | val deployId: String, 8 | val shouldDeploy: Boolean = true 9 | ) 10 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/FluentbitSidecarFeatureTest/secret.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "name": "simple-hec", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "HEC_TOKEN": "dGVzdF9oZWM=", 10 | "SPLUNK_HOST": "c3BsdW5rLnVybA==", 11 | "SPLUNK_PORT": "ODA4MA==" 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/foo-aurora-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "test.foo", 10 | "cname": "simple-foo-specific-cname", 11 | "ttl": 300 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/simple-foo-aurora-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "cname": "simple-foo-specific-cname", 10 | "host": "test.foo", 11 | "ttl": 150 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/aurora-cname-specific-host.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "test.foo", 10 | "cname": "simple-specific-cname.foo.no", 11 | "ttl": 150 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "labels": { 6 | "removeAfter": "86400", 7 | "network.openshift.io/policy-group": "monitoring" 8 | }, 9 | "annotations": { 10 | "foo": "bar" 11 | }, 12 | "name": "paas-utv" 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/MultipleRoutes/bigip-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "BigIp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "routeName": "simple-bigip", 10 | "konfigtjenesten": { 11 | "service": "simple" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/python.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "applicationPlatform": "python", 4 | "groupId": "org.test", 5 | "databaseDefaults": { 6 | "tryReuse": true 7 | }, 8 | "database": true, 9 | "s3Defaults": { 10 | "bucketName": "mybucket", 11 | "objectArea": "default" 12 | }, 13 | "s3": true, 14 | "sts": true, 15 | "route": true 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/include.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "groupId": "org.test", 4 | "databaseDefaults": { 5 | "tryReuse": true 6 | }, 7 | "database": true, 8 | "s3Defaults": { 9 | "bucketName": "myBucket", 10 | "objectArea": "default" 11 | }, 12 | "s3": true, 13 | "sts": true, 14 | "route": true, 15 | "globalFile": "about-alternative2.json" 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/aurora-cname-azure-specific-host.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureCname", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "azure.foo", 10 | "cname": "simple-specific-cname.foo.no", 11 | "ttl": 100 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftCommandServiceCreateDeleteCommandsTest/response_version.json: -------------------------------------------------------------------------------- 1 | { 2 | "major": "1", 3 | "minor": "18+", 4 | "gitVersion": "v1.18.3+65bd32d", 5 | "gitCommit": "65bd32d", 6 | "gitTreeState": "clean", 7 | "buildDate": "2021-01-27T04:24:26Z", 8 | "goVersion": "go1.13.15", 9 | "compiler": "gc", 10 | "platform": "linux/amd64" 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/utils/UUIDGenerator.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import java.util.UUID 4 | 5 | object UUIDGenerator { 6 | 7 | // Don't change this function. Only to be used in tests! 8 | var generateId: () -> String = { UUID.randomUUID().toString() } 9 | 10 | val deployId: String 11 | get() = generateId().substring(0, 7) 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/not-just-default-aurora-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "test.foo", 10 | "cname": "not-just-default.utv.apps.paas.skead.no", 11 | "ttl": 150 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureNoDbTest/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/MultipleRoutes/bigip-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "BigIp", 4 | "metadata": { 5 | "name": "simple-simple-mock", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "routeName": "simple-simple-mock-bigip", 10 | "konfigtjenesten": { 11 | "service": "simple-mock" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/samples/config/utv/python.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "applicationPlatform": "python", 4 | "groupId": "org.test", 5 | "databaseDefaults": { 6 | "tryReuse": true 7 | }, 8 | "database": true, 9 | "s3Defaults": { 10 | "bucketName": "mybucket", 11 | "objectArea": "default", 12 | "tenant": "paas-utv" 13 | }, 14 | "s3": true, 15 | "sts": true, 16 | "route": true 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureApp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "azureAppFqdn": "tjeneste-foo.amutv.skead.no", 10 | "appName": "simple", 11 | "groups": [], 12 | "noProxy": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JwtToStsConverterSubPartTest/auroraazureapp.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "skatteetaten.no/v1", 3 | "kind" : "AuroraAzureApp", 4 | "metadata" : { 5 | "name" : "simple", 6 | "namespace" : "paas-utv" 7 | }, 8 | "spec" : { 9 | "azureAppFqdn" : "saksmappa.amutv.skead.no", 10 | "appName" : "simple", 11 | "groups" : [ ], 12 | "noProxy" : false 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-app-with-clinger.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureApp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "azureAppFqdn": "tjeneste-foo.amutv.skead.no", 10 | "appName": "simple", 11 | "groups": [], 12 | "noProxy": false 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-app-with-env.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureApp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "azureAppFqdn": "tjeneste-foo-utv.amutv.skead.no", 10 | "appName": "simple", 11 | "groups": [], 12 | "noProxy": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/configmap-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "ConfigMap", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "referanse", 6 | "namespace": "foobar", 7 | "labels": { 8 | "affiliation": "paas", 9 | "app": "referanse", 10 | "updatedBy": "m89870" 11 | } 12 | }, 13 | "data": { 14 | "latest.properties": "foo=bar\nfoo2=baz" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/fqdn-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "foo.bar.baz", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/foo-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-foo.test.foo", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-paas-utv.test.foo", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-app-with-webseal.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureApp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "azureAppFqdn": "tjeneste-foo.amutv.skead.no", 10 | "appName": "simple", 11 | "groups": ["APP_dev","APP_DRIFT"], 12 | "noProxy": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/bar-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple-bar", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-paas-utv.test.foo", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-cname-simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-paas-utv", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-specific-cname", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/configmap.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "ConfigMap", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "referanse", 6 | "namespace": "foobar", 7 | "resourceVersion": "123", 8 | "labels": { 9 | "affiliation": "paas", 10 | "app": "referanse", 11 | "updatedBy": "m89870" 12 | } 13 | }, 14 | "data": { 15 | "latest.properties": "foo=bar\nfoo2=bar" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/utils/ImageStreamUtils.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import io.fabric8.openshift.api.model.ImageStream 4 | 5 | fun ImageStream.findCurrentImageHash(tagName: String): String? = 6 | this.status?.tags?.firstOrNull { it.tag == tagName }?.items?.firstOrNull()?.image 7 | 8 | fun ImageStream.findDockerImageUrl(tagName: String): String? = 9 | this.spec?.tags?.firstOrNull { it.name == tagName }?.from?.name 10 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/foo-route-with-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-foo-specific-cname", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-specific-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-specific-cname.foo.no", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/rolebinding-edit.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "edit", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_edit" 10 | ], 11 | "roleRef": { 12 | "name": "edit" 13 | }, 14 | "subjects": [ 15 | { 16 | "kind": "Group", 17 | "name": "APP_PaaS_edit" 18 | } 19 | ], 20 | "userNames": [ ] 21 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/rolebinding-view.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "view", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_view" 10 | ], 11 | "roleRef": { 12 | "name": "view" 13 | }, 14 | "subjects": [ 15 | { 16 | "kind": "Group", 17 | "name": "APP_PaaS_view" 18 | } 19 | ], 20 | "userNames": [ ] 21 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/path-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-paas-utv.test.foo", 10 | "path": "/foo", 11 | "port": { 12 | "targetPort": "http" 13 | }, 14 | "to": { 15 | "kind": "Service", 16 | "name": "simple" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/Main.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("Main") 2 | 3 | package no.skatteetaten.aurora.boober 4 | 5 | import org.springframework.boot.SpringApplication 6 | import org.springframework.boot.autoconfigure.SpringBootApplication 7 | import org.springframework.cache.annotation.EnableCaching 8 | 9 | @SpringBootApplication 10 | @EnableCaching 11 | class Boober 12 | 13 | fun main(args: Array) { 14 | 15 | SpringApplication.run(Boober::class.java, *args) 16 | } 17 | -------------------------------------------------------------------------------- /dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | error_exit() { 3 | echo "$1" 4 | exit 1 5 | } 6 | 7 | name=$1 8 | oc get bc "$name" &> /dev/null || error_exit "Build Config $1 does not exist" 9 | 10 | ./gradlew build -x test 11 | 12 | leveransepakke=$(find build/distributions -type f -name "*-Leveransepakke.zip") 13 | 14 | echo "Start OpenShift binary build" 15 | oc start-build $name --from-file=$leveransepakke --follow --wait 16 | 17 | which stern &> /dev/null && echo "Tail logs with stern $name" && stern $name 18 | -------------------------------------------------------------------------------- /src/main/http/validate_auroraconfig_illegal_type.http: -------------------------------------------------------------------------------- 1 | PUT {{apiUrl}}/v1/auroraconfig/aurora/validate?resourceValidation=false 2 | Authorization:Bearer {{token}} 3 | ### 4 | PUT {{apiUrl}}/v1/auroraconfig/paas/validate?mergeWithRemoteConfig=true 5 | Authorization:Bearer {{token}} 6 | Content-Type: application/json 7 | 8 | { 9 | "name": "paas", 10 | "files": [ 11 | { 12 | "name": "dbh/referanse.json", 13 | "contents": " { \"type\" : \"foobar\" }" 14 | } 15 | ] 16 | } 17 | 18 | ### -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/openshift/token/UserDetailsTokenProvider.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service.openshift.token 2 | 3 | import no.skatteetaten.aurora.boober.service.UserDetailsProvider 4 | import org.springframework.stereotype.Component 5 | 6 | @Component 7 | class UserDetailsTokenProvider(val userDetailsProvider: UserDetailsProvider) : TokenProvider { 8 | 9 | override fun getToken(): String = userDetailsProvider.getAuthenticatedUser().token 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureApimSubPartTest/aurora-azure-apim.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraApim", 4 | "metadata": { 5 | "name": "simple-super-api-v1", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "apiName": "super-api", 10 | "version": "v1", 11 | "path": "/path/to/api", 12 | "openApiUrl": "https://openapi", 13 | "serviceUrl": "https://service", 14 | "policies": [] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/foo-route-with-not-default-cname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "not-just-default.utv.apps.paas.skead.no", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "to": { 14 | "kind": "Service", 15 | "name": "simple" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureApimSubPartTest/aurora-azure-apim-v2.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraApim", 4 | "metadata": { 5 | "name": "simple-super-api-v2", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "apiName": "super-api", 10 | "version": "v2", 11 | "path": "/path/to/api", 12 | "openApiUrl": "https://openapi2", 13 | "serviceUrl": "https://service2", 14 | "policies": [] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/configWithDatabaseMapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true},{\"name\":\"dbProxy\",\"listen\":\"0.0.0.0:18000\",\"upstream\":\"host:1234\",\"enabled\":true}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/auroracname-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "demo", 7 | "app": "cname-demo" 8 | }, 9 | "name": "cname-demo", 10 | "namespace": "demo-psat-poc" 11 | }, 12 | "spec": { 13 | "cname": "gavel-poc-10.cname-poc10.utv.paas.skead.no", 14 | "host": "apps.utv04.paas.skead.no", 15 | "ttl": 300 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/dist/metadata/openshift.json: -------------------------------------------------------------------------------- 1 | { 2 | "docker": { 3 | "maintainer": "Aurora OpenShift Utvikling ", 4 | "labels": { 5 | "io.k8s.description": "Controller for creating/updating application objects", 6 | "io.openshift.tags": "openshift,springboot,kotlin" 7 | } 8 | }, 9 | "java": { 10 | "mainClass": "no.skatteetaten.aurora.boober.Main", 11 | "jvmOpts": "-Dspring.profiles.active=openshift", 12 | "applicationArgs": "--logging.config=${LOGBACK_FILE}" 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/auroraazurecname-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureCname", 4 | "metadata": { 5 | "labels": { 6 | "affiliation": "demo", 7 | "app": "cname-demo" 8 | }, 9 | "name": "cname-demo", 10 | "namespace": "demo-psat-poc" 11 | }, 12 | "spec": { 13 | "cname": "gavel-poc-10.cname-poc10.utv.paas.skead.no", 14 | "host": "apps.utv04.paas.skead.no", 15 | "ttl": 300 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/AuroraConfigException.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | class AuroraConfigException( 4 | message: String, 5 | val errors: List = listOf() 6 | ) : RuntimeException(message) { 7 | override val message: String? 8 | get() { 9 | val message = super.message 10 | val errorMessages = errors.map { it.message }.joinToString(", ") 11 | return "$message. $errorMessages." 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/samples/config/job.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "cronjob", 3 | "version": "1", 4 | "groupId": "no.skatteetaten.demo", 5 | "config": { 6 | "FOO": "bar" 7 | }, 8 | "serviceAccount": "foo", 9 | "schedule": "0/5 * * * *", 10 | "secretVaults": { 11 | "foo": { 12 | "keys": [ 13 | "BAR", 14 | "FOO" 15 | ], 16 | "keyMappings": { 17 | "BAR": "BAZ" 18 | } 19 | } 20 | }, 21 | "s3": { 22 | "default": { 23 | "bucketName": "mybucket" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/bigip.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "BigIp", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "routeName": "simple-bigip", 10 | "konfigtjenesten": { 11 | "service": "simple", 12 | "apiPaths" : [ "/api/simple/", "/web/simple/" ], 13 | "oauthScopes" : [ "test" ], 14 | "asmPolicy" : "something", 15 | "externalHost" : "localhost" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/annotations-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "foo/baz": "baz", 7 | "foo/bar": "bar" 8 | }, 9 | "name": "simple", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "simple-paas-utv.test.foo", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/tls-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-paas-utv.test.foo", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "tls": { 14 | "insecureEdgeTerminationPolicy": "None", 15 | "termination": "edge" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/foo-tls-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "name": "simple-foo", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "host": "simple-foo.test.foo", 10 | "port": { 11 | "targetPort": "http" 12 | }, 13 | "tls": { 14 | "insecureEdgeTerminationPolicy": "None", 15 | "termination": "edge" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/utils/RouteUtils.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import io.fabric8.openshift.api.model.Route 4 | 5 | fun Route.findErrorMessage(): String? { 6 | val ingress = this.status?.ingress 7 | if (ingress.isNullOrEmpty()) { 8 | return null 9 | } 10 | 11 | val result = ingress.flatMap { it.conditions } 12 | .filter { it.status == "False" } 13 | .map { it.message } 14 | 15 | if (result.isEmpty()) { 16 | return null 17 | } 18 | return result.joinToString(",") 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/users.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "items": [ 4 | { 5 | "apiVersion": "user.openshift.io/v1", 6 | "kind": "User", 7 | "metadata": { 8 | "name": "hero", 9 | "resourceVersion": "351681191", 10 | "selfLink": "/apis/user.openshift.io/v1/users/aurora-boober-test-user", 11 | "uid": "977ac190-bfe0-11e7-af8a-005056833ec1" 12 | } 13 | } 14 | ], 15 | "kind": "List", 16 | "metadata": { 17 | "resourceVersion": "", 18 | "selfLink": "" 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/auroracname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraCname", 4 | "metadata": { 5 | "annotations": { 6 | "judge.sits.no/notified": "true" 7 | }, 8 | "labels": { 9 | "affiliation": "demo", 10 | "app": "cname-demo" 11 | }, 12 | "name": "cname-demo", 13 | "namespace": "demo-psat-poc" 14 | }, 15 | "spec": { 16 | "cname": "gavel-poc-10.cname-poc10.utv.paas.skead.no", 17 | "host": "apps.utv04.paas.skead.no", 18 | "ttl": 300 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/pv/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [ ] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/template/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [ ] 26 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/whoami/rolebinding-admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "authorization.openshift.io/v1", 3 | "kind": "RoleBinding", 4 | "metadata": { 5 | "name": "admin", 6 | "namespace": "paas-utv" 7 | }, 8 | "groupNames": [ 9 | "APP_PaaS_drift", 10 | "APP_PaaS_utv" 11 | ], 12 | "roleRef": { 13 | "name": "admin" 14 | }, 15 | "subjects": [ 16 | { 17 | "kind": "Group", 18 | "name": "APP_PaaS_drift" 19 | }, 20 | { 21 | "kind": "Group", 22 | "name": "APP_PaaS_utv" 23 | } 24 | ], 25 | "userNames": [] 26 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/auroraazurecname.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureCname", 4 | "metadata": { 5 | "annotations": { 6 | "judge.sits.no/notified": "true" 7 | }, 8 | "labels": { 9 | "affiliation": "demo", 10 | "app": "cname-demo" 11 | }, 12 | "name": "cname-demo", 13 | "namespace": "demo-psat-poc" 14 | }, 15 | "spec": { 16 | "cname": "gavel-poc-10.cname-poc10.utv.paas.skead.no", 17 | "host": "apps.utv04.paas.skead.no", 18 | "ttl": 300 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-managed-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "applikasjonsfabrikken": "true", 7 | "azureManaged": "true" 8 | }, 9 | "name": "simple-managed", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "tjeneste-foo.amutv.skead.no", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/pvc-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "PersistentVolumeClaim", 4 | "metadata": { 5 | "name": "test", 6 | "namespace": "utv" 7 | }, 8 | "spec": { 9 | "accessModes": [ 10 | "ReadWriteMany" 11 | ], 12 | "resources": { 13 | "requests": { 14 | "storage": "512Mi" 15 | } 16 | } 17 | }, 18 | "status": { 19 | "accessModes": [ 20 | "ReadWriteMany" 21 | ], 22 | "capacity": { 23 | "storage": "15Gi" 24 | }, 25 | "phase": "Bound" 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/UserDetailsProvider.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service 2 | 3 | import no.skatteetaten.aurora.boober.controller.security.User 4 | import org.springframework.security.core.context.SecurityContextHolder 5 | import org.springframework.stereotype.Component 6 | 7 | @Component 8 | class UserDetailsProvider { 9 | 10 | fun getAuthenticatedUser(): User { 11 | 12 | val authentication = SecurityContextHolder.getContext().authentication 13 | val user: User = authentication.principal as User 14 | return user 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "haproxy.router.openshift.io/timeout": "30s", 7 | "bigipRoute": "true" 8 | }, 9 | "name": "simple-bigip", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "1d5da0b933ade4bfd6773579b9fb5cc2afb57378.test.foo", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/configWithNamedDatabaseProxiesMapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true},{\"name\":\"proxy1\",\"listen\":\"0.0.0.0:18000\",\"upstream\":\"host:1234\",\"enabled\":true},{\"name\":\"proxy2\",\"listen\":\"0.0.0.0:18001\",\"upstream\":\"host:1234\",\"enabled\":true}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-managed-route-with-env.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "applikasjonsfabrikken": "true", 7 | "azureManaged": "true" 8 | }, 9 | "name": "simple-managed", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "tjeneste-foo-utv.amutv.skead.no", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/imagestreamimport.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStreamImport", 4 | "metadata": { 5 | "name": "easy", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "images": [ 10 | { 11 | "from": { 12 | "kind": "DockerImage", 13 | "name": "docker.registry:5000/org_test/simple:1" 14 | }, 15 | "importPolicy": { 16 | "scheduled": true 17 | }, 18 | "to": { 19 | "name": "default" 20 | } 21 | } 22 | ], 23 | "import": true 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/MultipleRoutes/route-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "haproxy.router.openshift.io/timeout": "30s", 7 | "bigipRoute": "true" 8 | }, 9 | "name": "simple-bigip", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "1d5da0b933ade4bfd6773579b9fb5cc2afb57378.test.foo", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/pvc.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "PersistentVolumeClaim", 4 | "metadata": { 5 | "name": "test", 6 | "namespace": "utv" 7 | }, 8 | "spec": { 9 | "accessModes": [ 10 | "ReadWriteMany" 11 | ], 12 | "resources": { 13 | "requests": { 14 | "storage": "512Mi" 15 | } 16 | }, 17 | "volumeName": "pv086" 18 | }, 19 | "status": { 20 | "accessModes": [ 21 | "ReadWriteMany" 22 | ], 23 | "capacity": { 24 | "storage": "15Gi" 25 | }, 26 | "phase": "Bound" 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/MultipleRoutes/route-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "haproxy.router.openshift.io/timeout": "30s", 7 | "bigipRoute": "true" 8 | }, 9 | "name": "simple-simple-mock-bigip", 10 | "namespace": "paas-utv" 11 | }, 12 | "spec": { 13 | "host": "bigip-simple-paas-utv-simple-mock.test.foo", 14 | "port": { 15 | "targetPort": "http" 16 | }, 17 | "to": { 18 | "kind": "Service", 19 | "name": "simple" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-azure.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "type": "azure" 7 | }, 8 | "name": "simple-azure", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "host": "simple-paas-utv.test.foo", 13 | "port": { 14 | "targetPort": "http" 15 | }, 16 | "tls": { 17 | "insecureEdgeTerminationPolicy": "None", 18 | "termination": "edge" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-azure-cname-simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "type": "azure" 7 | }, 8 | "name": "simple-azure", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "host": "simple-paas-utv", 13 | "port": { 14 | "targetPort": "http" 15 | }, 16 | "tls": { 17 | "insecureEdgeTerminationPolicy": "None", 18 | "termination": "edge" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/TemplateFeatureTest/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "dockerImageRepository": "docker-registry.aurora.sits.no:5000/aurora/atomhopper", 10 | "tags": [ 11 | { 12 | "from": { 13 | "kind": "DockerImage", 14 | "name": "docker-registry.aurora.sits.no:5000/aurora/atomhopper:0" 15 | }, 16 | "importPolicy": { 17 | "scheduled": true 18 | }, 19 | "name": "default" 20 | } 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/WebSealFeatureTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "" 8 | }, 9 | "labels": { 10 | "type": "webseal" 11 | }, 12 | "name": "simple-webseal", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "simple-paas-utv.test.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/LocalTemplateFeatureTest/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "dockerImageRepository": "docker-registry.aurora.sits.no:5000/aurora/atomhopper", 10 | "tags": [ 11 | { 12 | "from": { 13 | "kind": "DockerImage", 14 | "name": "docker-registry.aurora.sits.no:5000/aurora/atomhopper:0" 15 | }, 16 | "importPolicy": { 17 | "scheduled": true 18 | }, 19 | "name": "default" 20 | } 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/RouteFeatureTest/route-with-azure-specific-host.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "type": "azure" 7 | }, 8 | "name": "simple-azure", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "host": "simple-specific-cname.foo.no", 13 | "port": { 14 | "targetPort": "http" 15 | }, 16 | "tls": { 17 | "insecureEdgeTerminationPolicy": "None", 18 | "termination": "edge" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/v1/AuroraConfigNamesControllerV1.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.v1 2 | 3 | import no.skatteetaten.aurora.boober.controller.internal.Response 4 | import no.skatteetaten.aurora.boober.facade.AuroraConfigFacade 5 | import org.springframework.web.bind.annotation.GetMapping 6 | import org.springframework.web.bind.annotation.RestController 7 | 8 | @RestController 9 | class AuroraConfigNamesControllerV1( 10 | private val facade: AuroraConfigFacade 11 | ) { 12 | 13 | @GetMapping("/v1/auroraconfignames") 14 | fun auroraConfigs() = Response(items = facade.findAllAuroraConfigNames()) 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/webseal-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "" 8 | }, 9 | "labels": { 10 | "type": "webseal" 11 | }, 12 | "name": "simple-webseal", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "simple-paas-utv.test.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JwtToStsConverterSubPartTest/webseal-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "" 8 | }, 9 | "labels": { 10 | "type": "webseal" 11 | }, 12 | "name": "simple-webseal", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "simple-paas-utv.test.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/WebSealFeatureTest/route-custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "foo,bar,baz" 8 | }, 9 | "labels": { 10 | "type": "webseal" 11 | }, 12 | "name": "simple-webseal", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "simple2-paas-utv.test.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/configWithMultipleDatabasesMapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true},{\"name\":\"database_db651af4-5fec-4875-bdef-0651b9b72691\",\"listen\":\"0.0.0.0:18000\",\"upstream\":\"host:1234\",\"enabled\":true},{\"name\":\"database_5b5c2057-c8de-45e8-b41a-e897cf3800c9\",\"listen\":\"0.0.0.0:18001\",\"upstream\":\"host:1234\",\"enabled\":true}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/aurora-azure-route-timeout.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations":{ 6 | "haproxy.router.openshift.io/timeout":"50s" 7 | }, 8 | "labels": { 9 | "applikasjonsfabrikken": "true", 10 | "azureManaged": "true" 11 | }, 12 | "name": "simple-managed", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "tjeneste-foo.amutv.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureAppSubPartTest/webseal-saksmappe-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "APP_dev,APP_drift" 8 | }, 9 | "labels": { 10 | "type": "webseal" 11 | }, 12 | "name": "simple-webseal", 13 | "namespace": "paas-utv" 14 | }, 15 | "spec": { 16 | "host": "tjeneste-foo.test.skead.no", 17 | "port": { 18 | "targetPort": "http" 19 | }, 20 | "to": { 21 | "kind": "Service", 22 | "name": "simple" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/WebDeployFeatureTest/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "releasedVersion": "1" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "docker.registry/org_test/simple", 13 | "tags": [ 14 | { 15 | "from": { 16 | "kind": "DockerImage", 17 | "name": "docker.registry/org_test/simple:1" 18 | }, 19 | "importPolicy": { 20 | "scheduled": true 21 | }, 22 | "name": "default" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JavaDeployFeatureTest/is-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "releasedVersion": "1" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "docker.registry/org_test/simple", 13 | "tags": [ 14 | { 15 | "from": { 16 | "kind": "DockerImage", 17 | "name": "docker.registry/org_test/simple:1" 18 | }, 19 | "importPolicy": { 20 | "scheduled": true 21 | }, 22 | "name": "default" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/PythonDeployFeatureTest/is-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "releasedVersion": "1" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "docker.registry/org_test/simple", 13 | "tags": [ 14 | { 15 | "from": { 16 | "kind": "DockerImage", 17 | "name": "docker.registry/org_test/simple:1" 18 | }, 19 | "importPolicy": { 20 | "scheduled": true 21 | }, 22 | "name": "default" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/PythonDeployFeatureTest/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "releasedVersion": "1" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "docker.registry/org_test/simple", 13 | "tags": [ 14 | { 15 | "from": { 16 | "kind": "DockerImage", 17 | "name": "docker.registry/org_test/simple:1" 18 | }, 19 | "importPolicy": { 20 | "scheduled": true 21 | }, 22 | "name": "default" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/utils/CollectionUtilsTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.isEqualTo 5 | import org.junit.jupiter.api.Test 6 | 7 | internal class CollectionUtilsTest { 8 | 9 | @Test 10 | fun `countSetValues should return the number of values that are not null, false or blank`() { 11 | assertThat(countSetValues("", " ", null, false)).isEqualTo(0) 12 | assertThat(countSetValues("", "a", " ", null, false)).isEqualTo(1) 13 | assertThat(countSetValues("", "a", " ", null, true, false)).isEqualTo(2) 14 | assertThat(countSetValues("a", true)).isEqualTo(2) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/PortNumbers.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | object PortNumbers { 4 | 5 | const val HTTP_PORT = 80 6 | const val HTTPS_PORT = 443 7 | const val INTERNAL_HTTP_PORT = 8080 8 | const val INTERNAL_ADMIN_PORT = 8081 9 | const val EXTRA_APPLICATION_PORT = 8082 10 | const val TOXIPROXY_HTTP_PORT = 8090 11 | const val CLINGER_PROXY_SERVER_PORT = 8100 12 | const val CLINGER_MANAGEMENT_SERVER_PORT = 8101 13 | const val TOXIPROXY_ADMIN_PORT = 8474 14 | const val JOLOKIA_HTTP_PORT = 8778 15 | const val NODE_PORT = 9090 16 | const val DEFAULT_POSTGRES_PORT = 5432 17 | const val DEFAULT_ORACLE_PORT = 1521 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/configWithServerAndPortMapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true},{\"name\":\"proxyName1\",\"listen\":\"0.0.0.0:18000\",\"upstream\":\"test1.test:123\",\"enabled\":true},{\"name\":\"proxyName2\",\"listen\":\"0.0.0.0:18001\",\"upstream\":\"test2.test:124\",\"enabled\":true},{\"name\":\"proxyName3\",\"listen\":\"0.0.0.0:18002\",\"upstream\":\"test3.test:125\",\"enabled\":false}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/WebSealFeatureTest/route-timeout.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "foo,bar,baz", 8 | "haproxy.router.openshift.io/timeout": "10s" 9 | }, 10 | "labels": { 11 | "type": "webseal" 12 | }, 13 | "name": "simple-webseal", 14 | "namespace": "paas-utv" 15 | }, 16 | "spec": { 17 | "host": "simple2-paas-utv.test.skead.no", 18 | "port": { 19 | "targetPort": "http" 20 | }, 21 | "to": { 22 | "kind": "Service", 23 | "name": "simple" 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JobFeatureTest/job.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "batch/v1", 3 | "kind": "Job", 4 | "metadata": { 5 | "generateName": "simple-", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "completions": 1, 10 | "parallelism": 1, 11 | "template": { 12 | "metadata": { 13 | "generateName": "simple" 14 | }, 15 | "spec": { 16 | "containers": [ 17 | { 18 | "image": "docker.registry/aurora/turbo@sha:1234", 19 | "imagePullPolicy": "Always", 20 | "name": "simple" 21 | } 22 | ], 23 | "dnsPolicy": "ClusterFirst", 24 | "restartPolicy": "Never" 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/TemplateFeatureTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/path": "/metrics", 7 | "prometheus.io/scheme": "http", 8 | "prometheus.io/scrape": "false" 9 | }, 10 | "name": "simple", 11 | "namespace": "paas-utv" 12 | }, 13 | "spec": { 14 | "ports": [ 15 | { 16 | "name": "http", 17 | "nodePort": 0, 18 | "port": 80, 19 | "protocol": "TCP", 20 | "targetPort": 8080 21 | } 22 | ], 23 | "selector": { 24 | "name": "simple" 25 | }, 26 | "sessionAffinity": "None", 27 | "type": "ClusterIP", 28 | "portalIP": "" 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/LocalTemplateFeatureTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/path": "/metrics", 7 | "prometheus.io/scheme": "http", 8 | "prometheus.io/scrape": "false" 9 | }, 10 | "name": "simple", 11 | "namespace": "paas-utv" 12 | }, 13 | "spec": { 14 | "ports": [ 15 | { 16 | "name": "http", 17 | "nodePort": 0, 18 | "port": 80, 19 | "protocol": "TCP", 20 | "targetPort": 8080 21 | } 22 | ], 23 | "selector": { 24 | "name": "simple" 25 | }, 26 | "sessionAffinity": "None", 27 | "type": "ClusterIP", 28 | "portalIP": "" 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/AuroraAzureApimSubPartTest/aurora-azure-apim-with-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraApim", 4 | "metadata": { 5 | "name": "simple-super-api-v1", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "apiName": "super-api", 10 | "version": "v1", 11 | "path": "/path/to/api", 12 | "openApiUrl": "https://openapi", 13 | "serviceUrl": "https://service", 14 | "policies": [ 15 | { 16 | "name": "policy1", 17 | "parameters": {} 18 | }, 19 | { 20 | "name": "policy2", 21 | "parameters": { 22 | "param1": "value1", 23 | "param2": "value2" 24 | } 25 | } 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JavaDeployFeatureTest/service-no-prometheus.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/scrape": "false" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "ports": [ 13 | { 14 | "name": "http", 15 | "port": 80, 16 | "protocol": "TCP", 17 | "targetPort": 8080 18 | }, 19 | { 20 | "name": "extra", 21 | "port": 8082, 22 | "protocol": "TCP", 23 | "targetPort": 8082 24 | } 25 | ], 26 | "selector": { 27 | "name": "simple" 28 | }, 29 | "sessionAffinity": "None", 30 | "type": "ClusterIP" 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/v1/RequestHelper.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.v1 2 | 3 | import org.springframework.web.context.request.RequestContextHolder 4 | import org.springframework.web.context.request.ServletRequestAttributes 5 | 6 | fun clearQuotes(str: String?) = str?.replace("\"", "") 7 | 8 | fun getRefNameFromRequest(): String { 9 | 10 | val request = (RequestContextHolder.getRequestAttributes() as ServletRequestAttributes).request 11 | 12 | val queryParam: String? = request.getParameter("reference") 13 | 14 | val header: String? = request.getHeader("Ref-Name") 15 | 16 | val ref = queryParam ?: header 17 | 18 | if (ref.isNullOrBlank()) { 19 | return "master" 20 | } 21 | 22 | return ref 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/PythonDeployFeatureTest/service-no-prometheus.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/scrape": "false" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "ports": [ 13 | { 14 | "name": "http", 15 | "port": 80, 16 | "protocol": "TCP", 17 | "targetPort": 8080 18 | }, 19 | { 20 | "name": "extra", 21 | "port": 8082, 22 | "protocol": "TCP", 23 | "targetPort": 8082 24 | } 25 | ], 26 | "selector": { 27 | "name": "simple" 28 | }, 29 | "sessionAffinity": "None", 30 | "type": "ClusterIP" 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/AuroraVersioningException.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | data class VersioningError( 4 | val auroraConfigName: String, 5 | val fileName: String, 6 | val currentHash: String, 7 | val providedHash: String? = null 8 | ) 9 | 10 | class AuroraVersioningException(auroraConfig: AuroraConfig, currentFile: AuroraConfigFile, previousVersion: String?) : 11 | PreconditionFailureException("The provided version of the current file ($previousVersion) in AuroraConfig ${auroraConfig.name} is not correct (${currentFile.version})") { 12 | val errors: List 13 | 14 | init { 15 | errors = listOf(VersioningError(auroraConfig.name, currentFile.name, currentFile.version, previousVersion)) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | _______ ,-----. ,-----. _______ .-''-. .-------. 3 | \ ____ \ .' .-, '. .' .-, '. \ ____ \ .'_ _ \ | _ _ \ 4 | | | \ | / ,-.| \ _ \ / ,-.| \ _ \ | | \ | / ( ` ) '| ( ' ) | 5 | | |____/ / ; \ '_ / | :; \ '_ / | :| |____/ / . (_ o _) ||(_ o _) / 6 | | _ _ '. | _`,/ \ _/ || _`,/ \ _/ || _ _ '. | (_,_)___|| (_,_).' __ 7 | | ( ' ) \: ( '\_/ \ ;: ( '\_/ \ ;| ( ' ) \' \ .---.| |\ \ | | 8 | | (_{;}_) | \ `"/ \ ) / \ `"/ \ ) / | (_{;}_) | \ `-' /| | \ `' / 9 | | (_,_) / '. \_/``".' '. \_/``".' | (_,_) / \ / | | \ / 10 | /_______.' '-----' '-----' /_______.' `'-..-' ''-' `'-' 11 | 12 | 13 | Version: ${application.version}, Spring boot ${spring-boot.version} 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/feature/WebsealFeatureDisabledTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import assertk.assertThat 4 | import no.skatteetaten.aurora.boober.utils.AbstractFeatureTest 5 | import no.skatteetaten.aurora.boober.utils.singleApplicationError 6 | import org.junit.jupiter.api.Test 7 | 8 | class WebsealFeatureDisabledTest : AbstractFeatureTest() { 9 | override val feature: Feature 10 | get() = WebsealDisabledFeature() 11 | 12 | @Test 13 | fun `get error if trying to create webseal opening when feature disabled`() { 14 | 15 | assertThat { 16 | generateResources( 17 | """{ 18 | "webseal" : true 19 | }""" 20 | ) 21 | }.singleApplicationError("Webseal is not supported") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JavaDeployFeatureTest/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "releasedVersion": "1001_FIX_STUPID_STUFF_20190402.113042-26-b1.18.1-wingnut8-1.3.0" 7 | }, 8 | "name": "simple", 9 | "namespace": "paas-utv" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "docker.registry/org_test/simple", 13 | "tags": [ 14 | { 15 | "from": { 16 | "kind": "DockerImage", 17 | "name": "docker.registry/org_test/simple:SNAPSHOT-feature_FOO_1001_FIX_STUPID_STUFF_20190402.113042-26-b1.18.1-wingnut8-1.3.0" 18 | }, 19 | "importPolicy": { 20 | "scheduled": true 21 | }, 22 | "name": "default" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/openshift/OpenShiftRestTemplateWrapper.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service.openshift 2 | 3 | import no.skatteetaten.aurora.boober.ServiceTypes 4 | import no.skatteetaten.aurora.boober.TargetService 5 | import no.skatteetaten.aurora.boober.utils.RetryingRestTemplateWrapper 6 | import org.springframework.beans.factory.annotation.Value 7 | import org.springframework.stereotype.Component 8 | import org.springframework.web.client.RestTemplate 9 | 10 | @Component 11 | class OpenShiftRestTemplateWrapper( 12 | @TargetService(ServiceTypes.OPENSHIFT) restTemplate: RestTemplate, 13 | @Value("\${integrations.openshift.retries}") retries: Int = 3, 14 | @Value("\${integrations.openshift.backoff}") backoff: Long = 500 15 | ) : RetryingRestTemplateWrapper(restTemplate, retries, backoff) 16 | -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/feature/StsFeatureDisabledTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import assertk.assertThat 4 | import no.skatteetaten.aurora.boober.utils.AbstractFeatureTest 5 | import no.skatteetaten.aurora.boober.utils.singleApplicationError 6 | import org.junit.jupiter.api.Test 7 | 8 | class StsFeatureDisabledTest : AbstractFeatureTest() { 9 | override val feature: Feature 10 | get() = StsDisabledFeature() 11 | 12 | @Test 13 | fun `get error if trying to create certificate when feature disabled`() { 14 | 15 | assertThat { 16 | generateResources( 17 | """{ 18 | "sts" : true, 19 | "groupId" : "org.test" 20 | }""" 21 | ) 22 | }.singleApplicationError("STS is not supported") 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/imagestream.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "web", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "web", 13 | "app.kubernetes.io/name": "web", 14 | "app.kubernetes.io/component": "frontend", 15 | "releasedVersion": "develop-SNAPSHOT", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "web", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "web", 25 | "uid": "123-123" 26 | } 27 | ] 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "ah", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "ah", 13 | "app.kubernetes.io/name": "ah", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "ah", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "ah", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "to": { 30 | "kind": "Service", 31 | "name": "ah" 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/feature/CertificateFeatureDisabledTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import assertk.assertThat 4 | import no.skatteetaten.aurora.boober.utils.AbstractFeatureTest 5 | import no.skatteetaten.aurora.boober.utils.singleApplicationError 6 | import org.junit.jupiter.api.Test 7 | 8 | class CertificateFeatureDisabledTest : AbstractFeatureTest() { 9 | override val feature: Feature 10 | get() = CertificateDisabledFeature() 11 | 12 | @Test 13 | fun `get error if trying to create certificate when feature disabled`() { 14 | 15 | assertThat { 16 | generateResources( 17 | """{ 18 | "certificate" : true, 19 | "groupId" : "org.test" 20 | }""" 21 | ) 22 | }.singleApplicationError("STS is not supported") 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/WebDeployFeatureTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/scheme": "http", 7 | "prometheus.io/scrape": "true", 8 | "prometheus.io/path": "/prometheus", 9 | "prometheus.io/port": "8081" 10 | }, 11 | "name": "simple", 12 | "namespace": "paas-utv" 13 | }, 14 | "spec": { 15 | "ports": [ 16 | { 17 | "name": "http", 18 | "port": 80, 19 | "protocol": "TCP", 20 | "targetPort": 8080 21 | }, 22 | { 23 | "name": "extra", 24 | "port": 8082, 25 | "protocol": "TCP", 26 | "targetPort": 8082 27 | } 28 | ], 29 | "selector": { 30 | "name": "simple" 31 | }, 32 | "sessionAffinity": "None", 33 | "type": "ClusterIP" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/pv/persistentvolumeclaim-postgres.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "PersistentVolumeClaim", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "pv", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "pv", 13 | "app.kubernetes.io/name": "pv", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "postgres", 18 | "namespace": "paas-utv" 19 | }, 20 | "spec": { 21 | "accessModes": [ 22 | "ReadWriteOnce" 23 | ], 24 | "resources": { 25 | "requests": { 26 | "storage": "10Gi" 27 | } 28 | }, 29 | "storageClassName": "thin2", 30 | "storageClassProvider": "kubernetes.io/vspere-volume" 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/cantusManifestResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "items": [ 3 | { 4 | "auroraVersion": null, 5 | "appVersion": null, 6 | "timeline": { 7 | "buildStarted": null, 8 | "buildEnded": "2021-01-08T15:59:00.289294849Z" 9 | }, 10 | "dockerVersion": "19.03.14", 11 | "dockerDigest": "sha256:1234", 12 | "java": null, 13 | "node": null, 14 | "requestUrl": "docker.registry/fluent/fluent-bit/1.6.10", 15 | "_links": { 16 | "self": { 17 | "href": "" 18 | } 19 | }, 20 | "_embedded": {} 21 | } 22 | ], 23 | "failure": [], 24 | "success": true, 25 | "message": "Success", 26 | "failureCount": 0, 27 | "successCount": 1, 28 | "count": 1, 29 | "_links": { 30 | "self": { 31 | "href": "" 32 | } 33 | }, 34 | "_embedded": {} 35 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JavaDeployFeatureTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/scheme": "http", 7 | "prometheus.io/scrape": "true", 8 | "prometheus.io/path": "/prometheus", 9 | "prometheus.io/port": "8081" 10 | }, 11 | "name": "simple", 12 | "namespace": "paas-utv" 13 | }, 14 | "spec": { 15 | "ports": [ 16 | { 17 | "name": "http", 18 | "port": 80, 19 | "protocol": "TCP", 20 | "targetPort": 8080 21 | }, 22 | { 23 | "name": "extra", 24 | "port": 8082, 25 | "protocol": "TCP", 26 | "targetPort": 8082 27 | } 28 | ], 29 | "selector": { 30 | "name": "simple" 31 | }, 32 | "sessionAffinity": "None", 33 | "type": "ClusterIP" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/PythonDeployFeatureTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Service", 4 | "metadata": { 5 | "annotations": { 6 | "prometheus.io/scheme": "http", 7 | "prometheus.io/scrape": "true", 8 | "prometheus.io/path": "/prometheus", 9 | "prometheus.io/port": "8081" 10 | }, 11 | "name": "simple", 12 | "namespace": "paas-utv" 13 | }, 14 | "spec": { 15 | "ports": [ 16 | { 17 | "name": "http", 18 | "port": 80, 19 | "protocol": "TCP", 20 | "targetPort": 8080 21 | }, 22 | { 23 | "name": "extra", 24 | "port": 8082, 25 | "protocol": "TCP", 26 | "targetPort": 8082 27 | } 28 | ], 29 | "selector": { 30 | "name": "simple" 31 | }, 32 | "sessionAffinity": "None", 33 | "type": "ClusterIP" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/secret-job-foo-vault.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "job", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "job", 13 | "app.kubernetes.io/name": "job", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "job-foo-vault", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "job", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "data": { 29 | "FOO": "REMOVED_IN_TEST", 30 | "BAZ": "REMOVED_IN_TEST" 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/feature/DatabaseFeatureDisabledTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import assertk.assertThat 4 | import mu.KotlinLogging 5 | import no.skatteetaten.aurora.boober.utils.AbstractFeatureTest 6 | import no.skatteetaten.aurora.boober.utils.singleApplicationError 7 | import org.junit.jupiter.api.Test 8 | 9 | private val logger = KotlinLogging.logger { } 10 | 11 | class DatabaseFeatureDisabledTest : AbstractFeatureTest() { 12 | override val feature: Feature 13 | get() = DatabaseDisabledFeature("utv") 14 | 15 | @Test 16 | fun `get error if trying to create database`() { 17 | 18 | assertThat { 19 | generateResources( 20 | """{ 21 | "database" : true 22 | }""" 23 | ) 24 | }.singleApplicationError("Databases are not supported in this cluster") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/template-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/template" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | template.json | type: "template" 7 | about.json | affiliation: "paas" 8 | about.json | segment: "aurora" 9 | utv/about.json | cluster: "utv" 10 | | permissions: 11 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 12 | folderName | envName: "utv" 13 | template.json | name: "template" 14 | template.json | releaseTo: "something" 15 | fileName | artifactId: "template" 16 | template.json | version: "1" 17 | | parameters: 18 | template.json | FEED_NAME: "test" 19 | template.json | DB_NAME: "test" 20 | template.json | template: "atomhopper" -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/unit/S3StorageGridProvisionerTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.unit 2 | 3 | import io.mockk.mockk 4 | import no.skatteetaten.aurora.boober.feature.OperationScopeFeature 5 | import no.skatteetaten.aurora.boober.service.HerkimerService 6 | import no.skatteetaten.aurora.boober.service.resourceprovisioning.S3StorageGridProvisioner 7 | import org.junit.jupiter.api.Test 8 | 9 | class S3StorageGridProvisionerTest { 10 | 11 | val herkimerService = mockk() 12 | 13 | val provisioner = S3StorageGridProvisioner( 14 | mockk(), 15 | mockk(), 16 | herkimerService, 17 | OperationScopeFeature("utv"), 18 | "us-east-1", 19 | 20000, 20 | 1000 21 | ) 22 | 23 | @Test 24 | fun `does nothing when s3 is disabled`() { 25 | 26 | provisioner.getOrProvisionCredentials("", emptyList()) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/templates/jenkins-build-config.json.vm: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "BuildConfig", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "${buildName}-test", 6 | "labels": { 7 | #foreach ($label in $labels.entrySet()) 8 | #if($velocityCount != 1) 9 | , 10 | #end 11 | "${label.key}": "${label.value}" 12 | #end 13 | } 14 | }, 15 | "specInternal": { 16 | "triggers": [ 17 | { 18 | "type": "ImageChange", 19 | "imageChange": { 20 | "from": { 21 | "kind": "ImageStreamTag", 22 | "namespace": "openshift", 23 | "name": "${build.baseName}:${build.baseVersion}" 24 | } 25 | } 26 | }, 27 | { 28 | "type": "ImageChange", 29 | "imageChange": { 30 | } 31 | } 32 | ], 33 | "source": { 34 | "git": { 35 | "uri": "${build.testGitUrl}", 36 | "ref": "${build.testTag}" 37 | } 38 | }, 39 | "strategy": { 40 | "jenkinsPipelineStrategy": { 41 | "jenkinsfilePath": "Jenkinsfile" 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/pv-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/pv" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | pv.json | type: "template" 7 | about.json | affiliation: "paas" 8 | about.json | segment: "aurora" 9 | utv/about.json | cluster: "utv" 10 | | permissions: 11 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 12 | folderName | envName: "utv" 13 | pv.json | name: "pv" 14 | fileName | artifactId: "pv" 15 | pv.json | version: "13" 16 | | parameters: 17 | pv.json | NAME: "postgres" 18 | pv.json | POSTGRESQL_USER: "postgres" 19 | pv.json | POSTGRESQL_PASSWORD: "postgres" 20 | pv.json | template: "aurora-postgres-ocp4-pv" -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/template/route-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "template", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "template", 13 | "app.kubernetes.io/name": "template", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "template", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "template", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "to": { 30 | "kind": "Service", 31 | "name": "template" 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/AuroraContextCommand.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model 2 | 3 | import no.skatteetaten.aurora.boober.service.AuroraConfigRef 4 | 5 | data class AuroraContextCommand( 6 | val auroraConfig: AuroraConfig, 7 | val applicationDeploymentRef: ApplicationDeploymentRef, 8 | val auroraConfigRef: AuroraConfigRef, 9 | val overrides: List = emptyList(), 10 | val errorsAsWarnings: Boolean = false 11 | ) { 12 | 13 | val applicationFiles: List by lazy { 14 | auroraConfig.getFilesForApplication(applicationDeploymentRef, overrides) 15 | } 16 | 17 | val applicationFile: AuroraConfigFile 18 | get() = applicationFiles.find { it.type == AuroraConfigFileType.APP && !it.override }!! 19 | 20 | val overrideFiles: Map 21 | get() = applicationFiles.filter { it.override }.associate { it.name to it.contents } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/namespace.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Namespace", 4 | "metadata": { 5 | "annotations": { 6 | "openshift.io/description": "", 7 | "openshift.io/display-name": "", 8 | "openshift.io/requester": "username", 9 | "openshift.io/sa.scc.mcs": "s0:c82,c54", 10 | "openshift.io/sa.scc.supplemental-groups": "1006750000/10000", 11 | "openshift.io/sa.scc.uid-range": "1006750000/10000" 12 | }, 13 | "creationTimestamp": "2021-06-08T11:36:10Z", 14 | "labels": { 15 | "affiliation": "paas" 16 | }, 17 | "name": "paas-utv", 18 | "resourceVersion": "1517646003", 19 | "selfLink": "/api/v1/namespaces/paas-utv", 20 | "uid": "b919f783-c84d-11eb-ac90-00505684e5da" 21 | }, 22 | "spec": { 23 | "finalizers": [ 24 | "kubernetes" 25 | ] 26 | }, 27 | "status": { 28 | "phase": "Active" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/utils/FolderHelper.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import no.skatteetaten.aurora.boober.service.vault.EncryptedFileVault 4 | import no.skatteetaten.aurora.boober.service.vault.VaultWithAccess 5 | import java.io.File 6 | 7 | fun recreateFolder(folder: File): File { 8 | if (folder.exists()) { 9 | folder.deleteRecursively() 10 | } 11 | folder.mkdirs() 12 | return folder 13 | } 14 | 15 | fun createTestVault( 16 | vaultCollectionName: String, 17 | vaultName: String, 18 | secretName: String, 19 | fileContents: String 20 | ): VaultWithAccess { 21 | val folder = recreateFolder(File("build/vaults/$vaultCollectionName/$vaultName")) 22 | File(folder, secretName).writeText(fileContents) 23 | return VaultWithAccess( 24 | vault = EncryptedFileVault.createFromFolder(folder), 25 | vaultName = vaultName, 26 | hasAccess = true 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/configmap-toxiproxy.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "web", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "web", 13 | "app.kubernetes.io/name": "web", 14 | "app.kubernetes.io/component": "frontend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "web-toxiproxy-config", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "web", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "data": { 29 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true}]" 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "project.openshift.io/v1", 3 | "kind": "Project", 4 | "metadata": { 5 | "annotations": { 6 | "openshift.io/description": "", 7 | "openshift.io/display-name": "", 8 | "openshift.io/requester": "username", 9 | "openshift.io/sa.scc.mcs": "s0:c82,c54", 10 | "openshift.io/sa.scc.supplemental-groups": "1006750000/10000", 11 | "openshift.io/sa.scc.uid-range": "1006750000/10000" 12 | }, 13 | "creationTimestamp": "2021-06-08T11:36:10Z", 14 | "labels": { 15 | "affiliation": "paas" 16 | }, 17 | "name": "paas-utv", 18 | "resourceVersion": "1517646003", 19 | "selfLink": "/apis/project.openshift.io/v1/projects/paas-utv", 20 | "uid": "b919f783-c84d-11eb-ac90-00505684e5da" 21 | }, 22 | "spec": { 23 | "finalizers": [ 24 | "kubernetes" 25 | ] 26 | }, 27 | "status": { 28 | "phase": "Active" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ToxiproxySidecarFeatureTest/configWithEndpointMapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple-toxiproxy-config", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true},{\"name\":\"test1\",\"listen\":\"0.0.0.0:18000\",\"upstream\":\"test1.test:80\",\"enabled\":true},{\"name\":\"test5\",\"listen\":\"0.0.0.0:18001\",\"upstream\":\"test5.test:443\",\"enabled\":true},{\"name\":\"test6\",\"listen\":\"0.0.0.0:18002\",\"upstream\":\"test6.test:1234\",\"enabled\":true},{\"name\":\"test7\",\"listen\":\"0.0.0.0:18003\",\"upstream\":\"test7.test:80\",\"enabled\":true},{\"name\":\"test8\",\"listen\":\"0.0.0.0:18004\",\"upstream\":\"test8.test:80\",\"enabled\":true},{\"name\":\"test9\",\"listen\":\"0.0.0.0:18005\",\"upstream\":\"test9.test:80\",\"enabled\":false}]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/service-new.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Service", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "referanse", 6 | "namespace": "foobar", 7 | "labels": { 8 | "affiliation": "paas", 9 | "app": "referanse", 10 | "updatedBy": "m89870" 11 | }, 12 | "annotations": { 13 | "prometheus.io/path": "/prometheus", 14 | "prometheus.io/port": "8082", 15 | "prometheus.io/scheme": "http", 16 | "prometheus.io/scrape": "true", 17 | "sprocket.sits.no/service.webseal": "", 18 | "sprocket.sits.no/service.webseal-roles": "" 19 | } 20 | }, 21 | "spec": { 22 | "ports": [ 23 | { 24 | "name": "http", 25 | "protocol": "TCP", 26 | "port": 80, 27 | "targetPort": 8080 28 | } 29 | ], 30 | "selector": { 31 | "name": "referanse" 32 | }, 33 | "type": "ClusterIP", 34 | "sessionAffinity": "None" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/whoami/configmap-whoami-toxiproxy-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "whoami", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "whoami", 13 | "app.kubernetes.io/name": "whoami", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "whoami-toxiproxy-config", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "whoami", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "data": { 29 | "config.json": "[{\"name\":\"app\",\"listen\":\"0.0.0.0:8090\",\"upstream\":\"0.0.0.0:8080\",\"enabled\":true}]" 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/utils/StringUtilsTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.isEqualTo 5 | import org.junit.jupiter.api.Test 6 | 7 | class StringUtilsTest { 8 | 9 | @Test 10 | fun `truncateStringAndHashTrailingCharacters should normalize to 63 chars`() { 11 | val norm = "dette-er-en-lang-tekst-som-brukes-for-aa-teste-en-funksjon-som-skal-normalisere-tekst".truncateStringAndHashTrailingCharacters(63) 12 | assertThat(norm).isEqualTo("dette-er-en-lang-tekst-som-brukes-for-aa-teste-en-funks-afb5bf6") 13 | assertThat(norm.length).isEqualTo(63) 14 | } 15 | 16 | @Test 17 | fun `truncateStringAndHashTrailingCharacters should return same string if lenght is shorter than maxLength`() { 18 | val norm = "test".truncateStringAndHashTrailingCharacters(63) 19 | assertThat(norm).isEqualTo("test") 20 | assertThat(norm.length).isEqualTo(4) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/AuroraRestTemplateTagsProvider.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober 2 | 3 | import io.micrometer.core.instrument.Tag 4 | import org.springframework.boot.actuate.metrics.web.client.RestTemplateExchangeTags 5 | import org.springframework.boot.actuate.metrics.web.client.RestTemplateExchangeTagsProvider 6 | import org.springframework.http.HttpRequest 7 | import org.springframework.http.client.ClientHttpResponse 8 | import org.springframework.stereotype.Component 9 | 10 | @Component 11 | class AuroraRestTemplateTagsProvider : RestTemplateExchangeTagsProvider { 12 | 13 | override fun getTags( 14 | urlTemplate: String?, 15 | request: HttpRequest, 16 | response: ClientHttpResponse? 17 | ): Iterable { 18 | return listOf( 19 | RestTemplateExchangeTags.method(request), 20 | RestTemplateExchangeTags.status(response), 21 | RestTemplateExchangeTags.clientName(request) 22 | ) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/web-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/web" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | web.json | type: "development" 7 | web.json | applicationPlatform: "web" 8 | about.json | affiliation: "paas" 9 | about.json | segment: "aurora" 10 | utv/about.json | cluster: "utv" 11 | | permissions: 12 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 13 | folderName | envName: "utv" 14 | fileName | name: "web" 15 | fileName | artifactId: "web" 16 | web.json | groupId: "org.test" 17 | web.json | version: "develop-SNAPSHOT" 18 | | config: 19 | web.json | foo2: "baz" 20 | web.json | route: true 21 | | webseal: 22 | web.json | strict: false 23 | web.json | toxiproxy: true -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "web", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "web", 13 | "app.kubernetes.io/name": "web", 14 | "app.kubernetes.io/component": "frontend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "web", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "web", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "host": "web-paas-utv.test", 30 | "port": { 31 | "targetPort": "http" 32 | }, 33 | "to": { 34 | "kind": "Service", 35 | "name": "web" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # CMake 2 | cmake-build-debug/ 3 | cmake-build-release/ 4 | 5 | # File-based project format 6 | *.iws 7 | 8 | # IntelliJ 9 | out/ 10 | .idea/ 11 | *.iml 12 | 13 | # mpeltonen/sbt-idea plugin 14 | .idea_modules/ 15 | 16 | # JIRA plugin 17 | atlassian-ide-plugin.xml 18 | 19 | # Cursive Clojure plugin 20 | .idea/replstate.xml 21 | 22 | # Crashlytics plugin (for Android Studio and IntelliJ) 23 | com_crashlytics_export_strings.xml 24 | crashlytics.properties 25 | crashlytics-build.properties 26 | fabric.properties 27 | 28 | # Editor-based Rest Client 29 | .idea/httpRequests 30 | 31 | .gradle 32 | /build/ 33 | 34 | # Ignore Gradle GUI config 35 | gradle-app.setting 36 | 37 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 38 | !gradle-wrapper.jar 39 | 40 | # Cache of project 41 | .gradletasknamecache 42 | 43 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 44 | # gradle/wrapper/gradle-wrapper.properties 45 | rest-client.env.json 46 | 47 | http-client.private.env.json -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/unit/ImageStreamImportGeneratorTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.unit 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.doesNotContain 5 | import assertk.assertions.isNotNull 6 | import com.fasterxml.jackson.databind.ObjectMapper 7 | import no.skatteetaten.aurora.boober.service.ImageStreamImportGenerator 8 | import org.junit.jupiter.api.Test 9 | 10 | class ImageStreamImportGeneratorTest { 11 | 12 | @Test 13 | fun `Create ImageStreamImport with imageStreamName and dockerImageUrl return no null values`() { 14 | val imageStreamImport = 15 | ImageStreamImportGenerator.create( 16 | "dockerImageUrl", 17 | "imageStreamName", 18 | "imageStreamNamespace" 19 | ) 20 | 21 | val json = ObjectMapper().writeValueAsString(imageStreamImport) 22 | 23 | assertThat(imageStreamImport).isNotNull() 24 | assertThat(json).doesNotContain("null") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/secret-secret-mount.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex-secret-mount", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "data": { 31 | "latest.properties": "REMOVED_IN_TEST" 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "easy", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "easy", 13 | "app.kubernetes.io/name": "easy", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "easy", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "easy", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "host": "easy-paas-utv.test", 30 | "port": { 31 | "targetPort": "http" 32 | }, 33 | "to": { 34 | "kind": "Service", 35 | "name": "easy" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/whoami-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/whoami" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | whoami.json | type: "deploy" 7 | whoami.json | deployState: "deployment" 8 | about.json | affiliation: "paas" 9 | about.json | segment: "aurora" 10 | utv/about.json | cluster: "utv" 11 | | permissions: 12 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 13 | folderName | envName: "utv" 14 | fileName | name: "whoami" 15 | | notification: 16 | | mattermost: 17 | | test100: 18 | whoami.json | enabled: true 19 | whoami.json | groupId: "org.test" 20 | whoami.json | database: true 21 | fileName | artifactId: "whoami" 22 | whoami.json | version: "1" 23 | whoami.json | toxiproxy: true -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | def jenkinsfile 2 | 3 | // Testene er avhengig av at cluster er satt til utv. Ellers feiler testene med "Invalid cluster configuration" 4 | env.OPENSHIFT_CLUSTER = "utv" 5 | 6 | def overrides = [ 7 | scriptVersion : 'v7', 8 | iqOrganizationName: "Team AOS", 9 | iqBreakOnUnstable: true, 10 | iqEmbedded: true, 11 | compilePropertiesIq: "-x test", 12 | pipelineScript: 'https://git.aurora.skead.no/scm/ao/aurora-pipeline-scripts.git', 13 | credentialsId: "github", 14 | checkstyle : false, 15 | javaVersion: 17, 16 | jiraFiksetIKomponentversjon: true, 17 | chatRoom: "#aos-notifications", 18 | versionStrategy: [ 19 | [branch: 'master', versionHint: '3'], 20 | [branch: 'release/v2', versionHint: '2'], 21 | ], 22 | uploadLeveransepakke: true 23 | ] 24 | 25 | fileLoader.withGit(overrides.pipelineScript,, overrides.scriptVersion) { 26 | jenkinsfile = fileLoader.load('templates/leveransepakke') 27 | } 28 | 29 | jenkinsfile.gradle(overrides.scriptVersion, overrides) 30 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/ah-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/ah" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | ah.json | type: "localTemplate" 7 | about.json | affiliation: "paas" 8 | about.json | segment: "aurora" 9 | utv/about.json | cluster: "utv" 10 | | permissions: 11 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 12 | folderName | envName: "utv" 13 | fileName | name: "ah" 14 | | config: 15 | ah.json | FOO: "bar" 16 | ah.json | database: true 17 | fileName | artifactId: "ah" 18 | ah.json | version: "1.3.4" 19 | | parameters: 20 | ah.json | FEED_NAME: "feed" 21 | ah.json | DOMAIN_NAME: "localhost" 22 | ah.json | DB_NAME: "feed" 23 | ah.json | templateFile: "templates/atomhopper.json" -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/ConfigFeatureTest/configMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "data": { 9 | "latest.properties": "STRING=Hello\nBOOL=false\nINT=42\nFLOAT=4.2\nARRAY=[4.2,\"STRING\",true]\nURL=https://int-at.skead.no:13110/felles/sikkerhet/stsSikkerhet/v1/validerSaml\nJSON_STRING={\"key\": \"value\"}\nJSON_ARRAY=[ { uri: \"http://tsl0part-fk1-s-adm01:20000/registry\", urn: [\"urn:skatteetaten:part:identifikasjon:partsidentifikasjon:root\"], segment: \"part\" }, { uri: \"http://tsl0part-fk1-s-adm01:20000/registry\", urn: [\"urn:skatteetaten:part:partsregister:feed:*\"], segment: \"part\" } , { uri: \"http://tsl0part-fk1-s-adm01:20000/registry\", urn: [\"urn:skatteetaten:part:partsregister:hendelselager:*\"], segment: \"part\" } , { uri: \"http://tsl0part-fk1-s-adm01:20000/registry\", urn: [\"no:skatteetaten:sikkerhet:tilgangskontroll:ats:v1\"], segment: \"part\" } ]" 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "python", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "python", 13 | "app.kubernetes.io/name": "python", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "python", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "python", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "host": "python-paas-utv.test", 30 | "port": { 31 | "targetPort": "http" 32 | }, 33 | "to": { 34 | "kind": "Service", 35 | "name": "python" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "simple", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "simple", 13 | "app.kubernetes.io/name": "simple", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "simple", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "simple", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "host": "simple-paas-utv.test", 30 | "port": { 31 | "targetPort": "http" 32 | }, 33 | "to": { 34 | "kind": "Service", 35 | "name": "simple" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/secret-komplex-foo-vault.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex-foo-vault", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "data": { 31 | "FOO": "REMOVED_IN_TEST", 32 | "BAZ": "REMOVED_IN_TEST" 33 | } 34 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/groups.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "items": [ 4 | { 5 | "apiVersion": "user.openshift.io/v1", 6 | "kind": "Group", 7 | "metadata": { 8 | "name": "APP_PaaS_drift", 9 | "resourceVersion": "752942768", 10 | "selfLink": "/apis/user.openshift.io/v1/groups/APP_PaaS_drift", 11 | "uid": "ac9101d7-6ac5-11e6-b1c7-005056833ec1" 12 | }, 13 | "users": [ 14 | "hero" 15 | ] 16 | }, 17 | { 18 | "apiVersion": "user.openshift.io/v1", 19 | "kind": "Group", 20 | "metadata": { 21 | "name": "APP_PaaS_utv", 22 | "resourceVersion": "752942768", 23 | "selfLink": "/apis/user.openshift.io/v1/groups/APP_PaaS_drift", 24 | "uid": "ac9101d7-6ac5-11e6-b1c7-005056833ec1" 25 | }, 26 | "users": [ 27 | "hero" 28 | ] 29 | } 30 | ], 31 | "kind": "List", 32 | "metadata": { 33 | "resourceVersion": "", 34 | "selfLink": "" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/secret-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "ah", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "ah", 13 | "app.kubernetes.io/name": "ah", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "ah-db", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "ah", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "data": { 30 | "db.properties": "REMOVED_IN_TEST", 31 | "id": "REMOVED_IN_TEST", 32 | "info": "REMOVED_IN_TEST", 33 | "jdbcurl": "REMOVED_IN_TEST", 34 | "name": "REMOVED_IN_TEST" 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/bigip.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "BigIp", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "spec": { 31 | "routeName": "komplex-bigip", 32 | "konfigtjenesten": { 33 | "service": "simple-utv" 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/secret-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "easy", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "easy", 13 | "app.kubernetes.io/name": "easy", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "easy-db", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "easy", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "data": { 30 | "db.properties": "REMOVED_IN_TEST", 31 | "id": "REMOVED_IN_TEST", 32 | "info": "REMOVED_IN_TEST", 33 | "jdbcurl": "REMOVED_IN_TEST", 34 | "name": "REMOVED_IN_TEST" 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/model/openshift/ImageStreamImport.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.model.openshift 2 | 3 | import io.fabric8.openshift.api.model.ImageStreamImport 4 | import io.fabric8.openshift.api.model.NamedTagEventList 5 | 6 | fun ImageStreamImport.findErrorMessage(): String? { 7 | val errorStatuses = listOf("false", "failure") 8 | val tag = this.findImportStatusTag() 9 | return tag?.conditions 10 | ?.firstOrNull { errorStatuses.contains(it.status.lowercase()) } 11 | ?.message 12 | } 13 | 14 | fun ImageStreamImport.isDifferentImage(imageHash: String?): Boolean { 15 | val tag = this.findImportStatusTag() 16 | 17 | val image = tag?.items?.firstOrNull()?.image 18 | return image?.let { return it != imageHash } ?: true 19 | } 20 | 21 | fun ImageStreamImport.findImportStatusTag(): NamedTagEventList? { 22 | val tagName = this.spec.images.first().to.name 23 | return this.status 24 | ?.import 25 | ?.status 26 | ?.tags 27 | ?.firstOrNull { it.tag == tagName } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/secret-komplex-hec.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex-hec", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "data": { 31 | "HEC_TOKEN": "REMOVED_IN_TEST", 32 | "SPLUNK_HOST": "REMOVED_IN_TEST", 33 | "SPLUNK_PORT": "REMOVED_IN_TEST" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/secret-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "python", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "python", 13 | "app.kubernetes.io/name": "python", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "python-db", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "python", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "data": { 30 | "db.properties": "REMOVED_IN_TEST", 31 | "id": "REMOVED_IN_TEST", 32 | "info": "REMOVED_IN_TEST", 33 | "jdbcurl": "REMOVED_IN_TEST", 34 | "name": "REMOVED_IN_TEST" 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/sgoa.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "skatteetaten.no/v1", 3 | "kind" : "StorageGridObjectArea", 4 | "metadata" : { 5 | "labels" : { 6 | "operationScope" : "aos-4016", 7 | "app" : "python", 8 | "updatedBy" : "hero", 9 | "updatedAt" : "0", 10 | "lastUpdatedYear" : "1970", 11 | "affiliation" : "paas", 12 | "name" : "python", 13 | "booberDeployId" : "deploy1" 14 | }, 15 | "name" : "python-default", 16 | "namespace" : "paas-utv", 17 | "ownerReferences" : [ { 18 | "apiVersion" : "skatteetaten.no/v1", 19 | "kind" : "ApplicationDeployment", 20 | "name" : "python", 21 | "uid" : "123-123" 22 | } ] 23 | }, 24 | "spec" : { 25 | "bucketPostfix" : "mybucket", 26 | "applicationDeploymentId" : "1234567890", 27 | "objectArea" : "default", 28 | "tryReuseCredentials" : false 29 | }, 30 | "status": { 31 | "result": { 32 | "message": "nothing here", 33 | "reason": "SGOAProvisioned", 34 | "success": true 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/secret-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "simple", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "simple", 13 | "app.kubernetes.io/name": "simple", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "simple-db", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "simple", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "data": { 30 | "db.properties": "REMOVED_IN_TEST", 31 | "id": "REMOVED_IN_TEST", 32 | "info": "REMOVED_IN_TEST", 33 | "jdbcurl": "REMOVED_IN_TEST", 34 | "name": "REMOVED_IN_TEST" 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/sgoa.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "skatteetaten.no/v1", 3 | "kind" : "StorageGridObjectArea", 4 | "metadata" : { 5 | "labels" : { 6 | "operationScope" : "aos-4016", 7 | "app" : "simple", 8 | "updatedBy" : "hero", 9 | "updatedAt" : "0", 10 | "lastUpdatedYear" : "1970", 11 | "affiliation" : "paas", 12 | "name" : "simple", 13 | "booberDeployId" : "deploy1" 14 | }, 15 | "name" : "simple-default", 16 | "namespace" : "paas-utv", 17 | "ownerReferences" : [ { 18 | "apiVersion" : "skatteetaten.no/v1", 19 | "kind" : "ApplicationDeployment", 20 | "name" : "simple", 21 | "uid" : "123-123" 22 | } ] 23 | }, 24 | "spec" : { 25 | "bucketPostfix" : "mybucket", 26 | "applicationDeploymentId" : "1234567890", 27 | "objectArea" : "default", 28 | "tryReuseCredentials" : false 29 | }, 30 | "status": { 31 | "result": { 32 | "message": "nothing here", 33 | "reason": "SGOAProvisioned", 34 | "success": true 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/whoami/secret-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "whoami", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "whoami", 13 | "app.kubernetes.io/name": "whoami", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "whoami-db", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "whoami", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "data": { 30 | "db.properties": "REMOVED_IN_TEST", 31 | "id": "REMOVED_IN_TEST", 32 | "info": "REMOVED_IN_TEST", 33 | "jdbcurl": "REMOVED_IN_TEST", 34 | "name": "REMOVED_IN_TEST" 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/simple-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/simple" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | about.json | type: "deploy" 7 | about.json | affiliation: "paas" 8 | about.json | segment: "aurora" 9 | utv/about.json | cluster: "utv" 10 | | permissions: 11 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 12 | folderName | envName: "utv" 13 | fileName | name: "simple" 14 | simple.json | groupId: "org.test" 15 | | databaseDefaults: 16 | simple.json | tryReuse: true 17 | simple.json | database: true 18 | fileName | artifactId: "simple" 19 | simple.json | version: "1" 20 | simple.json | route: true 21 | simple.json | s3: true 22 | | s3Defaults: 23 | simple.json | bucketName: "mybucket" 24 | simple.json | objectArea: "default" 25 | simple.json | sts: true -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/sgoa.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion" : "skatteetaten.no/v1", 3 | "kind" : "StorageGridObjectArea", 4 | "metadata" : { 5 | "labels" : { 6 | "operationScope" : "aos-4016", 7 | "app" : "complex", 8 | "updatedBy" : "hero", 9 | "updatedAt" : "0", 10 | "lastUpdatedYear" : "1970", 11 | "affiliation" : "paas", 12 | "name" : "complex", 13 | "booberDeployId" : "deploy1" 14 | }, 15 | "name" : "complex-default", 16 | "namespace" : "paas-utv", 17 | "ownerReferences" : [ { 18 | "apiVersion" : "skatteetaten.no/v1", 19 | "kind" : "ApplicationDeployment", 20 | "name" : "complex", 21 | "uid" : "123-123" 22 | } ] 23 | }, 24 | "spec" : { 25 | "bucketPostfix" : "mybucket", 26 | "applicationDeploymentId" : "1234567890", 27 | "objectArea" : "default", 28 | "tryReuseCredentials" : false 29 | }, 30 | "status": { 31 | "result": { 32 | "message": "nothing here", 33 | "reason": "SGOAProvisioned", 34 | "success": true 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/storagegridobjectarea-job-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "StorageGridObjectArea", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "job", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "job", 13 | "booberDeployId": "deploy1" 14 | }, 15 | "name": "job-default", 16 | "namespace": "paas-utv", 17 | "ownerReferences": [ 18 | { 19 | "apiVersion": "skatteetaten.no/v1", 20 | "kind": "ApplicationDeployment", 21 | "name": "job", 22 | "uid": "123-123" 23 | } 24 | ] 25 | }, 26 | "spec": { 27 | "bucketPostfix": "mybucket", 28 | "applicationDeploymentId": "1234567890", 29 | "objectArea": "default", 30 | "tryReuseCredentials": false 31 | }, 32 | "status": { 33 | "result": { 34 | "message": "nothing here", 35 | "reason": "SGOAProvisioned", 36 | "success": true 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/dbhResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "OK", 3 | "totalCount": 1, 4 | "items": [ 5 | { 6 | "metadata": { 7 | "sizeInMb": 0.25 8 | }, 9 | "createdDate": "2017-05-24T15:03:54Z", 10 | "lastUsedDate": "2017-09-27T13:13:50Z", 11 | "jdbcUrl": "jdbc:oracle:thin:@some-db-server01.skead.no:1521/dbhotel", 12 | "name": "VCLFVAPKGOMBCFTWEVKZDYBGVTMYDP", 13 | "databaseInstance": { 14 | "port": 1521, 15 | "host": "some-db-server01.test.org" 16 | }, 17 | "id": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 18 | "type": "MANAGED", 19 | "users": [ 20 | { 21 | "username": "VCLFVAPKGOMBCFTWEVKZDYBGVTMYDP", 22 | "password": "yYGmRnUPBORxMoMcPptGvDYgKxmRSm", 23 | "type": "SCHEMA" 24 | } 25 | ], 26 | "labels": { 27 | "environment": "paas-utv", 28 | "application": "simple", 29 | "affiliation": "paas", 30 | "name": "simple", 31 | "userId": "hero" 32 | } 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/auroraazureapp-komplex.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "AuroraAzureApp", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name":"komplex", 14 | "app.kubernetes.io/component":"backend", 15 | "app.kubernetes.io/part-of":"test-group", 16 | "app.openshift.io/runtime":"spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "spec": { 31 | "azureAppFqdn": "complex-utv.amutv.skead.no", 32 | "appName": "komplex", 33 | "groups": [ ], 34 | "noProxy": false 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/legacy-spec-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": { 3 | "source": "static", 4 | "value": "paas-utv", 5 | "sources": [ 6 | { 7 | "name": "static", 8 | "value": "paas-utv" 9 | } 10 | ] 11 | }, 12 | "applicationDeploymentId": { 13 | "source": "static", 14 | "value": "1234567890", 15 | "sources": [ 16 | { 17 | "name": "static", 18 | "value": "1234567890" 19 | } 20 | ] 21 | }, 22 | "bigip": { 23 | "service": { 24 | "source": "utv/simple.json", 25 | "value": "simple", 26 | "sources": [ 27 | { 28 | "name": "utv/simple.json", 29 | "value": "simple" 30 | } 31 | ] 32 | }, 33 | "routeAnnotations": { 34 | "haproxy.router.openshift.io|timeout": { 35 | "source": "utv/simple.json", 36 | "value": "30s", 37 | "sources": [ 38 | { 39 | "name": "utv/simple.json", 40 | "value": "30s" 41 | } 42 | ] 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftCommandServiceTest/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "creationTimestamp": "2019-02-14T08:29:50Z", 6 | "labels": { 7 | "affiliation": "paas", 8 | "app": "ref", 9 | "booberDeployId": "bee6c47", 10 | "updatedBy": "m89870" 11 | }, 12 | "name": "ref4", 13 | "namespace": "paas-bjarte-dev", 14 | "ownerReferences": [ 15 | { 16 | "apiVersion": "skatteetaten.no/v1", 17 | "kind": "ApplicationDeployment", 18 | "name": "ref", 19 | "uid": "b95463b4-302c-11e9-a70b-005056833ec1" 20 | } 21 | ], 22 | "resourceVersion": "502259548", 23 | "selfLink": "/apis/route.openshift.io/v1/namespaces/paas-bjarte-dev/routes/ref4", 24 | "uid": "b2391b03-3032-11e9-8fd1-00505683244e" 25 | }, 26 | "spec": { 27 | "host": "foobar.paas-bjarte-dev.utv.paas.skead.no", 28 | "to": { 29 | "kind": "Service", 30 | "name": "ref", 31 | "weight": 100 32 | }, 33 | "wildcardPolicy": "None" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftCommandServiceTest/route-with-new-host.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "creationTimestamp": "2019-02-14T08:29:50Z", 6 | "labels": { 7 | "affiliation": "paas", 8 | "app": "ref", 9 | "booberDeployId": "bee6c47", 10 | "updatedBy": "m89870" 11 | }, 12 | "name": "ref4", 13 | "namespace": "paas-bjarte-dev", 14 | "ownerReferences": [ 15 | { 16 | "apiVersion": "skatteetaten.no/v1", 17 | "kind": "ApplicationDeployment", 18 | "name": "ref", 19 | "uid": "b95463b4-302c-11e9-a70b-005056833ec1" 20 | } 21 | ], 22 | "resourceVersion": "502259548", 23 | "selfLink": "/apis/route.openshift.io/v1/namespaces/paas-bjarte-dev/routes/ref4", 24 | "uid": "b2391b03-3032-11e9-8fd1-00505683244e" 25 | }, 26 | "spec": { 27 | "host": "foobar2.paas-bjarte-dev.utv.paas.skead.no", 28 | "to": { 29 | "kind": "Service", 30 | "name": "ref", 31 | "weight": 100 32 | }, 33 | "wildcardPolicy": "None" 34 | } 35 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/utils/SecretUtilsTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.utils 2 | 3 | import assertk.assertions.isEqualTo 4 | import org.junit.jupiter.api.Test 5 | import java.util.Base64 6 | 7 | internal class SecretUtilsTest { 8 | 9 | @Test 10 | fun `editEncodedValue should change a Base64 encoded value with a given key in a map of secrets`() { 11 | 12 | val secretMap = mapOf( 13 | "testKey1" to "change this value", 14 | "testKey2" to "edit this value with some function", 15 | "testKey3" to "keep this value" 16 | ).mapValues { Base64.getEncoder().encodeToString(it.value.toByteArray()) }.toMutableMap() 17 | 18 | secretMap.editEncodedValue("testKey1") { "another value" } 19 | secretMap.editEncodedValue("testKey2") { it.uppercase() } 20 | 21 | assertThatBase64Decoded(secretMap["testKey1"]).isEqualTo("another value") 22 | assertThatBase64Decoded(secretMap["testKey2"]).isEqualTo("EDIT THIS VALUE WITH SOME FUNCTION") 23 | assertThatBase64Decoded(secretMap["testKey3"]).isEqualTo("keep this value") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/service/IdService.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.service 2 | 3 | import no.skatteetaten.aurora.boober.utils.ConditionalOnPropertyMissingOrEmpty 4 | import org.apache.commons.codec.digest.DigestUtils 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty 6 | import org.springframework.stereotype.Service 7 | 8 | @Service 9 | @ConditionalOnProperty("integrations.herkimer.url") 10 | class IdService( 11 | private val herkimerService: HerkimerService, 12 | val configuration: HerkimerConfiguration 13 | ) { 14 | fun generateOrFetchId(request: ApplicationDeploymentCreateRequest): String = 15 | runCatching { 16 | herkimerService.createApplicationDeployment(request).id 17 | }.recover { 18 | configuration.fallback[request.name] ?: throw it 19 | }.getOrThrow() 20 | } 21 | 22 | @Service 23 | @ConditionalOnPropertyMissingOrEmpty("integrations.herkimer.url") 24 | class IdServiceFallback { 25 | 26 | fun generateOrFetchId(name: String, namespace: String): String = 27 | DigestUtils.sha1Hex("$namespace/$name") 28 | } 29 | -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/feature/S3FeatureDisabledTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.isSuccess 5 | import mu.KotlinLogging 6 | import no.skatteetaten.aurora.boober.utils.AbstractFeatureTest 7 | import no.skatteetaten.aurora.boober.utils.singleApplicationError 8 | import org.junit.jupiter.api.Test 9 | 10 | private val logger = KotlinLogging.logger { } 11 | 12 | class S3FeatureDisabledTest : AbstractFeatureTest() { 13 | override val feature: Feature 14 | get() = S3DisabledFeature() 15 | 16 | @Test 17 | fun `get error if trying to create s3`() { 18 | assertThat { 19 | generateResources( 20 | """{ 21 | "s3" : true 22 | }""" 23 | ) 24 | }.singleApplicationError("S3 storage is not available in this cluster=utv") 25 | } 26 | 27 | @Test 28 | fun `get if trying to create s3`() { 29 | assertThat { 30 | generateResources( 31 | """{ 32 | }""" 33 | ) 34 | }.isSuccess() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftCommandServiceTest/route-with-new-path.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "creationTimestamp": "2019-02-14T08:29:50Z", 6 | "labels": { 7 | "affiliation": "paas", 8 | "app": "ref", 9 | "booberDeployId": "bee6c47", 10 | "updatedBy": "m89870" 11 | }, 12 | "name": "ref4", 13 | "namespace": "paas-bjarte-dev", 14 | "ownerReferences": [ 15 | { 16 | "apiVersion": "skatteetaten.no/v1", 17 | "kind": "ApplicationDeployment", 18 | "name": "ref", 19 | "uid": "b95463b4-302c-11e9-a70b-005056833ec1" 20 | } 21 | ], 22 | "resourceVersion": "502259548", 23 | "selfLink": "/apis/route.openshift.io/v1/namespaces/paas-bjarte-dev/routes/ref4", 24 | "uid": "b2391b03-3032-11e9-8fd1-00505683244e" 25 | }, 26 | "spec": { 27 | "host": "foobar.paas-bjarte-dev.utv.paas.skead.no", 28 | "path": "/foo", 29 | "to": { 30 | "kind": "Service", 31 | "name": "ref", 32 | "weight": 100 33 | }, 34 | "wildcardPolicy": "None" 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/job-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/job" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | job.json | type: "cronjob" 7 | about.json | affiliation: "paas" 8 | about.json | segment: "aurora" 9 | utv/about.json | cluster: "utv" 10 | | permissions: 11 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 12 | folderName | envName: "utv" 13 | fileName | name: "job" 14 | job.json | groupId: "no.skatteetaten.demo" 15 | | config: 16 | job.json | FOO: "bar" 17 | fileName | artifactId: "job" 18 | job.json | version: "1" 19 | job.json | serviceAccount: "foo" 20 | job.json | schedule: "0/5 * * * *" 21 | | s3: 22 | | default: 23 | job.json | bucketName: "mybucket" 24 | | secretVaults: 25 | | foo: 26 | job.json | keys: ["BAR","FOO"] 27 | job.json | keyMappings: {"BAR":"BAZ"} -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/route-path.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex-path", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "spec": { 31 | "host": "pathroute.test", 32 | "path": "/path", 33 | "port": { 34 | "targetPort": "http" 35 | }, 36 | "to": { 37 | "kind": "Service", 38 | "name": "komplex" 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/resourceprovisioning/DatabaseSchemaProvisionerTest/schema_fd59dba9-7d67-4ea2-bb98-081a5df8c387.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "OK", 3 | "totalCount": 1, 4 | "items": [ 5 | { 6 | "metadata": { 7 | "sizeInMb": 0.25 8 | }, 9 | "createdDate": "2017-05-24T15:03:54Z", 10 | "lastUsedDate": "2017-09-27T13:13:50Z", 11 | "jdbcUrl": "jdbc:oracle:thin:@some-db-server01.skead.no:1521/dbhotel", 12 | "name": "VCLFVAPKGOMBCFTWEVKZDYBGVTMYDP", 13 | "databaseInstance": { 14 | "port": 1521, 15 | "host": "some-db-server01.skead.no" 16 | }, 17 | "id": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 18 | "type": "MANAGED", 19 | "users": [ 20 | { 21 | "username": "VCLFVAPKGOMBCFTWEVKZDYBGVTMYDP", 22 | "password": "yYGmRnUPBORxMoMcPptGvDYgKxmRSm", 23 | "type": "SCHEMA" 24 | } 25 | ], 26 | "labels": { 27 | "environment": "architect-utv", 28 | "application": "reference", 29 | "affiliation": "aos", 30 | "name": "reference", 31 | "userId": "k72950" 32 | } 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/v1/ClientConfigControllerV1.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.v1 2 | 3 | import no.skatteetaten.aurora.boober.controller.internal.Response 4 | import org.springframework.beans.factory.annotation.Value 5 | import org.springframework.web.bind.annotation.GetMapping 6 | import org.springframework.web.bind.annotation.RequestMapping 7 | import org.springframework.web.bind.annotation.RestController 8 | 9 | @RestController 10 | @RequestMapping("/v1/clientconfig") 11 | class ClientConfigControllerV1( 12 | @Value("\${integrations.aurora.config.git.urlPattern}") val gitUrlPattern: String, 13 | @Value("\${openshift.cluster}") val openshiftCluster: String, 14 | @Value("\${integrations.openshift.url}") val openshiftUrl: String 15 | ) { 16 | 17 | @GetMapping 18 | fun get() = Response( 19 | items = listOf( 20 | mapOf( 21 | Pair("gitUrlPattern", gitUrlPattern), 22 | Pair("openshiftCluster", openshiftCluster), 23 | Pair("openshiftUrl", openshiftUrl), 24 | Pair("apiVersion", 2) 25 | ) 26 | ) 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/JobFeatureTest/cronjob.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "batch/v1beta1", 3 | "kind": "CronJob", 4 | "metadata": { 5 | "name": "simple", 6 | "namespace": "paas-utv" 7 | }, 8 | "spec": { 9 | "concurrencyPolicy": "Forbid", 10 | "failedJobsHistoryLimit": 1, 11 | "jobTemplate": { 12 | "metadata": { 13 | "generateName": "simple" 14 | }, 15 | "spec": { 16 | "completions": 1, 17 | "parallelism": 1, 18 | "template": { 19 | "metadata": { 20 | "generateName": "simple" 21 | }, 22 | "spec": { 23 | "containers": [ 24 | { 25 | "image": "docker.registry/aurora/turbo@sha:1234", 26 | "imagePullPolicy": "Always", 27 | "name": "simple" 28 | } 29 | ], 30 | "dnsPolicy": "ClusterFirst", 31 | "restartPolicy": "Never" 32 | } 33 | } 34 | } 35 | }, 36 | "schedule": "0/5 * * * *", 37 | "startingDeadlineSeconds": 60, 38 | "successfulJobsHistoryLimit": 3, 39 | "suspend": false 40 | } 41 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/secret-s3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "storagegrid.skatteetaten.no/objectArea": "default" 7 | }, 8 | "labels": { 9 | "operationScope": "aos-4016", 10 | "app": "easy", 11 | "updatedBy": "hero", 12 | "updatedAt": "0", 13 | "lastUpdatedYear": "1970", 14 | "affiliation": "paas", 15 | "name": "easy", 16 | "app.kubernetes.io/name": "easy", 17 | "app.kubernetes.io/component": "backend", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "easy-default-s3", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "easy", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "serviceEndpoint": "REMOVED_IN_TEST", 33 | "accessKey": "REMOVED_IN_TEST", 34 | "secretKey": "REMOVED_IN_TEST", 35 | "bucketRegion": "REMOVED_IN_TEST", 36 | "bucketName": "REMOVED_IN_TEST", 37 | "objectPrefix": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/feature/BigIpFeatureTest/spec-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": { 3 | "source": "static", 4 | "value": "paas-utv", 5 | "sources": [ 6 | { 7 | "name": "static", 8 | "value": "paas-utv" 9 | } 10 | ] 11 | }, 12 | "applicationDeploymentId": { 13 | "source": "static", 14 | "value": "1234567890", 15 | "sources": [ 16 | { 17 | "name": "static", 18 | "value": "1234567890" 19 | } 20 | ] 21 | }, 22 | "bigip": { 23 | "simple": { 24 | "service": { 25 | "source": "utv/simple.json", 26 | "value": "simple", 27 | "sources": [ 28 | { 29 | "name": "utv/simple.json", 30 | "value": "simple" 31 | } 32 | ] 33 | }, 34 | "routeAnnotations": { 35 | "haproxy.router.openshift.io|timeout": { 36 | "source": "utv/simple.json", 37 | "value": "30s", 38 | "sources": [ 39 | { 40 | "name": "utv/simple.json", 41 | "value": "30s" 42 | } 43 | ] 44 | } 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/job/secret-job-default-s3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "storagegrid.skatteetaten.no/objectArea": "default" 7 | }, 8 | "labels": { 9 | "operationScope": "aos-4016", 10 | "app": "job", 11 | "updatedBy": "hero", 12 | "updatedAt": "0", 13 | "lastUpdatedYear": "1970", 14 | "affiliation": "paas", 15 | "name": "job", 16 | "app.kubernetes.io/name": "job", 17 | "app.kubernetes.io/component": "backend", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "job-default-s3", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "job", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "serviceEndpoint": "REMOVED_IN_TEST", 33 | "accessKey": "REMOVED_IN_TEST", 34 | "secretKey": "REMOVED_IN_TEST", 35 | "bucketRegion": "REMOVED_IN_TEST", 36 | "bucketName": "REMOVED_IN_TEST", 37 | "objectPrefix": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/web/route-webseal.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "" 8 | }, 9 | "labels": { 10 | "operationScope": "aos-4016", 11 | "app": "web", 12 | "updatedBy": "hero", 13 | "updatedAt": "0", 14 | "lastUpdatedYear": "1970", 15 | "affiliation": "paas", 16 | "name": "web", 17 | "app.kubernetes.io/name": "web", 18 | "app.kubernetes.io/component": "frontend", 19 | "type": "webseal", 20 | "booberDeployId": "deploy1" 21 | }, 22 | "name": "web-webseal", 23 | "namespace": "paas-utv", 24 | "ownerReferences": [ 25 | { 26 | "apiVersion": "skatteetaten.no/v1", 27 | "kind": "ApplicationDeployment", 28 | "name": "web", 29 | "uid": "123-123" 30 | } 31 | ] 32 | }, 33 | "spec": { 34 | "host": "web-paas-utv.test.webseal", 35 | "port": { 36 | "targetPort": "http" 37 | }, 38 | "to": { 39 | "kind": "Service", 40 | "name": "web" 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/secret-foo-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "app.kubernetes.io/part-of": "test-group", 17 | "app.openshift.io/runtime": "spring-boot", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "komplex-foo-db", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "komplex", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "db.properties": "REMOVED_IN_TEST", 33 | "id": "REMOVED_IN_TEST", 34 | "info": "REMOVED_IN_TEST", 35 | "jdbcurl": "REMOVED_IN_TEST", 36 | "name": "REMOVED_IN_TEST" 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/secret-s3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "storagegrid.skatteetaten.no/objectArea": "default" 7 | }, 8 | "labels": { 9 | "operationScope": "aos-4016", 10 | "app": "python", 11 | "updatedBy": "hero", 12 | "updatedAt": "0", 13 | "lastUpdatedYear": "1970", 14 | "affiliation": "paas", 15 | "name": "python", 16 | "app.kubernetes.io/name": "python", 17 | "app.kubernetes.io/component": "backend", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "python-default-s3", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "python", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "serviceEndpoint": "REMOVED_IN_TEST", 33 | "accessKey": "REMOVED_IN_TEST", 34 | "secretKey": "REMOVED_IN_TEST", 35 | "bucketRegion": "REMOVED_IN_TEST", 36 | "bucketName": "REMOVED_IN_TEST", 37 | "objectPrefix": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/secret-s3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "storagegrid.skatteetaten.no/objectArea": "default" 7 | }, 8 | "labels": { 9 | "operationScope": "aos-4016", 10 | "app": "simple", 11 | "updatedBy": "hero", 12 | "updatedAt": "0", 13 | "lastUpdatedYear": "1970", 14 | "affiliation": "paas", 15 | "name": "simple", 16 | "app.kubernetes.io/name": "simple", 17 | "app.kubernetes.io/component": "backend", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "simple-default-s3", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "simple", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "serviceEndpoint": "REMOVED_IN_TEST", 33 | "accessKey": "REMOVED_IN_TEST", 34 | "secretKey": "REMOVED_IN_TEST", 35 | "bucketRegion": "REMOVED_IN_TEST", 36 | "bucketName": "REMOVED_IN_TEST", 37 | "objectPrefix": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/secret-sts.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "gillis.skatteetaten.no/app": "easy", 7 | "gillis.skatteetaten.no/commonName": "org.test.easy" 8 | }, 9 | "labels": { 10 | "operationScope": "aos-4016", 11 | "app": "easy", 12 | "updatedBy": "hero", 13 | "updatedAt": "0", 14 | "lastUpdatedYear": "1970", 15 | "affiliation": "paas", 16 | "name": "easy", 17 | "app.kubernetes.io/name": "easy", 18 | "app.kubernetes.io/component": "backend", 19 | "stsRenewAfter": "1557313927", 20 | "booberDeployId": "deploy1" 21 | }, 22 | "name": "easy-sts", 23 | "namespace": "paas-utv", 24 | "ownerReferences": [ 25 | { 26 | "apiVersion": "skatteetaten.no/v1", 27 | "kind": "ApplicationDeployment", 28 | "name": "easy", 29 | "uid": "123-123" 30 | } 31 | ] 32 | }, 33 | "data": { 34 | "privatekey.key": "REMOVED_IN_TEST", 35 | "keystore.jks": "REMOVED_IN_TEST", 36 | "certificate.crt": "REMOVED_IN_TEST", 37 | "descriptor.properties": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/python-spec.txt: -------------------------------------------------------------------------------- 1 | static | applicationDeploymentRef: "utv/python" 2 | static | configVersion: "master" 3 | static | namespace: "paas-utv" 4 | static | applicationDeploymentId: "1234567890" 5 | about.json | schemaVersion: "v1" 6 | about.json | type: "deploy" 7 | utv/python.json | applicationPlatform: "python" 8 | about.json | affiliation: "paas" 9 | about.json | segment: "aurora" 10 | utv/about.json | cluster: "utv" 11 | | permissions: 12 | about.json | admin: "APP_PaaS_drift APP_PaaS_utv" 13 | folderName | envName: "utv" 14 | fileName | name: "python" 15 | utv/python.json | groupId: "org.test" 16 | | databaseDefaults: 17 | utv/python.json | tryReuse: true 18 | utv/python.json | database: true 19 | fileName | artifactId: "python" 20 | utv/python.json | version: "1" 21 | utv/python.json | route: true 22 | utv/python.json | s3: true 23 | | s3Defaults: 24 | utv/python.json | bucketName: "mybucket" 25 | utv/python.json | objectArea: "default" 26 | utv/python.json | tenant: "paas-utv" 27 | utv/python.json | sts: true -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/secret-komplex-db.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "dbhId": "fd59dba9-7d67-4ea2-bb98-081a5df8c387", 16 | "app.kubernetes.io/part-of": "test-group", 17 | "app.openshift.io/runtime": "spring-boot", 18 | "booberDeployId": "deploy1" 19 | }, 20 | "name": "komplex-complex-db", 21 | "namespace": "paas-utv", 22 | "ownerReferences": [ 23 | { 24 | "apiVersion": "skatteetaten.no/v1", 25 | "kind": "ApplicationDeployment", 26 | "name": "komplex", 27 | "uid": "123-123" 28 | } 29 | ] 30 | }, 31 | "data": { 32 | "db.properties": "REMOVED_IN_TEST", 33 | "id": "REMOVED_IN_TEST", 34 | "info": "REMOVED_IN_TEST", 35 | "jdbcurl": "REMOVED_IN_TEST", 36 | "name": "REMOVED_IN_TEST" 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/unit/FeatureContextTest.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.unit 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.isFailure 5 | import assertk.assertions.messageContains 6 | import no.skatteetaten.aurora.boober.feature.FeatureContext 7 | import no.skatteetaten.aurora.boober.feature.getContextKey 8 | import org.junit.jupiter.api.Test 9 | 10 | class FeatureContextTest { 11 | 12 | @Test 13 | fun `should get good error message when context name is wrong`() { 14 | 15 | val context: FeatureContext = mapOf("foo" to "bar") 16 | assertThat { 17 | context.getContextKey("baz") 18 | }.isFailure().messageContains("The feature context key=baz was not found in the context. keys=[foo]") 19 | } 20 | 21 | @Test 22 | fun `should get good error message when context type is wrong`() { 23 | 24 | val context: FeatureContext = mapOf("foo" to "bar") 25 | assertThat { 26 | context.getContextKey("foo") 27 | }.isFailure().messageContains("The feature context key=foo was not the expected type class java.lang.String cannot be cast to class java.lang.Integer") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/sgoa.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "skatteetaten.no/v1", 3 | "kind": "StorageGridObjectArea", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "easy", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "easy", 13 | "app.kubernetes.io/name": "easy", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "easy-default", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "easy", 24 | "uid": "123-123" 25 | } 26 | ], 27 | "resourceVersion": "1489394588" 28 | }, 29 | "spec": { 30 | "bucketPostfix": "mybucket", 31 | "applicationDeploymentId": "1234567890", 32 | "objectArea": "default", 33 | "tryReuseCredentials": false 34 | }, 35 | "status": { 36 | "result": { 37 | "message": "nothing here", 38 | "reason": "SGOAProvisioned", 39 | "success": true 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/secret-sts.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "gillis.skatteetaten.no/app": "python", 7 | "gillis.skatteetaten.no/commonName": "org.test.python" 8 | }, 9 | "labels": { 10 | "operationScope": "aos-4016", 11 | "app": "python", 12 | "updatedBy": "hero", 13 | "updatedAt": "0", 14 | "lastUpdatedYear": "1970", 15 | "affiliation": "paas", 16 | "name": "python", 17 | "app.kubernetes.io/name": "python", 18 | "app.kubernetes.io/component": "backend", 19 | "stsRenewAfter": "1557313927", 20 | "booberDeployId": "deploy1" 21 | }, 22 | "name": "python-sts", 23 | "namespace": "paas-utv", 24 | "ownerReferences": [ 25 | { 26 | "apiVersion": "skatteetaten.no/v1", 27 | "kind": "ApplicationDeployment", 28 | "name": "python", 29 | "uid": "123-123" 30 | } 31 | ] 32 | }, 33 | "data": { 34 | "privatekey.key": "REMOVED_IN_TEST", 35 | "keystore.jks": "REMOVED_IN_TEST", 36 | "certificate.crt": "REMOVED_IN_TEST", 37 | "descriptor.properties": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/secret-sts.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "Secret", 4 | "metadata": { 5 | "annotations": { 6 | "gillis.skatteetaten.no/app": "simple", 7 | "gillis.skatteetaten.no/commonName": "org.test.simple" 8 | }, 9 | "labels": { 10 | "operationScope": "aos-4016", 11 | "app": "simple", 12 | "updatedBy": "hero", 13 | "updatedAt": "0", 14 | "lastUpdatedYear": "1970", 15 | "affiliation": "paas", 16 | "name": "simple", 17 | "app.kubernetes.io/name": "simple", 18 | "app.kubernetes.io/component": "backend", 19 | "stsRenewAfter": "1557313927", 20 | "booberDeployId": "deploy1" 21 | }, 22 | "name": "simple-sts", 23 | "namespace": "paas-utv", 24 | "ownerReferences": [ 25 | { 26 | "apiVersion": "skatteetaten.no/v1", 27 | "kind": "ApplicationDeployment", 28 | "name": "simple", 29 | "uid": "123-123" 30 | } 31 | ] 32 | }, 33 | "data": { 34 | "privatekey.key": "REMOVED_IN_TEST", 35 | "keystore.jks": "REMOVED_IN_TEST", 36 | "certificate.crt": "REMOVED_IN_TEST", 37 | "descriptor.properties": "REMOVED_IN_TEST" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/ah/imagestream.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "ah", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "ah", 13 | "app.kubernetes.io/name": "ah", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "ah", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "ah", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "dockerImageRepository": "docker-registry.aurora.sits.no:5000/aurora/atomhopper", 30 | "tags": [ 31 | { 32 | "from": { 33 | "kind": "DockerImage", 34 | "name": "docker-registry.aurora.sits.no:5000/aurora/atomhopper:1.3.4" 35 | }, 36 | "importPolicy": { 37 | "scheduled": true 38 | }, 39 | "name": "default" 40 | } 41 | ] 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/feature/JavaDeployFeature.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.feature 2 | 3 | import io.fabric8.kubernetes.api.model.Container 4 | import no.skatteetaten.aurora.boober.model.AuroraDeploymentSpec 5 | import no.skatteetaten.aurora.boober.model.PortNumbers 6 | import org.springframework.beans.factory.annotation.Value 7 | import org.springframework.stereotype.Service 8 | 9 | @Service 10 | class JavaDeployFeature(@Value("\${integrations.docker.registry}") val registry: String) : 11 | AbstractDeployFeature(registry) { 12 | override fun enable(platform: ApplicationPlatform) = platform == ApplicationPlatform.java 13 | 14 | override fun createContainers(adc: AuroraDeploymentSpec): List { 15 | return listOf( 16 | createContainer( 17 | adc, "${adc.name}-java", 18 | mapOf( 19 | "http" to PortNumbers.INTERNAL_HTTP_PORT, 20 | "management" to PortNumbers.INTERNAL_ADMIN_PORT, 21 | "jolokia" to PortNumbers.JOLOKIA_HTTP_PORT, 22 | "extra" to PortNumbers.EXTRA_APPLICATION_PORT 23 | ) 24 | ) 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/security/SpringSecurityThreadContextElement.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.security 2 | 3 | import kotlinx.coroutines.ThreadContextElement 4 | import org.springframework.security.core.context.SecurityContext 5 | import org.springframework.security.core.context.SecurityContextHolder 6 | import kotlin.coroutines.AbstractCoroutineContextElement 7 | import kotlin.coroutines.CoroutineContext 8 | 9 | class SpringSecurityThreadContextElement( 10 | val securityContext: SecurityContext = SecurityContextHolder.getContext() 11 | ) : ThreadContextElement, AbstractCoroutineContextElement(Key) { 12 | companion object Key : CoroutineContext.Key 13 | 14 | /** @suppress */ 15 | override fun updateThreadContext(context: CoroutineContext): SecurityContext { 16 | val oldState = SecurityContextHolder.getContext() 17 | SecurityContextHolder.setContext(securityContext) 18 | return oldState 19 | } 20 | 21 | /** @suppress */ 22 | override fun restoreThreadContext(context: CoroutineContext, oldState: SecurityContext) { 23 | SecurityContextHolder.setContext(oldState) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/route-bigip.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "bigipRoute": "true" 7 | }, 8 | "labels": { 9 | "operationScope": "aos-4016", 10 | "app": "komplex", 11 | "updatedBy": "hero", 12 | "updatedAt": "0", 13 | "lastUpdatedYear": "1970", 14 | "affiliation": "paas", 15 | "name": "komplex", 16 | "app.kubernetes.io/name": "komplex", 17 | "app.kubernetes.io/component": "backend", 18 | "app.kubernetes.io/part-of": "test-group", 19 | "app.openshift.io/runtime": "spring-boot", 20 | "booberDeployId": "deploy1" 21 | }, 22 | "name": "komplex-bigip", 23 | "namespace": "paas-utv", 24 | "ownerReferences": [ 25 | { 26 | "apiVersion": "skatteetaten.no/v1", 27 | "kind": "ApplicationDeployment", 28 | "name": "komplex", 29 | "uid": "123-123" 30 | } 31 | ] 32 | }, 33 | "spec": { 34 | "host": "74a691b9358d168e305df7a1ae175a5eefda6754.test", 35 | "port": { 36 | "targetPort": "http" 37 | }, 38 | "to": { 39 | "kind": "Service", 40 | "name": "komplex" 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/route-komplex-managed.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "applikasjonsfabrikken": "true", 16 | "azureManaged": "true", 17 | "app.kubernetes.io/part-of": "test-group", 18 | "app.openshift.io/runtime": "spring-boot", 19 | "booberDeployId": "deploy1" 20 | }, 21 | "name": "komplex-managed", 22 | "namespace": "paas-utv", 23 | "ownerReferences": [ 24 | { 25 | "apiVersion": "skatteetaten.no/v1", 26 | "kind": "ApplicationDeployment", 27 | "name": "komplex", 28 | "uid": "123-123" 29 | } 30 | ] 31 | }, 32 | "spec": { 33 | "host": "complex-utv.amutv.skead.no", 34 | "port": { 35 | "targetPort": "http" 36 | }, 37 | "to": { 38 | "kind": "Service", 39 | "name": "komplex" 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/easy/imagestream.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "easy", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "easy", 13 | "app.kubernetes.io/name": "easy", 14 | "app.kubernetes.io/component": "backend", 15 | "releasedVersion": "1", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "easy", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "easy", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "spec": { 30 | "dockerImageRepository": "docker.registry:5000/org_test/simple", 31 | "tags": [ 32 | { 33 | "from": { 34 | "kind": "DockerImage", 35 | "name": "docker.registry:5000/org_test/simple:1" 36 | }, 37 | "importPolicy": { 38 | "scheduled": true 39 | }, 40 | "name": "default" 41 | } 42 | ] 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/complex/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "komplex", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "komplex", 13 | "app.kubernetes.io/name": "komplex", 14 | "app.kubernetes.io/component": "backend", 15 | "app.kubernetes.io/part-of": "test-group", 16 | "app.openshift.io/runtime": "spring-boot", 17 | "booberDeployId": "deploy1" 18 | }, 19 | "name": "komplex", 20 | "namespace": "paas-utv", 21 | "ownerReferences": [ 22 | { 23 | "apiVersion": "skatteetaten.no/v1", 24 | "kind": "ApplicationDeployment", 25 | "name": "komplex", 26 | "uid": "123-123" 27 | } 28 | ] 29 | }, 30 | "spec": { 31 | "host": "komplex-paas-utv.test", 32 | "port": { 33 | "targetPort": "http" 34 | }, 35 | "tls": { 36 | "insecureEdgeTerminationPolicy": "Allow", 37 | "termination": "edge" 38 | }, 39 | "to": { 40 | "kind": "Service", 41 | "name": "komplex" 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/python/imagestream.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "python", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "python", 13 | "app.kubernetes.io/name": "python", 14 | "app.kubernetes.io/component": "backend", 15 | "releasedVersion": "1", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "python", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "python", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "spec": { 30 | "dockerImageRepository": "docker.registry:5000/org_test/python", 31 | "tags": [ 32 | { 33 | "from": { 34 | "kind": "DockerImage", 35 | "name": "docker.registry:5000/org_test/python:1" 36 | }, 37 | "importPolicy": { 38 | "scheduled": true 39 | }, 40 | "name": "default" 41 | } 42 | ] 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/simple/imagestream.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "simple", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "simple", 13 | "app.kubernetes.io/name": "simple", 14 | "app.kubernetes.io/component": "backend", 15 | "releasedVersion": "1", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "simple", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "simple", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "spec": { 30 | "dockerImageRepository": "docker.registry:5000/org_test/simple", 31 | "tags": [ 32 | { 33 | "from": { 34 | "kind": "DockerImage", 35 | "name": "docker.registry:5000/org_test/simple:1" 36 | }, 37 | "importPolicy": { 38 | "scheduled": true 39 | }, 40 | "name": "default" 41 | } 42 | ] 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/template/imagestream-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "template", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "template", 13 | "app.kubernetes.io/name": "template", 14 | "app.kubernetes.io/component": "backend", 15 | "booberDeployId": "deploy1" 16 | }, 17 | "name": "template", 18 | "namespace": "paas-utv", 19 | "ownerReferences": [ 20 | { 21 | "apiVersion": "skatteetaten.no/v1", 22 | "kind": "ApplicationDeployment", 23 | "name": "template", 24 | "uid": "123-123" 25 | } 26 | ] 27 | }, 28 | "spec": { 29 | "dockerImageRepository": "docker-registry.aurora.sits.no:5000/aurora/atomhopper", 30 | "tags": [ 31 | { 32 | "from": { 33 | "kind": "DockerImage", 34 | "name": "docker-registry.aurora.sits.no:5000/aurora/atomhopper:1" 35 | }, 36 | "importPolicy": { 37 | "scheduled": true 38 | }, 39 | "name": "default" 40 | } 41 | ] 42 | } 43 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/OpenShiftCommandServiceTest/webseal-route-generated.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "route.openshift.io/v1", 3 | "kind": "Route", 4 | "metadata": { 5 | "annotations": { 6 | "marjory.sits.no/isOpen": "false", 7 | "marjory.sits.no/route.roles": "Foo,Bar" 8 | }, 9 | "creationTimestamp": "2019-02-14T08:29:50Z", 10 | "labels": { 11 | "affiliation": "paas", 12 | "app": "ref", 13 | "booberDeployId": "bee6c47", 14 | "updatedBy": "m89870" 15 | }, 16 | "name": "ref4", 17 | "namespace": "paas-bjarte-dev", 18 | "ownerReferences": [ 19 | { 20 | "apiVersion": "skatteetaten.no/v1", 21 | "kind": "ApplicationDeployment", 22 | "name": "ref", 23 | "uid": "b95463b4-302c-11e9-a70b-005056833ec1" 24 | } 25 | ], 26 | "resourceVersion": "502259548", 27 | "selfLink": "/apis/route.openshift.io/v1/namespaces/paas-bjarte-dev/routes/ref4", 28 | "uid": "b2391b03-3032-11e9-8fd1-00505683244e" 29 | }, 30 | "spec": { 31 | "host": "foobar.paas-bjarte-dev.utv.paas.skead.no", 32 | "to": { 33 | "kind": "Service", 34 | "name": "ref", 35 | "weight": 100 36 | }, 37 | "wildcardPolicy": "None" 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/samples/result/utv/pv/imagestream-postgres.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "labels": { 6 | "operationScope": "aos-4016", 7 | "app": "pv", 8 | "updatedBy": "hero", 9 | "updatedAt": "0", 10 | "lastUpdatedYear": "1970", 11 | "affiliation": "paas", 12 | "name": "postgres", 13 | "app.kubernetes.io/name": "pv", 14 | "app.kubernetes.io/component": "backend", 15 | "template": "aurora-postgres-ocp4-pv", 16 | "booberDeployId": "deploy1" 17 | }, 18 | "name": "postgres", 19 | "namespace": "paas-utv", 20 | "ownerReferences": [ 21 | { 22 | "apiVersion": "skatteetaten.no/v1", 23 | "kind": "ApplicationDeployment", 24 | "name": "pv", 25 | "uid": "123-123" 26 | } 27 | ] 28 | }, 29 | "spec": { 30 | "dockerImageRepository": "localhost/aurora/aurora-postgres", 31 | "tags": [ 32 | { 33 | "from": { 34 | "kind": "DockerImage", 35 | "name": "localhost/aurora/aurora-postgres:13" 36 | }, 37 | "importPolicy": { 38 | "scheduled": true 39 | }, 40 | "name": "default" 41 | } 42 | ] 43 | } 44 | } -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/facade/DeployFacadeTest/herkimerResponseBucketAdminSG.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": true, 3 | "message": "OK", 4 | "items": [ 5 | { 6 | "id": "1", 7 | "name": "default", 8 | "kind": "StorageGridObjectArea", 9 | "ownerId": "1234567890", 10 | "claims": [ 11 | { 12 | "id": "1", 13 | "ownerId": "1234567890", 14 | "resourceId": 1, 15 | "name": "ADMIN", 16 | "credentials": { 17 | "tenantName": "", 18 | "serviceEndpoint": "", 19 | "accessKey": "", 20 | "secretKey": "", 21 | "bucketName": "", 22 | "objectPrefix": "", 23 | "username": "", 24 | "password": "", 25 | "bucketRegion": "" 26 | }, 27 | "createdDate": "2020-09-29T16:04:53.687", 28 | "modifiedDate": "2020-09-29T16:04:53.687", 29 | "createdBy": "aurora", 30 | "modifiedBy": "aurora" 31 | } 32 | ], 33 | "createdDate": "2020-09-29T16:03:26.539", 34 | "modifiedDate": "2020-09-29T16:03:26.539", 35 | "createdBy": "aurora", 36 | "modifiedBy": "aurora" 37 | } 38 | ], 39 | "errors": [], 40 | "count": 1 41 | } -------------------------------------------------------------------------------- /src/test/kotlin/no/skatteetaten/aurora/boober/controller/v1/AuroraConfigNamesControllerV1Test.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.v1 2 | 3 | import com.ninjasquad.springmockk.MockkBean 4 | import io.mockk.every 5 | import no.skatteetaten.aurora.boober.facade.AuroraConfigFacade 6 | import no.skatteetaten.aurora.mockmvc.extensions.Path 7 | import no.skatteetaten.aurora.mockmvc.extensions.get 8 | import no.skatteetaten.aurora.mockmvc.extensions.responseJsonPath 9 | import no.skatteetaten.aurora.mockmvc.extensions.statusIsOk 10 | import org.junit.jupiter.api.Test 11 | import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest 12 | 13 | @WebMvcTest(controllers = [AuroraConfigNamesControllerV1::class]) 14 | class AuroraConfigNamesControllerV1Test : AbstractControllerTest() { 15 | 16 | @MockkBean 17 | private lateinit var facade: AuroraConfigFacade 18 | 19 | @Test 20 | fun `Return aurora config names`() { 21 | every { 22 | facade.findAllAuroraConfigNames() 23 | } returns listOf("paas") 24 | 25 | mockMvc.get(Path("/v1/auroraconfignames")) { 26 | statusIsOk() 27 | responseJsonPath("$.success").isTrue() 28 | responseJsonPath("$.items.length()").equalsValue(1) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/kotlin/no/skatteetaten/aurora/boober/controller/internal/responses.kt: -------------------------------------------------------------------------------- 1 | package no.skatteetaten.aurora.boober.controller.internal 2 | 3 | import com.fasterxml.jackson.annotation.JsonGetter 4 | 5 | // TODO: Should this be HAL resource? 6 | // TODO: this should not use Any. 7 | data class Response( 8 | val success: Boolean = true, 9 | val message: String = "OK", 10 | val items: List = emptyList(), 11 | val count: Int = items.size 12 | ) { 13 | constructor(item: Any) : this(items = listOf(item)) 14 | } 15 | 16 | data class ErrorsResponse( 17 | val success: Boolean = true, 18 | val message: String = "OK", 19 | val items: List = emptyList(), 20 | val errors: List = emptyList(), 21 | val count: Int = items.size 22 | ) 23 | 24 | data class KeyValueResponse( 25 | val success: Boolean = true, 26 | val message: String = "OK", 27 | val items: Map = emptyMap(), 28 | val count: Int = items.size 29 | ) { 30 | @JsonGetter("items") 31 | fun getArrayItems() = items.entries 32 | } 33 | 34 | data class SingleResponse( 35 | val success: Boolean = true, 36 | val message: String = "OK", 37 | val items: T, 38 | val count: Int = 1 39 | ) { 40 | @JsonGetter("items") 41 | fun getArrayItems() = listOf(items) 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/no/skatteetaten/aurora/boober/unit/ResourceMergerTest/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Service", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "referanse", 6 | "namespace": "foobar", 7 | "selfLink": "/api/v1/namespaces/paas-boober2/services/referanse", 8 | "uid": "f26f3ce3-1eb0-11e7-8cd7-00505683244e", 9 | "resourceVersion": "48386007", 10 | "creationTimestamp": "2017-04-11T12:18:18Z", 11 | "labels": { 12 | "affiliation": "paas", 13 | "app": "referanse", 14 | "updatedBy": "m89870" 15 | }, 16 | "annotations": { 17 | "prometheus.io/path": "/prometheus", 18 | "prometheus.io/port": "8082", 19 | "prometheus.io/scheme": "http", 20 | "prometheus.io/scrape": "true", 21 | "sprocket.sits.no/service.webseal": "", 22 | "sprocket.sits.no/service.webseal-roles": "" 23 | } 24 | }, 25 | "spec": { 26 | "ports": [ 27 | { 28 | "name": "http", 29 | "protocol": "TCP", 30 | "port": 80, 31 | "targetPort": 8080 32 | } 33 | ], 34 | "selector": { 35 | "name": "referanse" 36 | }, 37 | "clusterIP": "172.30.112.202", 38 | "type": "ClusterIP", 39 | "sessionAffinity": "None" 40 | }, 41 | "status": { 42 | "loadBalancer": {} 43 | } 44 | } 45 | --------------------------------------------------------------------------------