Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

feat: added capability to configure staging serviceaccount name #1494

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

jbuns
Copy link
Collaborator

@jbuns jbuns commented Oct 19, 2020

Added the capability to configure servicaccountname for eirini staging job and eirini apps.

Description

Add to default eirini configuration the entry staging_service_account for configuring eirini staging job serviceaccount name. Also updated to allow same configuration for application_service_account in default eirini configuration for consistency.

Motivation and Context

We’ve been trying to test kubecf 2.5.8 and noticed that the eirini staging jobs doesn’t use serviceAccountName: eirini anymore and also annotation seccomp.security.alpha.kubernetes.io/pod: runtime/default has been added. Since we’re running on OpenShift, the setting of the annotation causes permission denied errors and we can’t fix this because there’s no serviceAccountName to configure/attach a SecurityContextConstraints for.

It was suggested by eirini-dev to configure field staging_service_account in order to fix this.

How Has This Been Tested?

Tested locally using kubecf version 2.5.8 and cf-operator version 6.1.17+0.gec409fd7.

Screenshot of serviceaccountname in staging job:
Screenshot 2020-10-19 at 15 34 37

Which allows us to configure a SecurityContextConstraints and push an app:

cf push nodejs-sample-1
Pushing app nodejs-sample-1 to org demo-org / space demo-space as admin...
Applying manifest file ../nodejs/manifest.yml...
Manifest applied
Packaging files to upload...
Uploading files...
 968 B / 968 B [======================================================================================================================================================] 100.00% 1s

Waiting for API to complete processing files...

Staging app and tracing logs...
   2020/10/19 14:34:25 Installing dependencies
   2020/10/19 14:35:27 Cleaning cache dir
   2020/10/19 14:35:27 Detecting buildpack
   -----> Nodejs Buildpack version 1.7.25
   -----> Installing binaries
   engines.node (package.json): 10.x
   engines.npm (package.json): 6.x
   -----> Installing node 10.22.0
   Download [https://buildpacks.cloudfoundry.org/dependencies/node/node_10.22.0_linux_x64_cflinuxfs3_43616969.tgz]
   npm 6.14.6 already installed with node
   -----> Installing yarn 1.22.4
   Download [https://buildpacks.cloudfoundry.org/dependencies/yarn/yarn-1.22.4-any-stack-24ca2294.tgz]
   Installed yarn 1.22.4
   -----> Creating runtime environment
   PRO TIP: It is recommended to vendor the application's Node.js dependencies
   Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
   NODE_ENV=production
   NODE_HOME=/tmp/contents812490370/deps/0/node
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false
   NPM_CONFIG_LOGLEVEL=error
   NPM_CONFIG_PRODUCTION=true
   -----> Building dependencies
   Installing node modules (package.json + package-lock.json)
   up to date in 0.4s
   found 0 vulnerabilities
   
   Contrast Security no credentials found. Will not write environment files.
   2020/10/19 14:35:34 Building droplet release
   2020/10/19 14:35:34 Creating app artifact

Waiting for app nodejs-sample-1 to start...

Instances starting...

name:                nodejs-sample-1
requested state:     started
isolation segment:   placeholder
routes:              nodejs-sample-1-hilarious-bandicoot-qb.169.55.130.195.nip.io
last uploaded:       Mon 19 Oct 15:35:52 BST 2020
stack:               cflinuxfs3
buildpacks:          
isolation segment:   placeholder
	name               version   detect output   buildpack name
	nodejs_buildpack   1.7.25    nodejs          nodejs

type:            web
sidecars:        
instances:       1/1
memory usage:    256M
start command:   node web.js
     state     since                  cpu    memory      disk       details
#0   running   2020-10-19T14:36:01Z   0.0%   0 of 256M   4K of 1G  

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code has security implications.
  • [ x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@@ -60,7 +60,8 @@ data:
server_key_path: "/workspace/jobs/opi/secrets/eirini-server.key"
tls_port: 8085
disk_limit_mb: {{ .Values.eirini.opi.disk_limit_mb }}
application_service_account: eirini
application_service_account: {{ .Values.eirini.opi.staging.application_service_account }}
staging_service_account: {{ .Values.eirini.opi.staging.staging_service_account }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to leave the default for staging_service_account set to null and then use the default function to fall back on application_service_account:

staging_service_account: {{ default .Values.eirini.opi.staging.application_service_account .Values.eirini.opi.staging.staging_service_account }}

That way you can overwrite both values with a single setting, if they are still the same name.

@jbuns jbuns merged commit d3f54b9 into master Oct 19, 2020
@jbuns jbuns deleted the add-eirini-sa branch October 19, 2020 16:54
@fargozhu fargozhu added this to the 2.6.0 milestone Oct 20, 2020
@fargozhu fargozhu added the changelog Issue must be present in the release notes. label Oct 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
changelog Issue must be present in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants