Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ggilmore committed Sep 16, 2020
1 parent c789f04 commit ae4338e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20,410 deletions.
2 changes: 1 addition & 1 deletion justfile
@@ -1,4 +1,4 @@
all: check build format lint freeze
all: check freeze format lint build

build: render-ci-pipeline

Expand Down
10 changes: 7 additions & 3 deletions src/k8s/components/frontend/configuration/internal.dhall
@@ -1,7 +1,11 @@
let Kubernetes/SecurityContext =
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/1.18/schemas/io.k8s.api.core.v1.SecurityContext.dhall sha256:ebd2dfc83e8a5bec031f3d71e9c5bf2ac583ab56572f8d7f3a8f9c9f113e3a0a

let Simple/Frontend = ../../../../simple/frontend/package.dhall
let Simple = (../../../../simple/frontend/package.dhall).Containers

let simpleFrontend = Simple.frontend

let simpleInternal = Simple.frontendInternal

let sharedConfiguration = ./shared.dhall

Expand All @@ -18,12 +22,12 @@ let FrontendContainer =
{ Type = ContainerConfiguration.Type
, default =
ContainerConfiguration.default
with image = Simple/Frontend.Containers.frontend.image
with image = simpleFrontend.image
}

let InternalContainer =
FrontendContainer
with default.image = Simple/Frontend.Containers.frontendInternal.image
with default.image = simpleInternal.image

let Containers =
{ Type =
Expand Down
41 changes: 20 additions & 21 deletions src/k8s/components/frontend/configuration/toInternal.dhall
Expand Up @@ -5,52 +5,51 @@ let Configuration/global = ../../../configuration/global.dhall

let Configuration/internal = ./internal.dhall

let util = ../../../../util/package.dhall
let Image/manipulate = (../../../../util/package.dhall).Image/manipulate

let nonRootSecurityContext =
Kubernetes/SecurityContext::{
, runAsUser = Some 100
, runAsGroup = Some 101
, allowPrivilegeEscalation = Some False
}

let toInternal
: (cg : Configuration/global.Type) Configuration/internal.Type
= λ(cg : Configuration/global.Type)
let globalOpts = cg.Global

let security =
let securityContext =
if globalOpts.nonRoot
then Some
Kubernetes/SecurityContext::{
, runAsUser = Some 100
, runAsGroup = Some 101
, allowPrivilegeEscalation = Some False
}
then Some nonRootSecurityContext
else None Kubernetes/SecurityContext.Type

let cgContainers = cg.Frontend.Deployment.Containers

let manipulate/options = globalOpts.ImageManipulations

let frontendImage =
util.Image/manipulate
manipulate/options
cgContainers.Frontend.image
Image/manipulate manipulate/options cgContainers.Frontend.image

let internalImage =
util.Image/manipulate
Image/manipulate
manipulate/options
cgContainers.FrontendInteral.image

let FrontendConfig =
cg.Frontend.Deployment.Containers.Frontend
with image = frontendImage
with securityContext = security
with securityContext = securityContext

let InternalConfig =
cg.Frontend.Deployment.Containers.FrontendInteral
with image = internalImage
with securityContext = security

in { namespace = globalOpts.namespace
, Deployment.Containers
=
{ Frontend = FrontendConfig, FrontendInternal = InternalConfig }
}
: Configuration/internal.Type
with securityContext = securityContext

in { namespace = globalOpts.namespace
, Deployment.Containers
=
{ Frontend = FrontendConfig, FrontendInternal = InternalConfig }
}

in toInternal
4 changes: 2 additions & 2 deletions src/k8s/components/frontend/configuration/user.dhall
@@ -1,10 +1,10 @@
let sharedConfiguration = ./shared.dhall
let ContainerConfiguration = (./shared.dhall).ContainerConfiguration

let Simple/Frontend/Containers =
(../../../../simple/frontend/package.dhall).Containers

let FrontendContainer =
sharedConfiguration.ContainerConfiguration
ContainerConfiguration
with default.image = Simple/Frontend/Containers.frontend.image

let InternalContainer =
Expand Down

0 comments on commit ae4338e

Please sign in to comment.