Skip to content

Commit

Permalink
feat: make compatible with k8s 1.29 (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
CasLubbers committed Jun 10, 2024
1 parent dbca465 commit 8f911d6
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-on-schedule-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
with:
install_profile: upgrade
generate_password: 'yes'
kubernetes_versions: "['1.26']"
kubernetes_versions: "['1.29']"
6 changes: 2 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ on:
description: 'Kubernetes version'
type: choice
options:
- "['1.24']"
- "['1.25']"
- "['1.26']"
- "['1.27']"
- "['1.28']"
default: "['1.28']"
- "['1.29']"
default: "['1.29']"
install_profile:
description: Otomi installation profile
default: minimal-with-team
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM otomi/tools:v2.2.0 as ci
FROM otomi/tools:v2.3.0 as ci

ENV APP_HOME=/home/app/stack

Expand Down Expand Up @@ -27,7 +27,7 @@ FROM ci as clean
RUN npm prune --production

#-----------------------------
FROM otomi/tools:v2.2.0 as prod
FROM otomi/tools:v2.3.0 as prod

ENV APP_HOME=/home/app/stack
ENV ENV_DIR=/home/app/stack/env
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Otomi turns any Kubernetes cluster into an Application Platform to provide paved

To install Otomi, make sure to have a K8s cluster running with at least:

- Version `1.25`, `1.26` or `1.27`
- Version `1.27`, `1.28` or `1.29`
- A node pool with at least **8 vCPU** and **16GB+ RAM** (more resources might be required based on the activated capabilities)
- Calico CNI installed (or any other CNI that supports K8s network policies)
- A default storage class configured
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"test:ts": "ENV_DIR=$PWD/tests/fixtures NODE_ENV=test jest",
"test:ts-cov": "jest --coverage",
"validate-templates": "ENV_DIR=$PWD/tests/fixtures NODE_ENV=test binzx/otomi validate-templates",
"validate-templates:all": "set -e; i=25; while [ $i -le 28 ]; do NODE_ENV=test binzx/otomi validate-templates -k 1.$i; i=$(($i+1)); done",
"validate-templates:all": "set -e; i=25; while [ $i -le 29 ]; do NODE_ENV=test binzx/otomi validate-templates -k 1.$i; i=$(($i+1)); done",
"validate-values": "ENV_DIR=$PWD/tests/fixtures NODE_ENV=test binzx/otomi validate-values",
"bootstrap-dev": "rm -rf /tmp/otomi-bootstrap-dev; CI=1 VALUES_INPUT=$PWD/tests/bootstrap/input.yaml ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi bootstrap",
"bootstrap-dev-with-repo": "CI=1 ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi bootstrap"
Expand Down
2 changes: 1 addition & 1 deletion schemas/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Running k8s cluster (e.g.: minikube)
1. Collect api versions

```
kubectl api-versions > api-versions/<my-version>
kubectl api-versions > schemas/api-versions/<my-version>
```

# schemas/v1.XX-standalone.tar.gz
Expand Down
23 changes: 23 additions & 0 deletions schemas/api-versions/1.29.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
admissionregistration.k8s.io/v1
apiextensions.k8s.io/v1
apiregistration.k8s.io/v1
apps/v1
authentication.k8s.io/v1
authorization.k8s.io/v1
autoscaling/v1
autoscaling/v2
batch/v1
certificates.k8s.io/v1
coordination.k8s.io/v1
crd.projectcalico.org/v1
discovery.k8s.io/v1
events.k8s.io/v1
flowcontrol.apiserver.k8s.io/v1
flowcontrol.apiserver.k8s.io/v1beta3
networking.k8s.io/v1
node.k8s.io/v1
policy/v1
rbac.authorization.k8s.io/v1
scheduling.k8s.io/v1
storage.k8s.io/v1
v1
13 changes: 11 additions & 2 deletions schemas/gen-k8s-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set -ex
# X.Y.Z-local - relative references, useful to avoid the network dependency

declare -a K8S_VERSIONS=(
v1.29.4
v1.28.3
v1.27.4
v1.26.7
Expand All @@ -22,8 +23,8 @@ declare -a K8S_VERSIONS=(

pushd schemas

# OPENAPI2JSONSCHEMABIN="docker run -i -v ${PWD}:/out/schemas ghcr.io/yannh/openapi2jsonschema:latest"
OPENAPI2JSONSCHEMABIN="openapi2jsonschema"
OPENAPI2JSONSCHEMABIN="docker run -i -v ${PWD}:/out/schemas ghcr.io/yannh/openapi2jsonschema:latest"
# OPENAPI2JSONSCHEMABIN="openapi2jsonschema"

if [ -n "${K8S_VERSION_PREFIX}" ]; then
export K8S_VERSIONS=$(git ls-remote --refs --tags https://github.com/kubernetes/kubernetes.git | cut -d/ -f3 | grep -e '^'"${K8S_VERSION_PREFIX}" | grep -e '^v1\.[0-9]\{2\}\.[0-9]\{1,2\}$')
Expand All @@ -43,8 +44,16 @@ for K8S_VERSION in "${K8S_VERSIONS[@]}"; do

if [ ! -f "${OUT_VERSION}-standalone.tar.gz" ]; then
$OPENAPI2JSONSCHEMABIN -o "${OUT_VERSION}-standalone" --expanded --kubernetes --stand-alone "${SCHEMA}"
container_id=$(docker ps -a -l -q)
docker cp $container_id:/out/${OUT_VERSION}-standalone ${PWD}/${OUT_VERSION}-standalone-expanded

$OPENAPI2JSONSCHEMABIN -o "${OUT_VERSION}-standalone" --kubernetes --stand-alone "${SCHEMA}"
container_id=$(docker ps -a -l -q)
docker cp $container_id:/out/${OUT_VERSION}-standalone ${PWD}/${OUT_VERSION}-standalone

cp -r ${OUT_VERSION}-standalone-expanded/* ${OUT_VERSION}-standalone
tar -zcvf "${OUT_VERSION}"-standalone.tar.gz "${OUT_VERSION}"-standalone
rm -rf "${OUT_VERSION}"-standalone-expanded
rm -rf "${OUT_VERSION}"-standalone
fi

Expand Down
Binary file added schemas/v1.29-standalone.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion src/cmd/validate-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const validateTemplates = async (): Promise<void> => {
d.info(`K8S Resource Path: ${k8sResourcesPath}`)
d.info(`Schema location: file://${schemaOutputPath}`)
const kubevalOutput = await nothrow(
$`kubeconform ${verbose} -skip ${skipKinds.join(',')} -ignore-filename-pattern ${skipFilenames.join(
$`kubeconform -skip ${skipKinds.join(',')} -ignore-filename-pattern ${skipFilenames.join(
'|',
)} -schema-location ${schemaOutputPath}/${vk8sVersion}-standalone/{{.ResourceKind}}{{.KindSuffix}}.json ${k8sResourcesPath}`,
)
Expand Down Expand Up @@ -200,6 +200,7 @@ export const validateTemplates = async (): Promise<void> => {
d.info(`${chalk.redBright('TOTAL ERR')}: %s`, `${errCount} files`)

if (kubevalOutput.exitCode !== 0) {
d.info('Kubeval output: %s', kubevalOutput.stdout)
throw new Error(`Template validation FAILED: ${kubevalOutput.exitCode}`)
} else d.log('Template validation SUCCESS')
}
Expand Down
2 changes: 1 addition & 1 deletion src/supportedK8sVersions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "supportedK8sVersions": ["1.25", "1.26", "1.27", "1.28"] }
{ "supportedK8sVersions": ["1.27", "1.28", "1.29"] }
2 changes: 1 addition & 1 deletion tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:20.04 as builder
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETARCH
# https://github.com/kubernetes/kubernetes/releases
ARG KUBECTL_VERSION=1.28.10
ARG KUBECTL_VERSION=1.29.5
# https://github.com/helm/helm/tags
ARG HELM_VERSION=3.15.1
# https://github.com/databus23/helm-diff/releases
Expand Down

0 comments on commit 8f911d6

Please sign in to comment.