Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved K8s to base and Upgraded Bamboo #43

Merged
merged 10 commits into from
Aug 26, 2023
Merged

Moved K8s to base and Upgraded Bamboo #43

merged 10 commits into from
Aug 26, 2023

Conversation

saidsef
Copy link
Owner

@saidsef saidsef commented Aug 24, 2023

  • Moved Bamboo kubernetes deployment to base directory this will standardise deployments
  • Moved kubernetes kustomizer resource to point to base directory
  • Upgraded Bamboo to version 9.2.4 LTS
  • Moved Kubernetes files to base

@saidsef saidsef added enhancement security security updates labels Aug 24, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 24, 2023
@saidsef saidsef added preview preview and removed preview preview labels Aug 24, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
@saidsef
Copy link
Owner Author

saidsef commented Aug 25, 2023

Due to K8s deployment readOnlyRootFilesystem being set to true during startup it throws error as logs can no longer be written to disk.

To resolve this, either move the logs to ephemeral storage path - logs path /opt/atlassian-bamboo-9.2.4/logs/ - or better yet push the logs to stdout

github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
This best practice applys the securityContext to all container in the deployment and reduces code duplications

Updated Kubernetes deployment spec set readOnlyRootFilesystem and increased initialDelaySeconds

Added apk package curl for internal use, updated folder path name by making it consistent

moved Bamboo logs to ephemeral storage

U[dated Kubernetes deployment manifest to include resources - this is to define resource specs, and added JAVA min max and opts from system resource

foo
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 25, 2023
github-actions[bot]
github-actions bot previously approved these changes Aug 26, 2023
…eServiceLinks

This improves our security posture
@saidsef
Copy link
Owner Author

saidsef commented Aug 26, 2023

🤖

Review Summary

The PR contains several changes related to the Bamboo Kubernetes deployment and Dockerfile. The changes are generally well-structured and follow good practices. However, there are a few areas that could be improved or need attention.

Dockerfile

  1. The Dockerfile has been updated to use a slim version of OpenJDK 11. This is a good practice as it reduces the image size. However, it's important to ensure that all dependencies required by Bamboo are still met with this base image.

  2. The Dockerfile now includes the installation of procps, wget, and curl. It's good to see that the Dockerfile is being kept up-to-date with necessary dependencies. However, it's important to ensure that these tools are actually required for the operation of the Bamboo server. If they are not, they should be removed to keep the image as small and secure as possible.

  3. The Dockerfile now includes a step to remove the APT lists after installing packages. This is a good practice as it reduces the image size.

  4. The Dockerfile now includes a step to remove unnecessary packages after installing Bamboo. This is a good practice as it reduces the image size.

  5. The Dockerfile now includes a step to change the ownership of the Bamboo directory to the nobody user. This is a good practice as it reduces the potential for privilege escalation attacks.

Kubernetes Deployment

  1. The Kubernetes deployment now includes a security context at the pod level. This is a good practice as it applies security settings to all containers in the pod.

  2. The Kubernetes deployment now includes resource limits for the Bamboo container. This is a good practice as it prevents the container from consuming excessive resources.

  3. The Kubernetes deployment now includes several new volume mounts. It's important to ensure that these mounts are necessary and that they do not expose sensitive data.

  4. The Kubernetes deployment now disables the automatic mounting of the service account token and service links. This is a good practice as it reduces the potential for privilege escalation attacks.

  5. The Kubernetes deployment now includes a readiness probe with an initial delay of 10 seconds. This may be too short for the Bamboo server to start up, especially if it needs to perform initial setup tasks. Consider increasing this delay to a more conservative value.

  6. The Kubernetes deployment now includes a liveness probe with an initial delay of 10 seconds. This may be too short for the Bamboo server to start up, especially if it needs to perform initial setup tasks. Consider increasing this delay to a more conservative value.

Suggestions

  1. Dockerfile: Consider verifying whether procps, wget, and curl are necessary for the operation of the Bamboo server. If they are not, remove them from the Dockerfile.

  2. Kubernetes Deployment: Consider increasing the initial delay for the readiness and liveness probes to a more conservative value.

  3. Kubernetes Deployment: Consider verifying whether the new volume mounts are necessary and whether they expose sensitive data.

Example Code

# Dockerfile
FROM docker.io/openjdk:11-slim

# Only install necessary dependencies
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -yq wget && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get autoremove -y
# Kubernetes Deployment
spec:
  template:
    spec:
      containers:
      - name: bamboo
        readinessProbe:
          initialDelaySeconds: 30
        livenessProbe:
          initialDelaySeconds: 30

Overall, the PR is well-structured and follows good practices. With a few minor adjustments, it should be ready for merging.

> gpt-4

@saidsef saidsef added the preview preview label Aug 26, 2023
@saidsef saidsef merged commit f0bb4b8 into main Aug 26, 2023
4 checks passed
@saidsef saidsef deleted the k8s-base branch August 26, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement preview preview security security updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant