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

Feat 646 kubernetes1.25 #652

Merged
merged 29 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8d544fc
Feat: initial start with k8s 1.25 migration
commjoen Feb 24, 2023
1e9a657
bump to k8s 1.25.6 in workflows
commjoen Feb 24, 2023
d65e6c3
Feat(646): Adding PSA to k8s def files
commjoen Feb 25, 2023
fceb323
Merge branch 'master' into kubernetes1.25
commjoen Feb 25, 2023
1762218
feat(646): Update required config for minikube configration part 2
commjoen Feb 25, 2023
f224a8c
feat(1.25): updated namespaced creation of vault as vault needs diffe…
commjoen Feb 25, 2023
5d6f69a
feat(1.25): updated vault liveiness checks as we have to test after e…
commjoen Feb 25, 2023
d63e1b2
feat(646): adding service account, BUT CONFIG OF APP NEEDS TO BE UPDA…
commjoen Feb 25, 2023
152d38d
feat(646): First working setup for k8s minikube vault done, now prepa…
commjoen Feb 26, 2023
0ec5ebb
Merge branch 'master' into kubernetes1.25
commjoen Feb 26, 2023
9bb8c66
feat(646): complete okteto setup: we cannot do anything with workspac…
commjoen Feb 26, 2023
ded43e2
Feat(636): fix docs
commjoen Feb 26, 2023
352aa63
feat(646): make http the same for all providers
commjoen Feb 28, 2023
ea23302
Merge branch 'master' into kubernetes1.25
commjoen Feb 28, 2023
cd24d01
feat(646): make precommit happy :(
commjoen Feb 28, 2023
c895d08
fix(646): fix readmes again....
commjoen Feb 28, 2023
0ded8ce
build(deps): update hashicorp/google-beta requirement from ~> 4.54.0 …
dependabot[bot] Mar 1, 2023
aaf1c67
build(deps): update hashicorp/google requirement from ~> 4.54.0 to ~>…
dependabot[bot] Mar 1, 2023
29dafe6
Merge branch 'master' into feat-646-kubernetes1.25
commjoen Mar 3, 2023
d85bd37
Merge pull request #660 from OWASP/dependabot/terraform/gcp/hashicorp…
commjoen Mar 4, 2023
68983fc
Merge pull request #659 from OWASP/dependabot/terraform/gcp/hashicorp…
commjoen Mar 4, 2023
5f01a06
Merge branch 'master' into feat-646-kubernetes1.25
commjoen Mar 4, 2023
28d4470
Feat(#646): updated centralized vault upgrade script, migrated GCP to…
commjoen Mar 4, 2023
93aa614
Merge branch 'master' into feat-646-kubernetes1.25
commjoen Mar 4, 2023
c4b8bfa
Feat(#646): updated gcp docs
commjoen Mar 4, 2023
d7976cc
feat(#646): Started Azure migration (Found out we have to migrate to …
commjoen Mar 4, 2023
43e3273
feat(#646): Got Kubernetes 1.25 working in Azure using audit with aad…
commjoen Mar 5, 2023
c4572cf
fix: add terraform lockfiles
bendehaan Mar 6, 2023
a3e5a6a
fix: fix AWS setup for k8s 1.25
bendehaan Mar 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/minikube-k8s-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ jobs:
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.28.0
minikube-version: 1.29.0
driver: docker
kubernetes-version: v1.23.12
kubernetes-version: v1.25.6
- name: test script
run: |
kubectl apply -f k8s/workspace-psa.yml
kubectl apply -f k8s/secrets-config.yml
kubectl apply -f k8s/secrets-secret.yml
kubectl apply -f k8s/secret-challenge-deployment.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/minikube-vault-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.28.0
minikube-version: 1.29.0
driver: docker
kubernetes-version: v1.23.12
kubernetes-version: v1.25.6
- name: Setup helm
uses: azure/[email protected]
id: install
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.DS_STORE
.DS_Store
target

.vscode
Expand All @@ -43,8 +43,7 @@ root_token
# Terraform
kubeconfig_wrongsecrets-exercise-cluster
.terraform
.terraform.lock.hcl
.terraform*
.terraform
terraform.tfstate*
aws/terraform.tfstate.*
aws/terraform.tfstate.backup
Expand All @@ -66,6 +65,8 @@ azure/k8s/pod-id.yml
# Challenge 17
.github/scripts/thirdkey.txt

yourkey.txt

# Node JS
js/node/
js/node_modules/
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,16 @@ For development on local machine use the `local` profile `./mvnw spring-boot:run
If you want to test against vault without K8s: start vault locally with

```shell
export VAULT_ADDR='http://127.0.0.1:8200'
export SPRING_CLOUD_VAULT_URI='http://127.0.0.1:8200'
export VAULT_API_ADDR='http://127.0.0.1:8200'
vault server -dev
```

and in your next terminal, do (with the token from the previous commands):

```shell
export VAULT_ADDR='http://127.0.0.1:8200'
export VAULT_TOKEN='<TOKENHERE>'
export SPRING_CLOUD_VAULT_URI='http://127.0.0.1:8200'
export SPRING_CLOUD_VAULT_TOKEN='<TOKENHERE>'
vault token create -id="00000000-0000-0000-0000-000000000000" -policy="root"
vault kv put secret/secret-challenge vaultpassword.password="$(openssl rand -base64 16)"
```
Expand Down
145 changes: 145 additions & 0 deletions aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ The documentation below is auto-generated to give insight on what's created via

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.56.0 |
| <a name="provider_http"></a> [http](#provider\_http) | ~> 3.2.1 |
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.4.3 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.56.0 |
| <a name="provider_http"></a> [http](#provider\_http) | 3.2.1 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.4.3 |

## Modules

Expand Down Expand Up @@ -154,7 +154,7 @@ The documentation below is auto-generated to give insight on what's created via
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The EKS cluster name | `string` | `"wrongsecrets-exercise-cluster"` | no |
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | The EKS cluster version to use | `string` | `"1.23"` | no |
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | The EKS cluster version to use | `string` | `"1.25"` | no |
| <a name="input_region"></a> [region](#input\_region) | The AWS region to use | `string` | `"eu-west-1"` | no |

## Outputs
Expand Down
3 changes: 3 additions & 0 deletions aws/k8s-vault-aws-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ AWS_REGION="eu-west-1"
echo "This is a script to bootstrap the configuration. You need to have installed: helm, kubectl, jq, vault, grep, cat, sed, and awscli, and is only tested on mac, Debian and Ubuntu"
echo "This script is based on the steps defined in https://learn.hashicorp.com/tutorials/vault/kubernetes-minikube. Vault is awesome!"

echo "Setting up workspace PSA to restricted for default"
kubectl apply -f ../k8s/workspace-psa.yml

kubectl get configmaps | grep 'secrets-file' &>/dev/null
if [ $? == 0 ]; then
echo "secrets config is already installed"
Expand Down
35 changes: 21 additions & 14 deletions aws/k8s/secret-challenge-vault-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ spec:
runAsUser: 2000
runAsGroup: 2000
fsGroup: 2000
seccompProfile:
type: RuntimeDefault
serviceAccountName: vault
volumes:
- name: 'ephemeral'
emptyDir: { }
- name: "ephemeral"
emptyDir: {}
- name: secrets-store-inline
csi:
driver: secrets-store.csi.k8s.io
Expand All @@ -46,34 +48,39 @@ spec:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: '/actuator/health/readiness'
path: "/actuator/health/readiness"
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 5
failureThreshold: 8
livenessProbe:
httpGet:
path: '/actuator/health/liveness'
path: "/actuator/health/liveness"
port: 8080
initialDelaySeconds: 35
timeoutSeconds: 30
periodSeconds: 40
failureThreshold: 5
resources:
requests:
memory: '512Mi'
cpu: '200m'
ephemeral-storage: '1Gi'
memory: "512Mi"
cpu: "200m"
ephemeral-storage: "1Gi"
limits:
memory: '512Mi'
cpu: '1200m'
ephemeral-storage: '2Gi'
memory: "512Mi"
cpu: "1200m"
ephemeral-storage: "2Gi"
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
Expand All @@ -89,16 +96,16 @@ spec:
secretKeyRef:
name: funnystuff
key: funnier
- name: VAULT_ADDR
value: "http://vault:8200"
- name: SPRING_CLOUD_VAULT_URI
value: "http://vault.vault.svc.cluster.local:8200"
- name: JWT_PATH
value: "/var/run/secrets/kubernetes.io/serviceaccount/token"
volumeMounts:
- name: secrets-store-inline
mountPath: "/mnt/secrets-store"
readOnly: true
- name: 'ephemeral'
mountPath: '/tmp'
- name: "ephemeral"
mountPath: "/tmp"
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
Expand Down
4 changes: 2 additions & 2 deletions aws/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cluster_version = "1.23"
region = "eu-west-1"
# Edit this if you want a different region, e.g., us-east-1
# region = "eu-west-1"
2 changes: 1 addition & 1 deletion aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "region" {
variable "cluster_version" {
description = "The EKS cluster version to use"
type = string
default = "1.23"
default = "1.25"
}

variable "cluster_name" {
Expand Down
Loading