diff --git a/.github/README-ci.md b/.github/README-ci.md index 3431fdc..c54c8e3 100644 --- a/.github/README-ci.md +++ b/.github/README-ci.md @@ -15,8 +15,10 @@ This repository publishes CI artifacts and container images from `github.com/sea - `ghcr.io/sealos-apps/devbox-v2-server` - `ghcr.io/sealos-apps/devbox-v2-httpgate` - `ghcr.io/sealos-apps/devbox-v2-sshgate` + - `ghcr.io/sealos-apps/devbox-v1` + - `ghcr.io/sealos-apps/devbox-v2` - `Release` - Triggers on `v*` tags, creates a GitHub Release, and uploads generated controller manifests plus `v1-cri-shim`, `v2-server`, `v2-httpgate`, and `v2-sshgate` release artifacts. + Triggers on `v*` tags, creates a GitHub Release, publishes the versioned cluster images, and uploads generated controller manifests plus `v1-cri-shim`, `v2-server`, `v2-httpgate`, and `v2-sshgate` release artifacts. ## Trigger Rules diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 83e3bb1..c44d660 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -13,6 +13,7 @@ permissions: env: REGISTRY: ghcr.io IMAGE_NAMESPACE: ${{ github.repository_owner }} + SEALOS_VERSION: "5.1.1" jobs: build-and-push: @@ -95,3 +96,101 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=${{ matrix.name }} cache-to: type=gha,mode=max,scope=${{ matrix.name }} + + cluster-images: + name: Cluster Image / ${{ matrix.name }} + runs-on: ubuntu-latest + needs: + - build-and-push + strategy: + fail-fast: false + matrix: + include: + - name: v1 + image_name: devbox-v1 + deploy_context: v1/deploy + - name: v2 + image_name: devbox-v2 + deploy_context: v2/deploy + env: + APP_VERSION: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }} + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Install sealos + run: | + curl -sSL -H 'User-Agent: curl' \ + -o /tmp/sealos.tgz \ + "https://github.com/labring/sealos/releases/download/v${SEALOS_VERSION}/sealos_${SEALOS_VERSION}_linux_amd64.tar.gz" + tar -xzf /tmp/sealos.tgz -C /tmp + sudo install "$(find /tmp -maxdepth 2 -type f -name sealos | head -n 1)" /usr/local/bin/sealos + sealos version + + - name: Prepare cluster image context + id: prepare + run: | + workdir="$(mktemp -d)" + cp -R "${{ matrix.deploy_context }}/." "${workdir}/" + + case "${{ matrix.name }}" in + v1) + values_file="${workdir}/charts/devbox-v1/values.yaml" + sed -i.bak -E "/^controller:/,/^frontend:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-controller#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^frontend:/,\$/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-frontend#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + ;; + v2) + values_file="${workdir}/charts/devbox-v2/values.yaml" + sed -i.bak -E "/^controller:/,/^server:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-controller#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^server:/,/^frontend:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-server#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^frontend:/,/^httpgate:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-frontend#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-httpgate#; s#^ tag: .*# tag: ${APP_VERSION}#" "${workdir}/charts/devbox-v2/charts/httpgate/values.yaml" + sed -i.bak -E "s#^image: .*#image: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-sshgate:${APP_VERSION}#" "${workdir}/charts/devbox-v2/charts/sshgate/values.yaml" + ;; + esac + + find "${workdir}" -name '*.bak' -delete + + sealos registry save --registry-dir "${workdir}/registry_amd64" --arch amd64 "${workdir}" + sealos registry save --registry-dir "${workdir}/registry_arm64" --arch arm64 "${workdir}" + + echo "workdir=${workdir}" >> "${GITHUB_OUTPUT}" + + - name: Compute cluster image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image_name }} + tags: | + type=ref,event=branch + type=sha,prefix=sha- + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + + - name: Build and push cluster image + uses: docker/build-push-action@v6 + with: + context: ${{ steps.prepare.outputs.workdir }} + file: ${{ steps.prepare.outputs.workdir }}/Kubefile + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + APP_VERSION=${{ env.APP_VERSION }} + IMAGE_REGISTRY=${{ env.REGISTRY }} + IMAGE_NAMESPACE=${{ env.IMAGE_NAMESPACE }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=cluster-${{ matrix.name }} + cache-to: type=gha,mode=max,scope=cluster-${{ matrix.name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d92242..ac86d2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ env: RUST_TOOLCHAIN: "stable" REGISTRY: ghcr.io IMAGE_NAMESPACE: ${{ github.repository_owner }} + SEALOS_VERSION: "5.1.1" jobs: images: @@ -97,6 +98,104 @@ jobs: cache-from: type=gha,scope=release-${{ matrix.name }} cache-to: type=gha,mode=max,scope=release-${{ matrix.name }} + cluster-images: + name: Release Cluster Image / ${{ matrix.name }} + runs-on: ubuntu-latest + needs: + - images + strategy: + fail-fast: false + matrix: + include: + - name: v1 + image_name: devbox-v1 + deploy_context: v1/deploy + - name: v2 + image_name: devbox-v2 + deploy_context: v2/deploy + env: + APP_VERSION: ${{ github.ref_name }} + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Install sealos + run: | + curl -sSL -H 'User-Agent: curl' \ + -o /tmp/sealos.tgz \ + "https://github.com/labring/sealos/releases/download/v${SEALOS_VERSION}/sealos_${SEALOS_VERSION}_linux_amd64.tar.gz" + tar -xzf /tmp/sealos.tgz -C /tmp + sudo install "$(find /tmp -maxdepth 2 -type f -name sealos | head -n 1)" /usr/local/bin/sealos + sealos version + + - name: Prepare cluster image context + id: prepare + run: | + workdir="$(mktemp -d)" + cp -R "${{ matrix.deploy_context }}/." "${workdir}/" + + case "${{ matrix.name }}" in + v1) + values_file="${workdir}/charts/devbox-v1/values.yaml" + sed -i.bak -E "/^controller:/,/^frontend:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-controller#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^frontend:/,\$/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-frontend#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + ;; + v2) + values_file="${workdir}/charts/devbox-v2/values.yaml" + sed -i.bak -E "/^controller:/,/^server:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-controller#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^server:/,/^frontend:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-server#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "/^frontend:/,/^httpgate:/{s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-frontend#; s#^ tag: .*# tag: ${APP_VERSION}#}" "${values_file}" + sed -i.bak -E "s#^ repository: .*# repository: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-httpgate#; s#^ tag: .*# tag: ${APP_VERSION}#" "${workdir}/charts/devbox-v2/charts/httpgate/values.yaml" + sed -i.bak -E "s#^image: .*#image: ${REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-sshgate:${APP_VERSION}#" "${workdir}/charts/devbox-v2/charts/sshgate/values.yaml" + ;; + esac + + find "${workdir}" -name '*.bak' -delete + + sealos registry save --registry-dir "${workdir}/registry_amd64" --arch amd64 "${workdir}" + sealos registry save --registry-dir "${workdir}/registry_arm64" --arch arm64 "${workdir}" + + echo "workdir=${workdir}" >> "${GITHUB_OUTPUT}" + + - name: Compute cluster image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image_name }} + tags: | + type=ref,event=tag + type=sha,prefix=sha- + type=raw,value=latest + + - name: Build and push cluster image + uses: docker/build-push-action@v6 + with: + context: ${{ steps.prepare.outputs.workdir }} + file: ${{ steps.prepare.outputs.workdir }}/Kubefile + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + APP_VERSION=${{ env.APP_VERSION }} + IMAGE_REGISTRY=${{ env.REGISTRY }} + IMAGE_NAMESPACE=${{ env.IMAGE_NAMESPACE }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=release-cluster-${{ matrix.name }} + cache-to: type=gha,mode=max,scope=release-cluster-${{ matrix.name }} + controller-manifests: name: Controller Manifest / ${{ matrix.target }} runs-on: ubuntu-latest @@ -278,6 +377,7 @@ jobs: runs-on: ubuntu-latest needs: - images + - cluster-images - controller-manifests - v1-cri-shim-binaries - v2-server-binaries @@ -313,6 +413,8 @@ jobs: - `ghcr.io/${{ github.repository_owner }}/devbox-v2-server:${{ github.ref_name }}` - `ghcr.io/${{ github.repository_owner }}/devbox-v2-httpgate:${{ github.ref_name }}` - `ghcr.io/${{ github.repository_owner }}/devbox-v2-sshgate:${{ github.ref_name }}` + - `ghcr.io/${{ github.repository_owner }}/devbox-v1:${{ github.ref_name }}` + - `ghcr.io/${{ github.repository_owner }}/devbox-v2:${{ github.ref_name }}` Binary artifacts attached to this release: diff --git a/.gitignore b/.gitignore index 153d5e5..c65a82a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tmp bin .vscode *.DS_Store +.idea \ No newline at end of file diff --git a/README.md b/README.md index 1e23048..6d389db 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ Default image names now follow the new repository naming: - `ghcr.io/sealos-apps/devbox-v1-frontend:latest` - `ghcr.io/sealos-apps/devbox-v2-controller:latest` - `ghcr.io/sealos-apps/devbox-v2-frontend:latest` +- `ghcr.io/sealos-apps/devbox-v1:latest` +- `ghcr.io/sealos-apps/devbox-v2:latest` You can override these at build or deploy time with `IMG=...` for controllers and `IMG=...` for frontends. @@ -112,12 +114,19 @@ Tagging a release such as `v1.2.3` will publish: - `ghcr.io/sealos-apps/devbox-v1-frontend:v1.2.3` - `ghcr.io/sealos-apps/devbox-v2-controller:v1.2.3` - `ghcr.io/sealos-apps/devbox-v2-frontend:v1.2.3` +- `ghcr.io/sealos-apps/devbox-v1:v1.2.3` +- `ghcr.io/sealos-apps/devbox-v2:v1.2.3` The release workflow also uploads controller manifest bundles generated from: - `v1/controller` - `v2/controller` +Sealos cluster image packaging lives under: + +- [`v1/deploy`](./v1/deploy) +- [`v2/deploy`](./v2/deploy) + If you need to publish manually, you can still run the local make targets: ```bash diff --git a/v1/deploy/Kubefile b/v1/deploy/Kubefile new file mode 100644 index 0000000..b59e119 --- /dev/null +++ b/v1/deploy/Kubefile @@ -0,0 +1,17 @@ +FROM --platform=$BUILDPLATFORM scratch +ARG TARGETARCH +ARG APP_VERSION=latest +ARG IMAGE_REGISTRY=ghcr.io +ARG IMAGE_NAMESPACE=sealos-apps + +USER 65532:65532 + +COPY registry_${TARGETARCH} registry +COPY install.sh install.sh +COPY charts charts + +ENV APP_VERSION=${APP_VERSION} +ENV IMAGE_REGISTRY=${IMAGE_REGISTRY} +ENV IMAGE_NAMESPACE=${IMAGE_NAMESPACE} + +CMD ["bash", "install.sh"] diff --git a/v1/deploy/README.md b/v1/deploy/README.md new file mode 100644 index 0000000..ca8b5d2 --- /dev/null +++ b/v1/deploy/README.md @@ -0,0 +1,22 @@ +# DevBox v1 Cluster Image + +This directory contains the Sealos cluster image packaging for DevBox v1. + +## Contents + +- `Kubefile`: cluster image build entrypoint +- `install.sh`: Sealos-aware Helm installer +- `charts/devbox-v1`: aggregated Helm chart for `v1/controller` and `v1/frontend` + +## Build Notes + +The cluster image expects architecture-specific `registry_` directories beside the `Kubefile`. +These are generated in CI with `sealos registry save` before building the image. + +## Runtime Notes + +- Default release name: `devbox-v1` +- Default release namespace: `devbox-system` +- Frontend namespace: `devbox-frontend` +- The installer will try to read `cloudDomain` and `jwtInternal` from `sealos-system/sealos-config` +- If the template database URL cannot be discovered automatically, provide `DATABASE_URL` or edit `/root/.sealos/cloud/values/apps/devbox-v1/values.yaml` diff --git a/v1/deploy/charts/devbox-v1/Chart.yaml b/v1/deploy/charts/devbox-v1/Chart.yaml new file mode 100644 index 0000000..74c38e5 --- /dev/null +++ b/v1/deploy/charts/devbox-v1/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: devbox-v1 +description: Sealos cluster image chart for DevBox v1 +type: application +version: 0.1.0 +appVersion: latest diff --git a/v1/deploy/charts/devbox-v1/files/upstream/controller-deploy.yaml b/v1/deploy/charts/devbox-v1/files/upstream/controller-deploy.yaml new file mode 100644 index 0000000..9a66b07 --- /dev/null +++ b/v1/deploy/charts/devbox-v1/files/upstream/controller-deploy.yaml @@ -0,0 +1,4061 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + control-plane: controller-manager + name: devbox-system +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.20.1 + name: devboxes.devbox.sealos.io +spec: + group: devbox.sealos.io + names: + kind: Devbox + listKind: DevboxList + plural: devboxes + singular: devbox + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.state + name: State + type: string + - jsonPath: .status.network.type + name: NetworkType + type: string + - jsonPath: .status.network.nodePort + name: NodePort + type: integer + - jsonPath: .status.phase + name: Phase + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Devbox is the Schema for the devboxes API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DevboxSpec defines the desired state of Devbox + properties: + affinity: + description: Affinity is a group of affinity scheduling rules. + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the + pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + type: array + x-kubernetes-list-type: atomic + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate + this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. + avoid putting this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and subtracting + "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + config: + properties: + annotations: + additionalProperties: + type: string + type: object + appPorts: + default: + - name: devbox-app-port + port: 8080 + protocol: TCP + items: + description: ServicePort contains information on service's port. + properties: + appProtocol: + description: |- + The application protocol for this port. + This is used as a hint for implementations to offer richer behavior for protocols that they understand. + This field follows standard Kubernetes label syntax. + Valid values are either: + + * Un-prefixed protocol names - reserved for IANA standard service names (as per + RFC-6335 and https://www.iana.org/assignments/service-names). + + * Kubernetes-defined prefixed names: + * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + + * Other protocols should use implementation-defined prefixed names such as + mycompany.com/my-custom-protocol. + type: string + name: + description: |- + The name of this port within the service. This must be a DNS_LABEL. + All ports within a ServiceSpec must have unique names. When considering + the endpoints for a Service, this must match the 'name' field in the + EndpointPort. + Optional if only one ServicePort is defined on this service. + type: string + nodePort: + description: |- + The port on each node on which this service is exposed when type is + NodePort or LoadBalancer. Usually assigned by the system. If a value is + specified, in-range, and not in use it will be used, otherwise the + operation will fail. If not specified, a port will be allocated if this + Service requires one. If this field is specified when creating a + Service which does not need it, creation will fail. This field will be + wiped when updating a Service to no longer need it (e.g. changing type + from NodePort to ClusterIP). + More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + format: int32 + type: integer + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: |- + The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + Default is TCP. + type: string + targetPort: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the pods targeted by the service. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + If this is a string, it will be looked up as a named port in the + target Pod's container ports. If this is not specified, the value + of the 'port' field is used (an identity map). + This field is ignored for services with clusterIP=None, and should be + omitted or set equal to the 'port' field. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + x-kubernetes-int-or-string: true + required: + - port + type: object + type: array + args: + description: kubebuilder:validation:Optional + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: |- + Name of the environment variable. + May consist of any printable ASCII characters except '='. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + fileKeyRef: + description: |- + FileKeyRef selects a key of the env file. + Requires the EnvFiles feature gate to be enabled. + properties: + key: + description: |- + The key within the env file. An invalid key will prevent the pod from starting. + The keys defined within a source may consist of any printable ASCII characters except '='. + During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. + type: string + optional: + default: false + description: |- + Specify whether the file or its key must be defined. If the file or key + does not exist, then the env var is not published. + If optional is set to true and the specified key does not exist, + the environment variable will not be set in the Pod's containers. + + If optional is set to false and the specified key does not exist, + an error will be returned during Pod creation. + type: boolean + path: + description: |- + The path within the volume from which to select the file. + Must be relative and may not contain the '..' path or start with '..'. + type: string + volumeName: + description: The name of the volume mount containing + the env file. + type: string + required: + - key + - path + - volumeName + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + labels: + additionalProperties: + type: string + type: object + ports: + default: + - containerPort: 22 + name: devbox-ssh-port + protocol: TCP + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + releaseArgs: + default: + - /home/devbox/project/entrypoint.sh + items: + type: string + type: array + releaseCommand: + default: + - /bin/bash + - -c + items: + type: string + type: array + user: + default: devbox + type: string + volumeMounts: + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified + (which defaults to None). + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + recursiveReadOnly: + description: |- + RecursiveReadOnly specifies whether read-only mounts should be handled + recursively. + + If ReadOnly is false, this field has no meaning and must be unspecified. + + If ReadOnly is true, and this field is set to Disabled, the mount is not made + recursively read-only. If this field is set to IfPossible, the mount is made + recursively read-only, if it is supported by the container runtime. If this + field is set to Enabled, the mount is made recursively read-only if it is + supported by the container runtime, otherwise the pod will not be started and + an error will be generated to indicate the reason. + + If this field is set to IfPossible or Enabled, MountPropagation must be set to + None (or be unspecified, which defaults to None). + + If this field is not specified, it is treated as an equivalent of Disabled. + type: string + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + volumes: + items: + description: Volume represents a named volume in a pod that + may be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree + awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: |- + azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type + are redirected to the disk.csi.azure.com CSI driver. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: + None, Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in + the blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the + blob storage + type: string + fsType: + default: ext4 + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single + blob disk per storage account Managed: azure managed + data disk (only in managed availability set). defaults + to shared' + type: string + readOnly: + default: false + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: |- + azureFile represents an Azure File Service mount on the host and bind mount to the pod. + Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type + are redirected to the file.csi.azure.com CSI driver. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that + contains Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: |- + cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported. + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + x-kubernetes-list-type: atomic + path: + description: 'path is Optional: Used as the mounted + root, rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + Deprecated: Cinder is deprecated. All operations for the in-tree cinder type + are redirected to the cinder.csi.openstack.org CSI driver. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should + populate this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents + ephemeral storage that is handled by certain external + CSI drivers. + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the + pod that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume + file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the + pod: only annotations, labels, name, namespace + and uid are supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in + the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must not + be absolute or contain the ''..'' path. Must + be utf-8 encoded. The first item of the relative + path must not start with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for + volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of + the exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + x-kubernetes-list-type: atomic + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + x-kubernetes-list-type: atomic + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + Users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over + volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeAttributesClassName: + description: |- + volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. + If specified, the CSI driver will create or update the volume with the attributes defined + in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, + it can be changed after the claim is created. An empty string or nil value indicates that no + VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, + this field can be reset to its previous value (including nil) to cancel the modification. + If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be + set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource + exists. + More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that + is attached to a kubelet's host machine and then exposed + to the pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + x-kubernetes-list-type: atomic + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. + properties: + driver: + description: driver is the name of the driver to use + for this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds + extra command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: |- + flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. + Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported. + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. + This is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree + gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. + properties: + endpoints: + description: endpoints is the endpoint name that details + Glusterfs topology. + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + image: + description: |- + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + The volume is resolved at pod startup depending on which PullPolicy value is provided: + + - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + + The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. + A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. + The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. + The volume will be mounted read-only (ro) and non-executable files (noexec). + Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. + The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. + properties: + pullPolicy: + description: |- + Policy for pulling OCI objects. Possible values are: + Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + type: string + reference: + description: |- + Required: Image or artifact reference to be used. + Behaves in the same way as pod.spec.containers[*].image. + Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. + type: string + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support + iSCSI Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support + iSCSI Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + default: default + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + x-kubernetes-list-type: atomic + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI + target and initiator authentication + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: |- + photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: |- + portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type + are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate + is on. + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx + volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: |- + sources is the list of volume projections. Each entry in this list + handles one source. + items: + description: |- + Projection that may be projected along with other supported volume types. + Exactly one of these fields must be set. + properties: + clusterTrustBundle: + description: |- + ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field + of ClusterTrustBundle objects in an auto-updating file. + + Alpha, gated by the ClusterTrustBundleProjection feature gate. + + ClusterTrustBundle objects can either be selected by name, or by the + combination of signer name and a label selector. + + Kubelet performs aggressive normalization of the PEM contents written + into the pod filesystem. Esoteric PEM features such as inter-block + comments and block headers are stripped. Certificates are deduplicated. + The ordering of certificates within the file is arbitrary, and Kubelet + may change the order over time. + properties: + labelSelector: + description: |- + Select all ClusterTrustBundles that match this label selector. Only has + effect if signerName is set. Mutually-exclusive with name. If unset, + interpreted as "match nothing". If set but empty, interpreted as "match + everything". + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + name: + description: |- + Select a single ClusterTrustBundle by object name. Mutually-exclusive + with signerName and labelSelector. + type: string + optional: + description: |- + If true, don't block pod startup if the referenced ClusterTrustBundle(s) + aren't available. If using name, then the named ClusterTrustBundle is + allowed not to exist. If using signerName, then the combination of + signerName and labelSelector is allowed to match zero + ClusterTrustBundles. + type: boolean + path: + description: Relative path from the volume + root to write the bundle. + type: string + signerName: + description: |- + Select all ClusterTrustBundles that match this signer name. + Mutually-exclusive with name. The contents of all selected + ClusterTrustBundles will be unified and deduplicated. + type: string + required: + - path + type: object + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path + within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the + ConfigMap or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the + downwardAPI data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name, namespace and uid are supported.' + properties: + apiVersion: + description: Version of the schema + the FieldPath is written in terms + of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to + select in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the + relative path name of the file to + be created. Must not be absolute or + contain the ''..'' path. Must be utf-8 + encoded. The first item of the relative + path must not start with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env + vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output + format of the exposed resources, + defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource + to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podCertificate: + description: |- + Projects an auto-rotating credential bundle (private key and certificate + chain) that the pod can use either as a TLS client or server. + + Kubelet generates a private key and uses it to send a + PodCertificateRequest to the named signer. Once the signer approves the + request and issues a certificate chain, Kubelet writes the key and + certificate chain to the pod filesystem. The pod does not start until + certificates have been issued for each podCertificate projected volume + source in its spec. + + Kubelet will begin trying to rotate the certificate at the time indicated + by the signer using the PodCertificateRequest.Status.BeginRefreshAt + timestamp. + + Kubelet can write a single file, indicated by the credentialBundlePath + field, or separate files, indicated by the keyPath and + certificateChainPath fields. + + The credential bundle is a single file in PEM format. The first PEM + entry is the private key (in PKCS#8 format), and the remaining PEM + entries are the certificate chain issued by the signer (typically, + signers will return their certificate chain in leaf-to-root order). + + Prefer using the credential bundle format, since your application code + can read it atomically. If you use keyPath and certificateChainPath, + your application must make two separate file reads. If these coincide + with a certificate rotation, it is possible that the private key and leaf + certificate you read may not correspond to each other. Your application + will need to check for this condition, and re-read until they are + consistent. + + The named signer controls chooses the format of the certificate it + issues; consult the signer implementation's documentation to learn how to + use the certificates it issues. + properties: + certificateChainPath: + description: |- + Write the certificate chain at this path in the projected volume. + + Most applications should use credentialBundlePath. When using keyPath + and certificateChainPath, your application needs to check that the key + and leaf certificate are consistent, because it is possible to read the + files mid-rotation. + type: string + credentialBundlePath: + description: |- + Write the credential bundle at this path in the projected volume. + + The credential bundle is a single file that contains multiple PEM blocks. + The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private + key. + + The remaining blocks are CERTIFICATE blocks, containing the issued + certificate chain from the signer (leaf and any intermediates). + + Using credentialBundlePath lets your Pod's application code make a single + atomic read that retrieves a consistent key and certificate chain. If you + project them to separate files, your application code will need to + additionally check that the leaf certificate was issued to the key. + type: string + keyPath: + description: |- + Write the key at this path in the projected volume. + + Most applications should use credentialBundlePath. When using keyPath + and certificateChainPath, your application needs to check that the key + and leaf certificate are consistent, because it is possible to read the + files mid-rotation. + type: string + keyType: + description: |- + The type of keypair Kubelet will generate for the pod. + + Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384", + "ECDSAP521", and "ED25519". + type: string + maxExpirationSeconds: + description: |- + maxExpirationSeconds is the maximum lifetime permitted for the + certificate. + + Kubelet copies this value verbatim into the PodCertificateRequests it + generates for this projection. + + If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + will reject values shorter than 3600 (1 hour). The maximum allowable + value is 7862400 (91 days). + + The signer implementation is then free to issue a certificate with any + lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + seconds (1 hour). This constraint is enforced by kube-apiserver. + `kubernetes.io` signers will never issue certificates with a lifetime + longer than 24 hours. + format: int32 + type: integer + signerName: + description: Kubelet's generated CSRs will + be addressed to this signer. + type: string + userAnnotations: + additionalProperties: + type: string + description: |- + userAnnotations allow pod authors to pass additional information to + the signer implementation. Kubernetes does not restrict or validate this + metadata in any way. + + These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of + the PodCertificateRequest objects that Kubelet creates. + + Entries are subject to the same validation as object metadata annotations, + with the addition that all keys must be domain-prefixed. No restrictions + are placed on values, except an overall size limitation on the entire field. + + Signers should document the keys and values they support. Signers should + deny requests that contain keys they do not recognize. + type: object + required: + - keyType + - signerName + type: object + secret: + description: secret information about the secret + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path + within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional field specify whether + the Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information + about the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + x-kubernetes-list-type: atomic + type: object + quobyte: + description: |- + quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported. + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + default: /etc/ceph/keyring + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + x-kubernetes-list-type: atomic + pool: + default: rbd + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + default: admin + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: |- + scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. + properties: + fsType: + default: xfs + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + default: ThinProvisioned + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool + associated with the protection domain. + type: string + system: + description: system is the name of the storage system + as configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + optional: + description: optional field specify whether the Secret + or its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: |- + storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: |- + vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type + are redirected to the csi.vsphere.vmware.com CSI driver. + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy + Based Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies + vSphere volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + workingDir: + default: /home/devbox/project + type: string + type: object + image: + type: string + network: + properties: + extraPorts: + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + type: + enum: + - NodePort + - Tailnet + type: string + required: + - type + type: object + nodeSelector: + additionalProperties: + type: string + type: object + resource: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: ResourceList is a set of (resource name, quantity) pairs. + type: object + runtimeClassName: + type: string + squash: + default: false + type: boolean + state: + enum: + - Running + - Stopped + - Shutdown + type: string + templateID: + type: string + tolerations: + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators). + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + required: + - config + - image + - network + - resource + - state + type: object + status: + description: DevboxStatus defines the observed state of Devbox + properties: + commitHistory: + items: + properties: + containerID: + description: ContainerID is the container id + type: string + image: + description: Image is the image of the commit + type: string + node: + description: Node is the node name + type: string + pod: + description: Pod is the pod name + type: string + predicatedStatus: + description: predicatedStatus default `pending`, will be set + to `success` if pod status is running successfully. + type: string + status: + description: status will be set based on expectedStatus after + devbox pod delete or stop. if expectedStatus is still pending, + it means the pod is not running successfully, so we need to + set it to `failed` + type: string + time: + description: Time is the time when the commit is created + format: date-time + type: string + required: + - containerID + - image + - node + - pod + - predicatedStatus + - status + - time + type: object + type: array + lastState: + description: |- + ContainerState holds a possible state of container. + Only one of its members may be specified. + If none of them is specified, the default one is ContainerStateWaiting. + properties: + running: + description: Details about a running container + properties: + startedAt: + description: Time at which the container was last (re-)started + format: date-time + type: string + type: object + terminated: + description: Details about a terminated container + properties: + containerID: + description: Container's ID in the format '://' + type: string + exitCode: + description: Exit status from the last termination of the + container + format: int32 + type: integer + finishedAt: + description: Time at which the container last terminated + format: date-time + type: string + message: + description: Message regarding the last termination of the + container + type: string + reason: + description: (brief) reason from the last termination of the + container + type: string + signal: + description: Signal from the last termination of the container + format: int32 + type: integer + startedAt: + description: Time at which previous execution of the container + started + format: date-time + type: string + required: + - exitCode + type: object + waiting: + description: Details about a waiting container + properties: + message: + description: Message regarding why the container is not yet + running. + type: string + reason: + description: (brief) reason the container is not yet running. + type: string + type: object + type: object + network: + properties: + nodePort: + format: int32 + type: integer + tailnet: + description: todo TailNet + type: string + type: + default: NodePort + enum: + - NodePort + - Tailnet + type: string + required: + - type + type: object + phase: + type: string + state: + description: |- + ContainerState holds a possible state of container. + Only one of its members may be specified. + If none of them is specified, the default one is ContainerStateWaiting. + properties: + running: + description: Details about a running container + properties: + startedAt: + description: Time at which the container was last (re-)started + format: date-time + type: string + type: object + terminated: + description: Details about a terminated container + properties: + containerID: + description: Container's ID in the format '://' + type: string + exitCode: + description: Exit status from the last termination of the + container + format: int32 + type: integer + finishedAt: + description: Time at which the container last terminated + format: date-time + type: string + message: + description: Message regarding the last termination of the + container + type: string + reason: + description: (brief) reason from the last termination of the + container + type: string + signal: + description: Signal from the last termination of the container + format: int32 + type: integer + startedAt: + description: Time at which previous execution of the container + started + format: date-time + type: string + required: + - exitCode + type: object + waiting: + description: Details about a waiting container + properties: + message: + description: Message regarding why the container is not yet + running. + type: string + reason: + description: (brief) reason the container is not yet running. + type: string + type: object + type: object + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.20.1 + name: devboxreleases.devbox.sealos.io +spec: + group: devbox.sealos.io + names: + kind: DevBoxRelease + listKind: DevBoxReleaseList + plural: devboxreleases + singular: devboxrelease + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.devboxName + name: DevboxName + type: string + - jsonPath: .spec.newTag + name: NewTag + type: string + - jsonPath: .status.phase + name: Phase + type: string + - jsonPath: .status.originalImage + name: OriginalImage + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: DevBoxRelease is the Schema for the devboxreleases API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DevBoxReleaseSpec defines the desired state of DevBoxRelease + properties: + devboxName: + type: string + newTag: + type: string + notes: + type: string + required: + - devboxName + - newTag + type: object + status: + description: DevBoxReleaseStatus defines the observed state of DevBoxRelease + properties: + originalImage: + type: string + phase: + default: Pending + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-controller-manager + namespace: devbox-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-leader-election-role + namespace: devbox-system +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devbox-admin-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - '*' +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devbox-editor-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devbox-viewer-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - get + - list + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-admin-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - '*' +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-editor-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-viewer-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - get + - list + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-manager-role +rules: +- apiGroups: + - "" + resources: + - configmaps + - events + - pods + - secrets + - services + verbs: + - '*' +- apiGroups: + - "" + resources: + - pods/status + verbs: + - get + - patch + - update +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + - devboxreleases + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/finalizers + - devboxreleases/finalizers + verbs: + - update +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + - devboxreleases/status + verbs: + - get + - patch + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-metrics-auth-role +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-metrics-reader +rules: +- nonResourceURLs: + - /metrics + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-leader-election-rolebinding + namespace: devbox-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: devbox-leader-election-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: devbox-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + name: devbox-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: devbox-manager-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: devbox-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: devbox-metrics-auth-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: devbox-metrics-auth-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: devbox-system +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + control-plane: controller-manager + name: devbox-controller-manager-metrics-service + namespace: devbox-system +spec: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: 8443 + selector: + app.kubernetes.io/name: devbox + control-plane: controller-manager +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: devbox + control-plane: controller-manager + name: devbox-controller-manager + namespace: devbox-system +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: devbox + control-plane: controller-manager + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + app.kubernetes.io/name: devbox + control-plane: controller-manager + spec: + containers: + - args: + - --metrics-bind-address=:8443 + - --leader-elect + - --health-probe-bind-address=:8081 + - --request-cpu-rate=20 + - --request-memory-rate=10 + - --enable-pod-ephemeral-storage-matcher={{ .enablePodEphemeralStorageMatcher }} + - --enable-pod-expected-annotations-matcher={{ .enablePodAnnotationsMatcher }} + - --enable-pod-env-matcher={{ .enablePodEnvMatcher }} + - --enable-pod-extra-resource-matcher={{ .enablePodResourceMatcher }} + - --registry-addr={{ .registryAddr }} + - --registry-user={{ .registryUser }} + - --registry-password={{ .registryPassword }} + command: + - /manager + image: ghcr.io/sealos-apps/devbox-v1-controller:latest + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + name: manager + ports: [] + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 10m + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + volumeMounts: [] + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + serviceAccountName: devbox-controller-manager + terminationGracePeriodSeconds: 10 + volumes: [] diff --git a/v1/deploy/charts/devbox-v1/files/upstream/frontend-appcr.yaml b/v1/deploy/charts/devbox-v1/files/upstream/frontend-appcr.yaml new file mode 100644 index 0000000..dcda26c --- /dev/null +++ b/v1/deploy/charts/devbox-v1/files/upstream/frontend-appcr.yaml @@ -0,0 +1,18 @@ +apiVersion: app.sealos.io/v1 +kind: App +metadata: + name: devbox + namespace: app-system +spec: + data: + desc: Devbox + url: 'https://devbox.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}' + icon: 'https://devbox.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}/logo.svg' + i18n: + zh: + name: Devbox + zh-Hans: + name: Devbox + name: devbox + type: iframe + displayType: normal diff --git a/v1/deploy/charts/devbox-v1/files/upstream/frontend-deploy.yaml b/v1/deploy/charts/devbox-v1/files/upstream/frontend-deploy.yaml new file mode 100644 index 0000000..f3cb10b --- /dev/null +++ b/v1/deploy/charts/devbox-v1/files/upstream/frontend-deploy.yaml @@ -0,0 +1,162 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app: devbox-frontend + name: devbox-frontend +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: devbox-frontend-config + namespace: devbox-frontend +data: + config.yaml: |- + addr: :3000 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: devbox-frontend + namespace: devbox-frontend +spec: + replicas: 1 + selector: + matchLabels: + app: devbox-frontend + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 25% + maxSurge: 25% + template: + metadata: + labels: + app: devbox-frontend + spec: + initContainers: + - name: devbox-frontend-init + image: ghcr.io/sealos-apps/devbox-v1-frontend:latest + imagePullPolicy: Always + env: + - name: DATABASE_URL + value: {{ .databaseUrl }} # -nsealos cm desktop-frontend-config ->database->global + devbox + command: + - sh + - -c + args: + - |- + cd /app + MIGRATION="20260125094114_add_template_repository_kind" + HAS_MIGRATION=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM _prisma_migrations WHERE migration_name='${MIGRATION}' AND rolled_back_at IS NULL LIMIT 1;") + if [ "$HAS_MIGRATION" = "1" ]; then + prisma migrate deploy + exit 0 + fi + HAS_ENUM=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM pg_enum e JOIN pg_type t ON t.oid = e.enumtypid WHERE t.typname IN ('TemplateRepositoryKind','template_repository_kind') AND e.enumlabel = 'SERVICE' LIMIT 1;") + if [ "$HAS_ENUM" = "1" ]; then + prisma migrate resolve --applied "$MIGRATION" + fi + prisma migrate deploy + containers: + - name: devbox-frontend + env: + - name: NODE_TLS_REJECT_UNAUTHORIZED + value: "{{ default "1" .tlsRejectUnauthorized }}" + - name: DOCUMENT_URL_ZH + value: https://sealos.run/docs/overview/intro + - name: DOCUMENT_URL_EN + value: https://sealos.io/docs/overview/intro + - name: PRIVACY_URL_ZH + value: https://sealos.run/docs/msa/privacy-policy + - name: PRIVACY_URL_EN + value: https://sealos.io/docs/msa/privacy-policy + - name: SEALOS_DOMAIN + value: {{ .cloudDomain }} + - name: INGRESS_SECRET + value: wildcard-cert + - name: REGISTRY_ADDR + value: {{ .registryAddr }} + - name: DEVBOX_AFFINITY_ENABLE + value: 'true' + - name: MONITOR_URL + value: http://launchpad-monitor.sealos.svc.cluster.local:8428 + - name: SQUASH_ENABLE + value: 'false' + - name: ACCOUNT_URL + value: http://account-service.account-system.svc.cluster.local:2333 + - name: ROOT_RUNTIME_NAMESPACE + value: devbox-system + - name: INGRESS_DOMAIN + value: {{ .cloudDomain }} + - name: CURRENCY_SYMBOL + value: usd # 'shellCoin' | 'cny' | 'usd' + - name: GPU_ENABLE + value: 'false' + - name: PRIVACY_URL + value: https://sealos.run/docs/msa/privacy-policy + - name: RETAG_SVC_URL + value: http://devbox-service.devbox-system.svc.cluster.local:8092 + - name: JWT_SECRET + value: {{ .jwtSecret }} # -nsealos cm desktop-frontend-config ->jwt->Internal + - name: REGION_UID + value: {{ .regionUid }} # -nsealos cm desktop-frontend-config ->regionUid + - name: DATABASE_URL + value: {{ .databaseUrl }} # -nsealos cm desktop-frontend-config ->database->global + devbox + - name: ENABLE_IMPORT_FEATURE + value: 'false' + - name: ENABLE_WEBIDE_FEATURE + value: 'false' + securityContext: + runAsNonRoot: true + runAsUser: 1001 + allowPrivilegeEscalation: false + capabilities: + drop: + - 'ALL' + resources: + limits: + cpu: 2000m + memory: 2048Mi + requests: + cpu: 100m + memory: 128Mi + # do not modify this image, it is used for CI/CD + image: ghcr.io/sealos-apps/devbox-v1-frontend:latest + imagePullPolicy: Always + volumeMounts: + - name: devbox-frontend-volume + mountPath: /config.yaml + subPath: config.yaml + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: 'app' + operator: In + values: + - devbox-frontend + topologyKey: 'kubernetes.io/hostname' + volumes: + - name: devbox-frontend-volume + configMap: + name: devbox-frontend-config +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: devbox-frontend + name: devbox-frontend + namespace: devbox-frontend +spec: + ports: + - name: http + port: 3000 + protocol: TCP + targetPort: 3000 + selector: + app: devbox-frontend diff --git a/v1/deploy/charts/devbox-v1/files/upstream/frontend-ingress.yaml b/v1/deploy/charts/devbox-v1/files/upstream/frontend-ingress.yaml new file mode 100644 index 0000000..b05a597 --- /dev/null +++ b/v1/deploy/charts/devbox-v1/files/upstream/frontend-ingress.yaml @@ -0,0 +1,51 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/configuration-snippet: | + more_clear_headers "X-Frame-Options:"; + more_set_headers "Content-Security-Policy: default-src * blob: data: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; img-src * data: blob: resource: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' https://{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} https://*.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}"; + more_set_headers "X-Xss-Protection: 1; mode=block"; + higress.io/response-header-control-remove: X-Frame-Options + higress.io/response-header-control-update: | + Content-Security-Policy "default-src * blob: data: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; img-src * data: blob: resource: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' https://{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} https://*.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}" + X-Xss-Protection "1; mode=block" + name: devbox-frontend + namespace: devbox-frontend +spec: + rules: + - host: devbox.{{ .cloudDomain }} + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: devbox-frontend + port: + number: 3000 + tls: + - hosts: + - devbox.{{ .cloudDomain }} + secretName: {{ .certSecretName }} # wildcard-cert +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + name: devbox-challenge + namespace: devbox-frontend +spec: + rules: + - host: "" + http: + paths: + - backend: + service: + name: devbox-frontend + port: + number: 3000 + path: /api/.well-known/devbox-domain-challenge + pathType: Prefix diff --git a/v1/deploy/charts/devbox-v1/templates/_helpers.tpl b/v1/deploy/charts/devbox-v1/templates/_helpers.tpl new file mode 100644 index 0000000..eb0615f --- /dev/null +++ b/v1/deploy/charts/devbox-v1/templates/_helpers.tpl @@ -0,0 +1,12 @@ +{{- define "devbox-v1.image" -}} +{{- $tag := default .chartAppVersion .image.tag -}} +{{- printf "%s:%s" .image.repository $tag -}} +{{- end -}} + +{{- define "devbox-v1.boolString" -}} +{{- if . -}}true{{- else -}}false{{- end -}} +{{- end -}} + +{{- define "devbox-v1.publicDomain" -}} +{{- default .Values.global.cloudDomain .Values.global.publicDomain -}} +{{- end -}} diff --git a/v1/deploy/charts/devbox-v1/templates/controller.yaml b/v1/deploy/charts/devbox-v1/templates/controller.yaml new file mode 100644 index 0000000..763f29b --- /dev/null +++ b/v1/deploy/charts/devbox-v1/templates/controller.yaml @@ -0,0 +1,13 @@ +{{- $source := .Files.Get "files/upstream/controller-deploy.yaml" -}} +{{- $source = replace "ghcr.io/sealos-apps/devbox-v1-controller:latest" (include "devbox-v1.image" (dict "image" .Values.controller.image "chartAppVersion" .Chart.AppVersion)) $source -}} +{{- $source = replace "- --registry-password={{ .registryPassword }}" "- --registry-password={{ .registryPassword }}\n - --registry-insecure={{ .registryInsecure }}" $source -}} +{{- tpl $source (dict + "enablePodEphemeralStorageMatcher" (include "devbox-v1.boolString" .Values.controller.matchers.ephemeralStorageEnabled) + "enablePodAnnotationsMatcher" (include "devbox-v1.boolString" .Values.controller.matchers.annotationsEnabled) + "enablePodEnvMatcher" (include "devbox-v1.boolString" .Values.controller.matchers.envEnabled) + "enablePodResourceMatcher" (include "devbox-v1.boolString" .Values.controller.matchers.resourcesEnabled) + "registryAddr" .Values.global.registryAddr + "registryUser" .Values.controller.registry.user + "registryPassword" .Values.controller.registry.password + "registryInsecure" (include "devbox-v1.boolString" .Values.controller.registry.insecure) +) }} diff --git a/v1/deploy/charts/devbox-v1/templates/frontend-appcr.yaml b/v1/deploy/charts/devbox-v1/templates/frontend-appcr.yaml new file mode 100644 index 0000000..869981a --- /dev/null +++ b/v1/deploy/charts/devbox-v1/templates/frontend-appcr.yaml @@ -0,0 +1,6 @@ +{{- if and .Values.frontend.enabled .Values.app.enabled -}} +{{- tpl (.Files.Get "files/upstream/frontend-appcr.yaml") (dict + "cloudDomain" (include "devbox-v1.publicDomain" .) + "cloudPort" .Values.global.cloudPort +) }} +{{- end }} diff --git a/v1/deploy/charts/devbox-v1/templates/frontend-ingress.yaml b/v1/deploy/charts/devbox-v1/templates/frontend-ingress.yaml new file mode 100644 index 0000000..bbeb08f --- /dev/null +++ b/v1/deploy/charts/devbox-v1/templates/frontend-ingress.yaml @@ -0,0 +1,10 @@ +{{- if and .Values.frontend.enabled .Values.frontend.ingress.enabled -}} +{{- $source := .Files.Get "files/upstream/frontend-ingress.yaml" -}} +{{- $source = replace "kubernetes.io/ingress.class: nginx" "kubernetes.io/ingress.class: {{ .ingressClassName }}" $source -}} +{{- tpl $source (dict + "cloudDomain" (include "devbox-v1.publicDomain" .) + "cloudPort" .Values.global.cloudPort + "certSecretName" .Values.global.ingress.secretName + "ingressClassName" .Values.frontend.ingress.className +) }} +{{- end }} diff --git a/v1/deploy/charts/devbox-v1/templates/frontend.yaml b/v1/deploy/charts/devbox-v1/templates/frontend.yaml new file mode 100644 index 0000000..50c22c9 --- /dev/null +++ b/v1/deploy/charts/devbox-v1/templates/frontend.yaml @@ -0,0 +1,33 @@ +{{- if .Values.frontend.enabled -}} +{{- $source := .Files.Get "files/upstream/frontend-deploy.yaml" -}} +{{- $source = replace "ghcr.io/sealos-apps/devbox-v1-frontend:latest" (include "devbox-v1.image" (dict "image" .Values.frontend.image "chartAppVersion" .Chart.AppVersion)) $source -}} +{{- $source = replace "imagePullPolicy: Always" (printf "imagePullPolicy: %s" .Values.frontend.image.pullPolicy) $source -}} +{{- $source = replace "- name: SEALOS_DOMAIN\n value: {{ .cloudDomain }}" "- name: SEALOS_DOMAIN\n value: {{ .sealosDomain }}" $source -}} +{{- $source = replace "- name: INGRESS_SECRET\n value: wildcard-cert" "- name: INGRESS_SECRET\n value: {{ .certSecretName }}" $source -}} +{{- $source = replace "- name: INGRESS_DOMAIN\n value: {{ .cloudDomain }}" "- name: INGRESS_DOMAIN\n value: {{ .ingressDomain }}" $source -}} +{{- $source = replace "value: http://launchpad-monitor.sealos.svc.cluster.local:8428" "value: {{ .monitorUrl }}" $source -}} +{{- $source = replace "value: http://account-service.account-system.svc.cluster.local:2333" "value: {{ .accountUrl }}" $source -}} +{{- $source = replace "value: http://devbox-service.devbox-system.svc.cluster.local:8092" "value: {{ .retagServiceUrl }}" $source -}} +{{- $source = replace "value: https://sealos.run/docs/overview/intro" "value: {{ .documentUrlZh }}" $source -}} +{{- $source = replace "value: https://sealos.io/docs/overview/intro" "value: {{ .documentUrlEn }}" $source -}} +{{- $source = replace "value: https://sealos.run/docs/msa/privacy-policy" "value: {{ .privacyUrlZh }}" $source -}} +{{- $source = replace "value: https://sealos.io/docs/msa/privacy-policy" "value: {{ .privacyUrlEn }}" $source -}} +{{- $source = replace "value: {{ .regionUid }}" "value: {{ .regionUid | quote }}" $source -}} +{{- tpl $source (dict + "databaseUrl" .Values.global.databaseUrl + "tlsRejectUnauthorized" .Values.frontend.tlsRejectUnauthorized + "sealosDomain" .Values.global.cloudDomain + "ingressDomain" (include "devbox-v1.publicDomain" .) + "certSecretName" .Values.global.ingress.secretName + "registryAddr" .Values.global.registryAddr + "monitorUrl" .Values.frontend.monitorUrl + "accountUrl" .Values.frontend.accountUrl + "retagServiceUrl" .Values.frontend.retagServiceUrl + "documentUrlZh" .Values.frontend.documentUrlZh + "documentUrlEn" .Values.frontend.documentUrlEn + "privacyUrlZh" .Values.frontend.privacyUrlZh + "privacyUrlEn" .Values.frontend.privacyUrlEn + "jwtSecret" .Values.global.jwtSecret + "regionUid" .Values.global.regionUid +) }} +{{- end }} diff --git a/v1/deploy/charts/devbox-v1/values.yaml b/v1/deploy/charts/devbox-v1/values.yaml new file mode 100644 index 0000000..049f309 --- /dev/null +++ b/v1/deploy/charts/devbox-v1/values.yaml @@ -0,0 +1,52 @@ +global: + cloudDomain: "" + publicDomain: "" + cloudPort: "" + ingress: + className: nginx + secretName: wildcard-cert + registryAddr: sealos.hub:5000 + jwtSecret: "" + regionUid: "" + databaseUrl: "" + +app: + enabled: true + +controller: + image: + repository: ghcr.io/sealos-apps/devbox-v1-controller + tag: latest + registry: + user: admin + password: passw0rd + insecure: true + matchers: + ephemeralStorageEnabled: false + annotationsEnabled: true + envEnabled: true + resourcesEnabled: true + +frontend: + enabled: true + image: + repository: ghcr.io/sealos-apps/devbox-v1-frontend + tag: latest + pullPolicy: Always + tlsRejectUnauthorized: "1" + monitorUrl: http://launchpad-monitor.sealos.svc.cluster.local:8428 + accountUrl: http://account-service.account-system.svc.cluster.local:2333 + retagServiceUrl: http://devbox-service.devbox-system.svc.cluster.local:8092 + documentUrlZh: https://sealos.run/docs/overview/intro + documentUrlEn: https://sealos.io/docs/overview/intro + privacyUrlZh: https://sealos.run/docs/msa/privacy-policy + privacyUrlEn: https://sealos.io/docs/msa/privacy-policy + currencySymbol: usd + gpuEnabled: "false" + devboxAffinityEnabled: "true" + squashEnabled: "false" + enableImportFeature: "false" + enableWebIDEFeature: "false" + ingress: + enabled: true + className: nginx diff --git a/v1/deploy/install.sh b/v1/deploy/install.sh new file mode 100644 index 0000000..de800e3 --- /dev/null +++ b/v1/deploy/install.sh @@ -0,0 +1,162 @@ +#!/usr/bin/env bash +set -euo pipefail + +timestamp() { + date +"%Y-%m-%d %T" +} + +info() { + local flag + flag="$(timestamp)" + echo -e "\033[36m INFO [$flag] >> $* \033[0m" +} + +warn() { + local flag + flag="$(timestamp)" + echo -e "\033[33m WARN [$flag] >> $* \033[0m" +} + +error() { + local flag + flag="$(timestamp)" + echo -e "\033[31m ERROR [$flag] >> $* \033[0m" + exit 1 +} + +get_configmap_data() { + local namespace=$1 + local name=$2 + local key=$3 + + kubectl get configmap "${name}" -n "${namespace}" -o "jsonpath={.data.${key}}" 2>/dev/null || true +} + +get_sealos_config() { + local key=$1 + get_configmap_data "sealos-system" "sealos-config" "${key}" +} + +resolve_desktop_frontend_value() { + local key=$1 + local value="" + + for namespace in sealos sealos-system; do + value="$(get_configmap_data "${namespace}" "desktop-frontend-config" "${key}")" + if [ -n "${value}" ]; then + printf '%s' "${value}" + return 0 + fi + done + + return 1 +} + +ensure_user_values_file() { + mkdir -p "${USER_VALUES_DIR}" + + if [ ! -f "${USER_VALUES_FILE}" ]; then + cp "${DEFAULT_VALUES_FILE}" "${USER_VALUES_FILE}" + CREATED_DEFAULT_VALUES="true" + info "Generated default user values at ${USER_VALUES_FILE}" + return 0 + fi + + CREATED_DEFAULT_VALUES="false" + info "Using user values from ${USER_VALUES_FILE}" +} + +RELEASE_NAME="${RELEASE_NAME:-devbox-v1}" +NAMESPACE="${NAMESPACE:-devbox-system}" +HELM_OPTS="${HELM_OPTS:-}" +HELM_TIMEOUT="${HELM_TIMEOUT:-20m}" +DEFAULT_VALUES_FILE="./charts/devbox-v1/values.yaml" +USER_VALUES_DIR="/root/.sealos/cloud/values/apps/devbox-v1" +USER_VALUES_FILE="${USER_VALUES_DIR}/values.yaml" +CREATED_DEFAULT_VALUES="false" + +ensure_user_values_file + +cloud_domain="${SEALOS_DOMAIN:-$(get_sealos_config cloudDomain)}" +[ -n "${cloud_domain}" ] || error "Failed to resolve cloud domain from SEALOS_DOMAIN or sealos-config.data.cloudDomain" + +public_domain="${PUBLIC_DOMAIN:-${INGRESS_DOMAIN:-${cloud_domain}}}" +cloud_port="${CLOUD_PORT:-}" +cert_secret_name="${CERT_SECRET_NAME:-wildcard-cert}" +ingress_class_name="${INGRESS_CLASS_NAME:-nginx}" +registry_addr="${REGISTRY_ADDR:-$(get_sealos_config registryDomain)}" +registry_addr="${registry_addr:-sealos.hub:5000}" +registry_user="${REGISTRY_USER:-admin}" +registry_password="${REGISTRY_PASSWORD:-passw0rd}" + +frontend_jwt_secret="${JWT_SECRET:-$(get_sealos_config jwtInternal)}" +if [ -z "${frontend_jwt_secret}" ]; then + frontend_jwt_secret="$(resolve_desktop_frontend_value jwtInternal || true)" +fi +if [ -z "${frontend_jwt_secret}" ]; then + frontend_jwt_secret="$(resolve_desktop_frontend_value jwt || true)" +fi + +region_uid="${REGION_UID:-}" +if [ -z "${region_uid}" ]; then + region_uid="$(resolve_desktop_frontend_value regionUid || true)" +fi + +database_url="${DATABASE_URL:-}" +if [ -z "${database_url}" ]; then + candidate_database="$(resolve_desktop_frontend_value database || true)" + if [[ "${candidate_database}" == postgres://* || "${candidate_database}" == postgresql://* ]]; then + database_url="${candidate_database}" + fi +fi + +if [ "${CREATED_DEFAULT_VALUES}" = "true" ]; then + [ -n "${frontend_jwt_secret}" ] || error "Failed to resolve frontend JWT secret. Set JWT_SECRET or edit ${USER_VALUES_FILE}" + [ -n "${database_url}" ] || error "Failed to resolve database URL. Set DATABASE_URL or edit ${USER_VALUES_FILE}" +fi + +helm_set_args=( + --set-string "global.cloudDomain=${cloud_domain}" + --set-string "global.publicDomain=${public_domain}" + --set-string "global.cloudPort=${cloud_port}" + --set-string "global.ingress.secretName=${cert_secret_name}" + --set-string "global.ingress.className=${ingress_class_name}" + --set-string "frontend.ingress.className=${ingress_class_name}" + --set-string "global.registryAddr=${registry_addr}" + --set-string "controller.registry.user=${registry_user}" + --set-string "controller.registry.password=${registry_password}" +) + +if [ -n "${frontend_jwt_secret}" ]; then + helm_set_args+=(--set-string "global.jwtSecret=${frontend_jwt_secret}") +fi +if [ -n "${region_uid}" ]; then + helm_set_args+=(--set-string "global.regionUid=${region_uid}") +fi +if [ -n "${database_url}" ]; then + helm_set_args+=(--set-string "global.databaseUrl=${database_url}") +fi + +if [ -n "${IMAGE_REGISTRY:-}" ] && [ -n "${IMAGE_NAMESPACE:-}" ] && [ -n "${APP_VERSION:-}" ]; then + helm_set_args+=( + --set-string "controller.image.repository=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-controller" + --set-string "controller.image.tag=${APP_VERSION}" + --set-string "frontend.image.repository=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v1-frontend" + --set-string "frontend.image.tag=${APP_VERSION}" + ) +fi + +helm_opts_arr=() +if [ -n "${HELM_OPTS}" ]; then + # shellcheck disable=SC2206 + helm_opts_arr=(${HELM_OPTS}) +fi + +info "Installing chart charts/devbox-v1 into namespace ${NAMESPACE}" +helm upgrade -i "${RELEASE_NAME}" -n "${NAMESPACE}" --create-namespace charts/devbox-v1 \ + -f "${DEFAULT_VALUES_FILE}" \ + -f "${USER_VALUES_FILE}" \ + "${helm_set_args[@]}" \ + "${helm_opts_arr[@]}" \ + --wait \ + --timeout "${HELM_TIMEOUT}" diff --git a/v2/deploy/Kubefile b/v2/deploy/Kubefile new file mode 100644 index 0000000..b59e119 --- /dev/null +++ b/v2/deploy/Kubefile @@ -0,0 +1,17 @@ +FROM --platform=$BUILDPLATFORM scratch +ARG TARGETARCH +ARG APP_VERSION=latest +ARG IMAGE_REGISTRY=ghcr.io +ARG IMAGE_NAMESPACE=sealos-apps + +USER 65532:65532 + +COPY registry_${TARGETARCH} registry +COPY install.sh install.sh +COPY charts charts + +ENV APP_VERSION=${APP_VERSION} +ENV IMAGE_REGISTRY=${IMAGE_REGISTRY} +ENV IMAGE_NAMESPACE=${IMAGE_NAMESPACE} + +CMD ["bash", "install.sh"] diff --git a/v2/deploy/README.md b/v2/deploy/README.md index bd77b00..79d4616 100644 --- a/v2/deploy/README.md +++ b/v2/deploy/README.md @@ -20,13 +20,14 @@ | 路径 | 作用 | | --- | --- | -| `v2/controller/deploy/Kubefile` | controller 的 Sealos 打包入口 | +| `v2/deploy/Kubefile` | v2 聚合集群镜像入口,打包 controller/server/frontend/httpgate/sshgate | +| `v2/deploy/install.sh` | v2 聚合集群镜像安装脚本,负责 Sealos 环境探测和 Helm 安装 | +| `v2/deploy/charts/devbox-v2` | v2 聚合 Helm Chart | +| `v2/controller/deploy/Kubefile` | controller 的独立 Sealos 打包入口 | | `v2/controller/deploy/manifests/deploy.yaml` | controller 主清单,包含 namespace、CRD、controller RBAC、Service、DaemonSet、RuntimeClass | | `v2/controller/deploy/manifests/rbac.yaml` | `devbox-system` 下补充的 RoleBinding | | `v2/server/deploy/devbox-api.yaml` | `devbox-server` 的 namespace、配置、RBAC、Deployment、Service | -`v2/deploy` 在补这份文档之前是空目录,所以这份 `README.md` 现在可以视为 v2 的总部署说明。 - ## 整体部署模型 当前 v2 的部署关系可以拆成三层来看: diff --git a/v2/deploy/README.zh-CN.md b/v2/deploy/README.zh-CN.md index bd77b00..79d4616 100644 --- a/v2/deploy/README.zh-CN.md +++ b/v2/deploy/README.zh-CN.md @@ -20,13 +20,14 @@ | 路径 | 作用 | | --- | --- | -| `v2/controller/deploy/Kubefile` | controller 的 Sealos 打包入口 | +| `v2/deploy/Kubefile` | v2 聚合集群镜像入口,打包 controller/server/frontend/httpgate/sshgate | +| `v2/deploy/install.sh` | v2 聚合集群镜像安装脚本,负责 Sealos 环境探测和 Helm 安装 | +| `v2/deploy/charts/devbox-v2` | v2 聚合 Helm Chart | +| `v2/controller/deploy/Kubefile` | controller 的独立 Sealos 打包入口 | | `v2/controller/deploy/manifests/deploy.yaml` | controller 主清单,包含 namespace、CRD、controller RBAC、Service、DaemonSet、RuntimeClass | | `v2/controller/deploy/manifests/rbac.yaml` | `devbox-system` 下补充的 RoleBinding | | `v2/server/deploy/devbox-api.yaml` | `devbox-server` 的 namespace、配置、RBAC、Deployment、Service | -`v2/deploy` 在补这份文档之前是空目录,所以这份 `README.md` 现在可以视为 v2 的总部署说明。 - ## 整体部署模型 当前 v2 的部署关系可以拆成三层来看: diff --git a/v2/deploy/charts/devbox-v2/Chart.yaml b/v2/deploy/charts/devbox-v2/Chart.yaml new file mode 100644 index 0000000..725bf71 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: devbox-v2 +description: Sealos cluster image chart for DevBox v2 +type: application +version: 0.1.0 +appVersion: latest +dependencies: + - name: httpgate + version: 0.1.0 + repository: file://charts/httpgate + condition: httpgate.enabled + - name: sshgate + version: 0.1.0 + repository: file://charts/sshgate + condition: sshgate.enabled diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/.helmignore b/v2/deploy/charts/devbox-v2/charts/httpgate/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/Chart.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/Chart.yaml new file mode 100644 index 0000000..3ca4ae0 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: httpgate +description: A Kubernetes-native HTTP gateway that routes HTTP requests to Devbox pods based on Host header +type: application +version: 0.1.0 +appVersion: "latest" +keywords: + - http + - gateway + - devbox + - sealos + - proxy + - pingora +maintainers: + - name: httpgate diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/_helpers.tpl b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/_helpers.tpl new file mode 100644 index 0000000..a0b63a4 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "httpgate.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "httpgate.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "httpgate.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "httpgate.labels" -}} +helm.sh/chart: {{ include "httpgate.chart" . }} +{{ include "httpgate.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "httpgate.selectorLabels" -}} +app.kubernetes.io/name: {{ include "httpgate.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "httpgate.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "httpgate.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrole.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrole.yaml new file mode 100644 index 0000000..9e68508 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrole.yaml @@ -0,0 +1,17 @@ +{{- if and .Values.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} +rules: +# Watch Pods to get Pod IPs +- apiGroups: [""] + resources: ["pods"] + verbs: ["get", "list", "watch"] +# Watch Devbox CRDs to get uniqueID mappings +- apiGroups: ["devbox.sealos.io"] + resources: ["devboxes"] + verbs: ["get", "list", "watch"] +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrolebinding.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..0549faa --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/clusterrolebinding.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "httpgate.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "httpgate.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/configmap.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/configmap.yaml new file mode 100644 index 0000000..6c916fc --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/configmap.yaml @@ -0,0 +1,18 @@ +{{- if .Values.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} +data: +{{- if not (hasKey .Values.env "LISTEN_ADDR") }} + LISTEN_ADDR: {{ printf "0.0.0.0:%d" (int .Values.httpPort) | quote }} +{{- end }} +{{- if not (hasKey .Values.env "AGENT_PORT") }} + AGENT_PORT: {{ .Values.agentPort | quote }} +{{- end }} +{{- range $key, $value := .Values.env }} + {{ $key }}: {{ $value | quote }} +{{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/daemonset.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/daemonset.yaml new file mode 100644 index 0000000..8b62371 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/daemonset.yaml @@ -0,0 +1,75 @@ +{{- if .Values.enabled -}} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "httpgate.selectorLabels" . | nindent 6 }} + updateStrategy: + type: {{ .Values.updateStrategy.type }} + {{- if eq .Values.updateStrategy.type "RollingUpdate" }} + rollingUpdate: + maxUnavailable: {{ .Values.updateStrategy.rollingUpdate.maxUnavailable }} + {{- end }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "httpgate.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "httpgate.serviceAccountName" . }} + {{- with .Values.priorityClassName }} + priorityClassName: {{ . }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: {{ .Values.image | quote }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + ports: + - name: http + containerPort: {{ .Values.httpPort }} + protocol: TCP + envFrom: + - configMapRef: + name: {{ include "httpgate.fullname" . }} + livenessProbe: + tcpSocket: + port: {{ .Values.httpPort }} + initialDelaySeconds: 10 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: {{ .Values.httpPort }} + initialDelaySeconds: 5 + periodSeconds: 5 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/ingress.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/ingress.yaml new file mode 100644 index 0000000..f0bbba6 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/ingress.yaml @@ -0,0 +1,113 @@ +{{- if and .Values.enabled .Values.ingress.enabled -}} +--- +# HTTP Ingress (devbox- prefix, non-gRPC requests) +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} + annotations: + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + higress.io/prefix-match-header-host: devbox- + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + {{- $host := .host }} + {{- if not (hasPrefix "*." $host) }} + {{- $host = printf "*.%s" $host }} + {{- end }} + - host: {{ $host | quote }} + http: + paths: + {{- $paths := .paths | default (list (dict "path" "/" "pathType" "Prefix")) }} + {{- range $paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "httpgate.fullname" $ }} + port: + number: {{ $.Values.httpPort }} + {{- end }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + {{- $tlsHost := . }} + {{- if not (hasPrefix "*." $tlsHost) }} + {{- $tlsHost = printf "*.%s" $tlsHost }} + {{- end }} + - {{ $tlsHost | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + {{- end }} +--- +# gRPC Ingress (devbox- prefix, gRPC requests detected by content-type) +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "httpgate.fullname" . }}-grpc + labels: + {{- include "httpgate.labels" . | nindent 4 }} + annotations: + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/backend-protocol: "GRPC" + higress.io/prefix-match-header-host: devbox- + higress.io/prefix-match-header-content-type: application/grpc + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + {{- $host := .host }} + {{- if not (hasPrefix "*." $host) }} + {{- $host = printf "*.%s" $host }} + {{- end }} + - host: {{ $host | quote }} + http: + paths: + {{- $paths := .paths | default (list (dict "path" "/" "pathType" "Prefix")) }} + {{- range $paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "httpgate.fullname" $ }}-grpc + port: + number: {{ $.Values.httpPort }} + {{- end }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + {{- $tlsHost := . }} + {{- if not (hasPrefix "*." $tlsHost) }} + {{- $tlsHost = printf "*.%s" $tlsHost }} + {{- end }} + - {{ $tlsHost | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/service.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/service.yaml new file mode 100644 index 0000000..37cb8f3 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/service.yaml @@ -0,0 +1,40 @@ +{{- if .Values.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "httpgate.fullname" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} +spec: + selector: + {{- include "httpgate.selectorLabels" . | nindent 4 }} + ports: + - name: http + port: {{ .Values.httpPort }} + targetPort: {{ .Values.httpPort }} + protocol: TCP + type: ClusterIP + {{- if .Values.service.preferSameNode }} + trafficDistribution: PreferSameNode + {{- end }} +--- +# Separate Service for gRPC traffic (same port, but allows different Ingress backend-protocol) +apiVersion: v1 +kind: Service +metadata: + name: {{ include "httpgate.fullname" . }}-grpc + labels: + {{- include "httpgate.labels" . | nindent 4 }} +spec: + selector: + {{- include "httpgate.selectorLabels" . | nindent 4 }} + ports: + - name: grpc + port: {{ .Values.httpPort }} + targetPort: {{ .Values.httpPort }} + protocol: TCP + type: ClusterIP + {{- if .Values.service.preferSameNode }} + trafficDistribution: PreferSameNode + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/templates/serviceaccount.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/serviceaccount.yaml new file mode 100644 index 0000000..b7e6975 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if and .Values.enabled .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "httpgate.serviceAccountName" . }} + labels: + {{- include "httpgate.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/httpgate/values.yaml b/v2/deploy/charts/devbox-v2/charts/httpgate/values.yaml new file mode 100644 index 0000000..5c7b349 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/httpgate/values.yaml @@ -0,0 +1,109 @@ +enabled: true + +# Default values for httpgate + +image: ghcr.io/sealos-apps/devbox-v2-httpgate:latest +imagePullPolicy: Always + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# HTTP port exposed on the host (hostPort) +# The gateway listens on this port on each node +httpPort: 8080 + +# Agent port (used when port is "agent" instead of a number in the host header) +# Example: devbox-my-app-agent.devbox.sealos.io will route to this port +agentPort: 9757 + +# Service configuration +service: + # Enable trafficDistribution: PreferSameNode (requires K8s 1.34+) + # Routes traffic to pods on the same node when possible + # https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution + preferSameNode: false + +# Ingress configuration +ingress: + enabled: false + ingressClassName: nginx + annotations: {} + # Add custom annotations here (backend-protocol is set automatically) + hosts: + - host: "*.devbox.example.com" + paths: + - path: / + pathType: Prefix + tls: [] + # - hosts: + # - "*.devbox.example.com" + # secretName: devbox-tls + +# Additional environment variables +# These will be added to the ConfigMap and injected into the pods +env: {} + # Example: + # LOG_LEVEL: "debug" + # KUBECONFIG: "/path/to/kubeconfig" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# RBAC settings +rbac: + # Specifies whether RBAC resources should be created + create: true + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 100m + memory: 100Mi + +# Node selector for DaemonSet scheduling +# Example: Only run on nodes with specific label +# nodeSelector: +# role: gateway +nodeSelector: {} + +# Tolerations for DaemonSet scheduling +# Example: Run on master nodes +# tolerations: +# - key: node-role.kubernetes.io/master +# effect: NoSchedule +tolerations: [] + +# Affinity rules for DaemonSet scheduling +affinity: {} + +# Priority class name for pod scheduling priority +# system-node-critical ensures the pod has high priority and is less likely to be evicted +priorityClassName: system-node-critical + +# Update strategy for DaemonSet +updateStrategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/.helmignore b/v2/deploy/charts/devbox-v2/charts/sshgate/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/Chart.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/Chart.yaml new file mode 100644 index 0000000..e2ce8be --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: sshgate +description: A Kubernetes-native SSH gateway that routes SSH connections to Devbox pods based on client public key +type: application +version: 0.1.0 +appVersion: "latest" +keywords: + - ssh + - gateway + - devbox + - sealos +maintainers: + - name: sshgate diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/_helpers.tpl b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/_helpers.tpl new file mode 100644 index 0000000..8444902 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "sshgate.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "sshgate.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sshgate.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "sshgate.labels" -}} +helm.sh/chart: {{ include "sshgate.chart" . }} +{{ include "sshgate.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "sshgate.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sshgate.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "sshgate.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "sshgate.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrole.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrole.yaml new file mode 100644 index 0000000..95b1bd8 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrole.yaml @@ -0,0 +1,12 @@ +{{- if and .Values.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "sshgate.fullname" . }} + labels: + {{- include "sshgate.labels" . | nindent 4 }} +rules: +- apiGroups: [""] + resources: ["secrets", "pods"] + verbs: ["get", "list", "watch"] +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrolebinding.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..60b4d12 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/clusterrolebinding.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.enabled .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "sshgate.fullname" . }} + labels: + {{- include "sshgate.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "sshgate.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "sshgate.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/configmap.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/configmap.yaml new file mode 100644 index 0000000..3447db1 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/configmap.yaml @@ -0,0 +1,26 @@ +{{- if .Values.enabled -}} +{{- $existingConfigMap := lookup "v1" "ConfigMap" .Release.Namespace (include "sshgate.fullname" .) -}} +{{- $sshHostKeySeed := coalesce .Values.sshHostKeySeed (dig "data" "SSH_HOST_KEY_SEED" "" $existingConfigMap) (randAlphaNum 32) -}} +{{- $defaults := dict + "SSH_HOST_KEY_SEED" $sshHostKeySeed + "SSH_LISTEN_ADDR" (printf ":%d" (int .Values.sshPort)) + "ENABLE_PROXY_PROTOCOL" (.Values.proxyProtocol.enabled | toString) +-}} +{{- if .Values.proxyProtocol.trustedCIDRs -}} + {{- $_ := set $defaults "PROXY_PROTOCOL_TRUSTED_CIDRS" (.Values.proxyProtocol.trustedCIDRs | join ",") -}} +{{- end -}} +{{- if .Values.proxyProtocol.skipCIDRs -}} + {{- $_ := set $defaults "PROXY_PROTOCOL_SKIP_CIDRS" (.Values.proxyProtocol.skipCIDRs | join ",") -}} +{{- end -}} +{{- $config := mergeOverwrite $defaults .Values.env -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "sshgate.fullname" . }} + labels: + {{- include "sshgate.labels" . | nindent 4 }} +data: + {{- range $key, $value := $config }} + {{ $key }}: {{ $value | toString | quote }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/daemonset.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/daemonset.yaml new file mode 100644 index 0000000..bb49e4a --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/daemonset.yaml @@ -0,0 +1,76 @@ +{{- if .Values.enabled -}} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "sshgate.fullname" . }} + labels: + {{- include "sshgate.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "sshgate.selectorLabels" . | nindent 6 }} + updateStrategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "sshgate.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "sshgate.serviceAccountName" . }} + {{- with .Values.priorityClassName }} + priorityClassName: {{ . }} + {{- end }} + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: {{ .Values.image }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + ports: + - name: ssh + containerPort: {{ .Values.sshPort }} + hostPort: {{ .Values.sshPort }} + protocol: TCP + envFrom: + - configMapRef: + name: {{ include "sshgate.fullname" . }} + livenessProbe: + tcpSocket: + port: {{ .Values.sshPort }} + initialDelaySeconds: 10 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: {{ .Values.sshPort }} + initialDelaySeconds: 5 + periodSeconds: 5 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/templates/serviceaccount.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/serviceaccount.yaml new file mode 100644 index 0000000..c2b41f3 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if and .Values.enabled .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "sshgate.serviceAccountName" . }} + labels: + {{- include "sshgate.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/charts/sshgate/values.yaml b/v2/deploy/charts/devbox-v2/charts/sshgate/values.yaml new file mode 100644 index 0000000..b5b8be5 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/charts/sshgate/values.yaml @@ -0,0 +1,102 @@ +enabled: true + +# Default values for sshgate + +image: ghcr.io/sealos-apps/devbox-v2-sshgate:latest +imagePullPolicy: Always + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# SSH port exposed on the host (hostPort) +# The gateway listens on this port on each node +sshPort: 2222 + +# SSH Host Key Seed for deterministic key generation +# All DaemonSet pods with the same seed will generate identical host keys +# Warning: Keep this secure. Anyone with the seed can regenerate the private key. +# If empty, a random 32-character seed will be auto-generated on first install +sshHostKeySeed: "" + +# Proxy Protocol configuration +# When enabled, the gateway will parse PROXY protocol headers from load balancers +proxyProtocol: + # Enable PROXY protocol support + enabled: false + # Trusted source CIDRs (load balancer IPs) + # If empty, all sources are trusted when proxyProtocol is enabled + # Example: ["10.0.0.0/8", "172.16.0.0/12"] + trustedCIDRs: [] + # Skip CIDRs - connections from these IPs bypass PROXY protocol parsing + # Useful for Kubernetes pod-to-pod traffic + # Example: ["10.244.0.0/16"] + skipCIDRs: [] + +# Additional environment variables +# These will be added to the ConfigMap and injected into the pods +env: {} + # Example: + # LOG_LEVEL: "debug" + # CUSTOM_VAR: "value" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# RBAC settings +rbac: + # Specifies whether RBAC resources should be created + create: true + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 100m + memory: 100Mi + +# Node selector for DaemonSet scheduling +# Example: Only run on nodes with specific label +# nodeSelector: +# role: gateway +nodeSelector: {} + +# Tolerations for DaemonSet scheduling +# Example: Run on master nodes +# tolerations: +# - key: node-role.kubernetes.io/master +# effect: NoSchedule +tolerations: [] + +# Affinity rules for DaemonSet scheduling +affinity: {} + +# Priority class name for pod scheduling priority +# system-node-critical ensures the pod has high priority and is less likely to be evicted +priorityClassName: system-node-critical + +# Update strategy for DaemonSet +updateStrategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 diff --git a/v2/deploy/charts/devbox-v2/templates/_helpers.tpl b/v2/deploy/charts/devbox-v2/templates/_helpers.tpl new file mode 100644 index 0000000..0557153 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/_helpers.tpl @@ -0,0 +1,69 @@ +{{/* +Expand the chart name. +*/}} +{{- define "devbox-v2.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "devbox-v2.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels. +*/}} +{{- define "devbox-v2.labels" -}} +helm.sh/chart: {{ include "devbox-v2.chart" . }} +app.kubernetes.io/name: {{ include "devbox-v2.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Common labels plus component label. +*/}} +{{- define "devbox-v2.componentLabels" -}} +{{ include "devbox-v2.labels" .context }} +app.kubernetes.io/component: {{ .component }} +{{- end -}} + +{{/* +Render a boolean as true/false string. +*/}} +{{- define "devbox-v2.boolString" -}} +{{- if . -}}true{{- else -}}false{{- end -}} +{{- end -}} + +{{/* +Public domain fallback. +*/}} +{{- define "devbox-v2.publicDomain" -}} +{{- default .Values.clusterDomain .Values.publicDomain -}} +{{- end -}} + +{{/* +SSH domain fallback. +*/}} +{{- define "devbox-v2.sshDomain" -}} +{{- default .Values.clusterDomain .Values.sshDomain -}} +{{- end -}} + +{{/* +Use the namespace passed by helm install/upgrade. +*/}} +{{- define "devbox-v2.namespace" -}} +{{- .Release.Namespace -}} +{{- end -}} + +{{/* +Default retag service URL follows the release namespace. +*/}} +{{- define "devbox-v2.retagServiceUrl" -}} +{{- printf "http://devbox-service.%s.svc.cluster.local:8092" .Release.Namespace -}} +{{- end -}} diff --git a/v2/deploy/charts/devbox-v2/templates/controller-clusterrolebindings.yaml b/v2/deploy/charts/devbox-v2/templates/controller-clusterrolebindings.yaml new file mode 100644 index 0000000..89c1752 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-clusterrolebindings.yaml @@ -0,0 +1,30 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: devbox-manager-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: {{ $namespace }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: devbox-metrics-auth-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: devbox-metrics-auth-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: {{ $namespace }} diff --git a/v2/deploy/charts/devbox-v2/templates/controller-clusterroles.yaml b/v2/deploy/charts/devbox-v2/templates/controller-clusterroles.yaml new file mode 100644 index 0000000..fba9ab2 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-clusterroles.yaml @@ -0,0 +1,260 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devbox-admin-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - '*' +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devbox-editor-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devbox-viewer-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + verbs: + - get + - list + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-admin-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - '*' +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-editor-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/name: devbox + name: devbox-devboxrelease-viewer-role +rules: +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases + verbs: + - get + - list + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxreleases/status + verbs: + - get + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-manager-role +rules: +- apiGroups: + - "" + resources: + - configmaps + - events + - pods + - secrets + - serviceaccounts + - services + verbs: + - '*' +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - nodes/status + verbs: + - get +- apiGroups: + - "" + resources: + - pods/status + verbs: + - get + - patch + - update +- apiGroups: + - devbox.sealos.io + resources: + - devboxes + - devboxreleases + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/finalizers + - devboxreleases/finalizers + verbs: + - update +- apiGroups: + - devbox.sealos.io + resources: + - devboxes/status + - devboxreleases/status + verbs: + - get + - patch + - update +- apiGroups: + - node.k8s.io + resources: + - runtimeclasses + verbs: + - get + - list + - watch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + - roles + verbs: + - '*' + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-metrics-auth-role +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-metrics-reader +rules: +- nonResourceURLs: + - /metrics + verbs: + - get diff --git a/v2/deploy/charts/devbox-v2/templates/controller-daemonset.yaml b/v2/deploy/charts/devbox-v2/templates/controller-daemonset.yaml new file mode 100644 index 0000000..680efc9 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-daemonset.yaml @@ -0,0 +1,135 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 4 }} + control-plane: controller-manager + name: devbox-controller-manager + namespace: {{ $namespace }} +spec: + revisionHistoryLimit: 10 + selector: + matchLabels: + control-plane: controller-manager + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 8 }} + control-plane: controller-manager + spec: + containers: + - args: + - --metrics-bind-address=:8443 + - --health-probe-bind-address=:8081 + - {{ printf "--default-base-image=%s" .Values.controller.config.defaultBaseImage | quote }} + - {{ printf "--merge-base-image-top-layer=%s" (include "devbox-v2.boolString" .Values.controller.config.mergeBaseImageTopLayer) | quote }} + - {{ printf "--registry-addr=%s" .Values.registry.address | quote }} + - {{ printf "--registry-user=%s" .Values.registry.user | quote }} + - {{ printf "--registry-password=%s" .Values.registry.password | quote }} + command: + - /manager + env: + - name: NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: {{ .Values.controller.image }} + imagePullPolicy: {{ .Values.controller.imagePullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 8081 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 20 + successThreshold: 1 + timeoutSeconds: 1 + name: manager + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readyz + port: 8081 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + {{- toYaml .Values.controller.resources | nindent 10 }} + securityContext: + privileged: true + runAsUser: 0 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /run/containerd + name: containerd-run-dir + - mountPath: /var/run/containerd + name: containerd-var-run-dir + - mountPath: /var/lib/containerd + mountPropagation: Bidirectional + name: containerd-dir + - mountPath: /var/lib/containerd-stargz-grpc + mountPropagation: Bidirectional + name: stargz-dir + - mountPath: /etc/containerd/certs.d + name: hosts-dir + - mountPath: /tmp + name: tmp-dir + dnsPolicy: ClusterFirst + {{- with .Values.controller.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.controller.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + priorityClassName: system-node-critical + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + runAsUser: 0 + serviceAccount: controller-manager + serviceAccountName: devbox-controller-manager + terminationGracePeriodSeconds: 10 + {{- with .Values.controller.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - hostPath: + path: /run/containerd + type: Directory + name: containerd-run-dir + - hostPath: + path: /var/run/containerd + type: Directory + name: containerd-var-run-dir + - hostPath: + path: /var/lib/containerd + type: Directory + name: containerd-dir + - hostPath: + path: /var/lib/containerd-stargz-grpc + type: DirectoryOrCreate + name: stargz-dir + - hostPath: + path: /etc/containerd/certs.d + type: Directory + name: hosts-dir + - hostPath: + path: /tmp + type: Directory + name: tmp-dir + updateStrategy: + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + type: RollingUpdate diff --git a/v2/deploy/charts/devbox-v2/templates/controller-role.yaml b/v2/deploy/charts/devbox-v2/templates/controller-role.yaml new file mode 100644 index 0000000..8105f48 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-role.yaml @@ -0,0 +1,40 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 4 }} + name: devbox-leader-election-role + namespace: {{ $namespace }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch diff --git a/v2/deploy/charts/devbox-v2/templates/controller-rolebinding.yaml b/v2/deploy/charts/devbox-v2/templates/controller-rolebinding.yaml new file mode 100644 index 0000000..20d724e --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-rolebinding.yaml @@ -0,0 +1,16 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 4 }} + name: devbox-leader-election-rolebinding + namespace: {{ $namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: devbox-leader-election-role +subjects: +- kind: ServiceAccount + name: devbox-controller-manager + namespace: {{ $namespace }} diff --git a/v2/deploy/charts/devbox-v2/templates/controller-runtimeclasses.yaml b/v2/deploy/charts/devbox-v2/templates/controller-runtimeclasses.yaml new file mode 100644 index 0000000..c0be673 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-runtimeclasses.yaml @@ -0,0 +1,12 @@ +apiVersion: node.k8s.io/v1 +handler: devbox-runc +kind: RuntimeClass +metadata: + name: devbox-runtime + +--- +apiVersion: node.k8s.io/v1 +handler: devbox-stargz-runc +kind: RuntimeClass +metadata: + name: devbox-stargz-runtime diff --git a/v2/deploy/charts/devbox-v2/templates/controller-service.yaml b/v2/deploy/charts/devbox-v2/templates/controller-service.yaml new file mode 100644 index 0000000..1190670 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-service.yaml @@ -0,0 +1,17 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 4 }} + control-plane: controller-manager + name: devbox-controller-manager-metrics-service + namespace: {{ $namespace }} +spec: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: 8443 + selector: + control-plane: controller-manager diff --git a/v2/deploy/charts/devbox-v2/templates/controller-serviceaccount.yaml b/v2/deploy/charts/devbox-v2/templates/controller-serviceaccount.yaml new file mode 100644 index 0000000..ecfaeaa --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/controller-serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- $namespace := include "devbox-v2.namespace" . -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "controller") | nindent 4 }} + name: devbox-controller-manager + namespace: {{ $namespace }} diff --git a/v2/deploy/charts/devbox-v2/templates/crd-devboxes.yaml b/v2/deploy/charts/devbox-v2/templates/crd-devboxes.yaml new file mode 100644 index 0000000..f988757 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/crd-devboxes.yaml @@ -0,0 +1,3935 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.20.1 + name: devboxes.devbox.sealos.io +spec: + group: devbox.sealos.io + names: + kind: Devbox + listKind: DevboxList + plural: devboxes + singular: devbox + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.state + name: State + type: string + - jsonPath: .status.network.type + name: NetworkType + type: string + - jsonPath: .status.network.uniqueID + name: UniqueID + type: string + - jsonPath: .status.network.nodePort + name: NodePort + type: integer + - jsonPath: .status.phase + name: Phase + type: string + - jsonPath: .status.node + name: Node + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: Devbox is the Schema for the devboxes API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DevboxSpec defines the desired state of Devbox + properties: + affinity: + description: Affinity is a group of affinity scheduling rules. + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the + pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + type: array + x-kubernetes-list-type: atomic + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate + this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. + avoid putting this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and subtracting + "weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + config: + properties: + annotations: + additionalProperties: + type: string + type: object + appPorts: + default: + - name: devbox-app-port + port: 8080 + protocol: TCP + items: + description: ServicePort contains information on service's port. + properties: + appProtocol: + description: |- + The application protocol for this port. + This is used as a hint for implementations to offer richer behavior for protocols that they understand. + This field follows standard Kubernetes label syntax. + Valid values are either: + + * Un-prefixed protocol names - reserved for IANA standard service names (as per + RFC-6335 and https://www.iana.org/assignments/service-names). + + * Kubernetes-defined prefixed names: + * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + + * Other protocols should use implementation-defined prefixed names such as + mycompany.com/my-custom-protocol. + type: string + name: + description: |- + The name of this port within the service. This must be a DNS_LABEL. + All ports within a ServiceSpec must have unique names. When considering + the endpoints for a Service, this must match the 'name' field in the + EndpointPort. + Optional if only one ServicePort is defined on this service. + type: string + nodePort: + description: |- + The port on each node on which this service is exposed when type is + NodePort or LoadBalancer. Usually assigned by the system. If a value is + specified, in-range, and not in use it will be used, otherwise the + operation will fail. If not specified, a port will be allocated if this + Service requires one. If this field is specified when creating a + Service which does not need it, creation will fail. This field will be + wiped when updating a Service to no longer need it (e.g. changing type + from NodePort to ClusterIP). + More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + format: int32 + type: integer + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: |- + The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + Default is TCP. + type: string + targetPort: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the pods targeted by the service. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + If this is a string, it will be looked up as a named port in the + target Pod's container ports. If this is not specified, the value + of the 'port' field is used (an identity map). + This field is ignored for services with clusterIP=None, and should be + omitted or set equal to the 'port' field. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + x-kubernetes-int-or-string: true + required: + - port + type: object + type: array + args: + description: kubebuilder:validation:Optional + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: |- + Name of the environment variable. + May consist of any printable ASCII characters except '='. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + fileKeyRef: + description: |- + FileKeyRef selects a key of the env file. + Requires the EnvFiles feature gate to be enabled. + properties: + key: + description: |- + The key within the env file. An invalid key will prevent the pod from starting. + The keys defined within a source may consist of any printable ASCII characters except '='. + During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters. + type: string + optional: + default: false + description: |- + Specify whether the file or its key must be defined. If the file or key + does not exist, then the env var is not published. + If optional is set to true and the specified key does not exist, + the environment variable will not be set in the Pod's containers. + + If optional is set to false and the specified key does not exist, + an error will be returned during Pod creation. + type: boolean + path: + description: |- + The path within the volume from which to select the file. + Must be relative and may not contain the '..' path or start with '..'. + type: string + volumeName: + description: The name of the volume mount containing + the env file. + type: string + required: + - key + - path + - volumeName + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + labels: + additionalProperties: + type: string + type: object + ports: + default: + - containerPort: 22 + name: devbox-ssh-port + protocol: TCP + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + releaseArgs: + default: + - /home/devbox/project/entrypoint.sh + items: + type: string + type: array + releaseCommand: + default: + - /bin/bash + - -c + items: + type: string + type: array + user: + default: devbox + type: string + volumeMounts: + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified + (which defaults to None). + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + recursiveReadOnly: + description: |- + RecursiveReadOnly specifies whether read-only mounts should be handled + recursively. + + If ReadOnly is false, this field has no meaning and must be unspecified. + + If ReadOnly is true, and this field is set to Disabled, the mount is not made + recursively read-only. If this field is set to IfPossible, the mount is made + recursively read-only, if it is supported by the container runtime. If this + field is set to Enabled, the mount is made recursively read-only if it is + supported by the container runtime, otherwise the pod will not be started and + an error will be generated to indicate the reason. + + If this field is set to IfPossible or Enabled, MountPropagation must be set to + None (or be unspecified, which defaults to None). + + If this field is not specified, it is treated as an equivalent of Disabled. + type: string + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + volumes: + items: + description: Volume represents a named volume in a pod that + may be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree + awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: |- + azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type + are redirected to the disk.csi.azure.com CSI driver. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: + None, Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in + the blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the + blob storage + type: string + fsType: + default: ext4 + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single + blob disk per storage account Managed: azure managed + data disk (only in managed availability set). defaults + to shared' + type: string + readOnly: + default: false + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: |- + azureFile represents an Azure File Service mount on the host and bind mount to the pod. + Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type + are redirected to the file.csi.azure.com CSI driver. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that + contains Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: |- + cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. + Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported. + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + x-kubernetes-list-type: atomic + path: + description: 'path is Optional: Used as the mounted + root, rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + Deprecated: Cinder is deprecated. All operations for the in-tree cinder type + are redirected to the cinder.csi.openstack.org CSI driver. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should + populate this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents + ephemeral storage that is handled by certain external + CSI drivers. + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the + pod that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume + file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the + pod: only annotations, labels, name, namespace + and uid are supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in + the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must not + be absolute or contain the ''..'' path. Must + be utf-8 encoded. The first item of the relative + path must not start with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for + volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of + the exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + x-kubernetes-list-type: atomic + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + x-kubernetes-list-type: atomic + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource + being referenced + type: string + name: + description: Name is the name of resource + being referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + Users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over + volumes to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeAttributesClassName: + description: |- + volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. + If specified, the CSI driver will create or update the volume with the attributes defined + in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, + it can be changed after the claim is created. An empty string or nil value indicates that no + VolumeAttributesClass will be applied to the claim. If the claim enters an Infeasible error state, + this field can be reset to its previous value (including nil) to cancel the modification. + If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be + set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource + exists. + More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that + is attached to a kubelet's host machine and then exposed + to the pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + x-kubernetes-list-type: atomic + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. + properties: + driver: + description: driver is the name of the driver to use + for this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds + extra command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: |- + flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. + Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported. + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. + This is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree + gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. + properties: + endpoints: + description: endpoints is the endpoint name that details + Glusterfs topology. + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + image: + description: |- + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + The volume is resolved at pod startup depending on which PullPolicy value is provided: + + - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + + The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. + A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. + The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. + The volume will be mounted read-only (ro) and non-executable files (noexec). + Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. + The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. + properties: + pullPolicy: + description: |- + Policy for pulling OCI objects. Possible values are: + Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. + Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. + IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + type: string + reference: + description: |- + Required: Image or artifact reference to be used. + Behaves in the same way as pod.spec.containers[*].image. + Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. + type: string + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support + iSCSI Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support + iSCSI Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + default: default + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + x-kubernetes-list-type: atomic + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI + target and initiator authentication + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: |- + photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. + Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: |- + portworxVolume represents a portworx volume attached and mounted on kubelets host machine. + Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type + are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate + is on. + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx + volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: |- + sources is the list of volume projections. Each entry in this list + handles one source. + items: + description: |- + Projection that may be projected along with other supported volume types. + Exactly one of these fields must be set. + properties: + clusterTrustBundle: + description: |- + ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field + of ClusterTrustBundle objects in an auto-updating file. + + Alpha, gated by the ClusterTrustBundleProjection feature gate. + + ClusterTrustBundle objects can either be selected by name, or by the + combination of signer name and a label selector. + + Kubelet performs aggressive normalization of the PEM contents written + into the pod filesystem. Esoteric PEM features such as inter-block + comments and block headers are stripped. Certificates are deduplicated. + The ordering of certificates within the file is arbitrary, and Kubelet + may change the order over time. + properties: + labelSelector: + description: |- + Select all ClusterTrustBundles that match this label selector. Only has + effect if signerName is set. Mutually-exclusive with name. If unset, + interpreted as "match nothing". If set but empty, interpreted as "match + everything". + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + name: + description: |- + Select a single ClusterTrustBundle by object name. Mutually-exclusive + with signerName and labelSelector. + type: string + optional: + description: |- + If true, don't block pod startup if the referenced ClusterTrustBundle(s) + aren't available. If using name, then the named ClusterTrustBundle is + allowed not to exist. If using signerName, then the combination of + signerName and labelSelector is allowed to match zero + ClusterTrustBundles. + type: boolean + path: + description: Relative path from the volume + root to write the bundle. + type: string + signerName: + description: |- + Select all ClusterTrustBundles that match this signer name. + Mutually-exclusive with name. The contents of all selected + ClusterTrustBundles will be unified and deduplicated. + type: string + required: + - path + type: object + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path + within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the + ConfigMap or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the + downwardAPI data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name, namespace and uid are supported.' + properties: + apiVersion: + description: Version of the schema + the FieldPath is written in terms + of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to + select in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the + relative path name of the file to + be created. Must not be absolute or + contain the ''..'' path. Must be utf-8 + encoded. The first item of the relative + path must not start with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env + vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output + format of the exposed resources, + defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource + to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podCertificate: + description: |- + Projects an auto-rotating credential bundle (private key and certificate + chain) that the pod can use either as a TLS client or server. + + Kubelet generates a private key and uses it to send a + PodCertificateRequest to the named signer. Once the signer approves the + request and issues a certificate chain, Kubelet writes the key and + certificate chain to the pod filesystem. The pod does not start until + certificates have been issued for each podCertificate projected volume + source in its spec. + + Kubelet will begin trying to rotate the certificate at the time indicated + by the signer using the PodCertificateRequest.Status.BeginRefreshAt + timestamp. + + Kubelet can write a single file, indicated by the credentialBundlePath + field, or separate files, indicated by the keyPath and + certificateChainPath fields. + + The credential bundle is a single file in PEM format. The first PEM + entry is the private key (in PKCS#8 format), and the remaining PEM + entries are the certificate chain issued by the signer (typically, + signers will return their certificate chain in leaf-to-root order). + + Prefer using the credential bundle format, since your application code + can read it atomically. If you use keyPath and certificateChainPath, + your application must make two separate file reads. If these coincide + with a certificate rotation, it is possible that the private key and leaf + certificate you read may not correspond to each other. Your application + will need to check for this condition, and re-read until they are + consistent. + + The named signer controls chooses the format of the certificate it + issues; consult the signer implementation's documentation to learn how to + use the certificates it issues. + properties: + certificateChainPath: + description: |- + Write the certificate chain at this path in the projected volume. + + Most applications should use credentialBundlePath. When using keyPath + and certificateChainPath, your application needs to check that the key + and leaf certificate are consistent, because it is possible to read the + files mid-rotation. + type: string + credentialBundlePath: + description: |- + Write the credential bundle at this path in the projected volume. + + The credential bundle is a single file that contains multiple PEM blocks. + The first PEM block is a PRIVATE KEY block, containing a PKCS#8 private + key. + + The remaining blocks are CERTIFICATE blocks, containing the issued + certificate chain from the signer (leaf and any intermediates). + + Using credentialBundlePath lets your Pod's application code make a single + atomic read that retrieves a consistent key and certificate chain. If you + project them to separate files, your application code will need to + additionally check that the leaf certificate was issued to the key. + type: string + keyPath: + description: |- + Write the key at this path in the projected volume. + + Most applications should use credentialBundlePath. When using keyPath + and certificateChainPath, your application needs to check that the key + and leaf certificate are consistent, because it is possible to read the + files mid-rotation. + type: string + keyType: + description: |- + The type of keypair Kubelet will generate for the pod. + + Valid values are "RSA3072", "RSA4096", "ECDSAP256", "ECDSAP384", + "ECDSAP521", and "ED25519". + type: string + maxExpirationSeconds: + description: |- + maxExpirationSeconds is the maximum lifetime permitted for the + certificate. + + Kubelet copies this value verbatim into the PodCertificateRequests it + generates for this projection. + + If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver + will reject values shorter than 3600 (1 hour). The maximum allowable + value is 7862400 (91 days). + + The signer implementation is then free to issue a certificate with any + lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 + seconds (1 hour). This constraint is enforced by kube-apiserver. + `kubernetes.io` signers will never issue certificates with a lifetime + longer than 24 hours. + format: int32 + type: integer + signerName: + description: Kubelet's generated CSRs will + be addressed to this signer. + type: string + userAnnotations: + additionalProperties: + type: string + description: |- + userAnnotations allow pod authors to pass additional information to + the signer implementation. Kubernetes does not restrict or validate this + metadata in any way. + + These values are copied verbatim into the `spec.unverifiedUserAnnotations` field of + the PodCertificateRequest objects that Kubelet creates. + + Entries are subject to the same validation as object metadata annotations, + with the addition that all keys must be domain-prefixed. No restrictions + are placed on values, except an overall size limitation on the entire field. + + Signers should document the keys and values they support. Signers should + deny requests that contain keys they do not recognize. + type: object + required: + - keyType + - signerName + type: object + secret: + description: secret information about the secret + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path + within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional field specify whether + the Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information + about the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + x-kubernetes-list-type: atomic + type: object + quobyte: + description: |- + quobyte represents a Quobyte mount on the host that shares a pod's lifetime. + Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported. + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + default: /etc/ceph/keyring + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + x-kubernetes-list-type: atomic + pool: + default: rbd + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + default: admin + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: |- + scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. + properties: + fsType: + default: xfs + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + default: ThinProvisioned + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool + associated with the protection domain. + type: string + system: + description: system is the name of the storage system + as configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a + volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + x-kubernetes-list-type: atomic + optional: + description: optional field specify whether the Secret + or its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: |- + storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: |- + vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. + Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type + are redirected to the csi.vsphere.vmware.com CSI driver. + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy + Based Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies + vSphere volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + workingDir: + default: /home/devbox/project + type: string + type: object + image: + type: string + kubeAccess: + properties: + enabled: + type: boolean + roleTemplate: + default: edit + enum: + - view + - edit + - admin + type: string + type: object + network: + properties: + extraPorts: + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + type: + enum: + - NodePort + - Tailnet + - SSHGate + type: string + required: + - type + type: object + nodeSelector: + additionalProperties: + type: string + type: object + resource: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: ResourceList is a set of (resource name, quantity) pairs. + type: object + runtimeClassName: + type: string + state: + default: Running + enum: + - Running + - Paused + - Stopped + - Shutdown + type: string + storageLimit: + description: devbox storage limit, `storageLimit` will be used to + generate the devbox pod label. + type: string + templateID: + type: string + tolerations: + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators). + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + required: + - config + - image + - network + - resource + - state + type: object + status: + description: DevboxStatus defines the observed state of Devbox + properties: + commitRecords: + additionalProperties: + properties: + baseImage: + description: BaseImage is the image of the that devbox is running + on + type: string + commitImage: + description: CommitImage is the image of the that devbox is + committed to + type: string + commitStatus: + default: Pending + description: CommitStatus is the status of the commit + enum: + - Success + - Failed + - Pending + - Committing + type: string + commitTime: + description: CommitTime is the time when the commit is created + format: date-time + type: string + generateTime: + description: GenerateTime is the time when the commit is generated + format: date-time + type: string + node: + description: Node is the node name + type: string + runtimeClassName: + description: RuntimeClassName is the runtime class used by this + content record. + type: string + runtimeHandler: + description: RuntimeHandler is the runtime handler annotation + used by this content record. + type: string + scheduleTime: + description: ScheduleTime is the time when the commit is scheduled + format: date-time + type: string + snapshotter: + description: Snapshotter is the containerd snapshotter used + by this content record. + type: string + updateTime: + description: UpdateTime is the time when the commit is updated + format: date-time + type: string + required: + - commitStatus + type: object + description: CommitRecords is the records of the devbox commits + type: object + conditions: + default: [] + description: Conditions represent the latest available observations + of the Devbox's state. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + contentID: + type: string + lastContainerStatus: + description: ContainerStatus contains details for the current status + of this container. + properties: + allocatedResources: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + AllocatedResources represents the compute resources allocated for this container by the + node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission + and after successfully admitting desired pod resize. + type: object + allocatedResourcesStatus: + description: |- + AllocatedResourcesStatus represents the status of various resources + allocated for this Pod. + items: + description: ResourceStatus represents the status of a single + resource allocated to a Pod. + properties: + name: + description: |- + Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec. + For DRA resources, the value must be "claim:/". + When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container. + type: string + resources: + description: |- + List of unique resources health. Each element in the list contains an unique resource ID and its health. + At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node. + If other Pod on the same Node reports the status with the same resource ID, it must be the same resource they share. + See ResourceID type definition for a specific format it has in various use cases. + items: + description: |- + ResourceHealth represents the health of a resource. It has the latest device health information. + This is a part of KEP https://kep.k8s.io/4680. + properties: + health: + description: |- + Health of the resource. + can be one of: + - Healthy: operates as normal + - Unhealthy: reported unhealthy. We consider this a temporary health issue + since we do not have a mechanism today to distinguish + temporary and permanent issues. + - Unknown: The status cannot be determined. + For example, Device Plugin got unregistered and hasn't been re-registered since. + + In future we may want to introduce the PermanentlyUnhealthy Status. + type: string + resourceID: + description: ResourceID is the unique identifier of + the resource. See the ResourceID type for more information. + type: string + required: + - resourceID + type: object + type: array + x-kubernetes-list-map-keys: + - resourceID + x-kubernetes-list-type: map + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + containerID: + description: |- + ContainerID is the ID of the container in the format '://'. + Where type is a container runtime identifier, returned from Version call of CRI API + (for example "containerd"). + type: string + image: + description: |- + Image is the name of container image that the container is running. + The container image may not match the image used in the PodSpec, + as it may have been resolved by the runtime. + More info: https://kubernetes.io/docs/concepts/containers/images. + type: string + imageID: + description: |- + ImageID is the image ID of the container's image. The image ID may not + match the image ID of the image used in the PodSpec, as it may have been + resolved by the runtime. + type: string + lastState: + description: |- + LastTerminationState holds the last termination state of the container to + help debug container crashes and restarts. This field is not + populated if the container is still running and RestartCount is 0. + properties: + running: + description: Details about a running container + properties: + startedAt: + description: Time at which the container was last (re-)started + format: date-time + type: string + type: object + terminated: + description: Details about a terminated container + properties: + containerID: + description: Container's ID in the format '://' + type: string + exitCode: + description: Exit status from the last termination of + the container + format: int32 + type: integer + finishedAt: + description: Time at which the container last terminated + format: date-time + type: string + message: + description: Message regarding the last termination of + the container + type: string + reason: + description: (brief) reason from the last termination + of the container + type: string + signal: + description: Signal from the last termination of the container + format: int32 + type: integer + startedAt: + description: Time at which previous execution of the container + started + format: date-time + type: string + required: + - exitCode + type: object + waiting: + description: Details about a waiting container + properties: + message: + description: Message regarding why the container is not + yet running. + type: string + reason: + description: (brief) reason the container is not yet running. + type: string + type: object + type: object + name: + description: |- + Name is a DNS_LABEL representing the unique name of the container. + Each container in a pod must have a unique name across all container types. + Cannot be updated. + type: string + ready: + description: |- + Ready specifies whether the container is currently passing its readiness check. + The value will change as readiness probes keep executing. If no readiness + probes are specified, this field defaults to true once the container is + fully started (see Started field). + + The value is typically used to determine whether a container is ready to + accept traffic. + type: boolean + resources: + description: |- + Resources represents the compute resource requests and limits that have been successfully + enacted on the running container after it has been started or has been successfully resized. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This field depends on the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + request: + description: |- + Request is the name chosen for a request in the referenced claim. + If empty, everything from the claim is made available, otherwise + only the result of this request. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + restartCount: + description: |- + RestartCount holds the number of times the container has been restarted. + Kubelet makes an effort to always increment the value, but there + are cases when the state may be lost due to node restarts and then the value + may be reset to 0. The value is never negative. + format: int32 + type: integer + started: + description: |- + Started indicates whether the container has finished its postStart lifecycle hook + and passed its startup probe. + Initialized as false, becomes true after startupProbe is considered + successful. Resets to false when the container is restarted, or if kubelet + loses state temporarily. In both cases, startup probes will run again. + Is always true when no startupProbe is defined and container is running and + has passed the postStart lifecycle hook. The null value must be treated the + same as false. + type: boolean + state: + description: State holds details about the container's current + condition. + properties: + running: + description: Details about a running container + properties: + startedAt: + description: Time at which the container was last (re-)started + format: date-time + type: string + type: object + terminated: + description: Details about a terminated container + properties: + containerID: + description: Container's ID in the format '://' + type: string + exitCode: + description: Exit status from the last termination of + the container + format: int32 + type: integer + finishedAt: + description: Time at which the container last terminated + format: date-time + type: string + message: + description: Message regarding the last termination of + the container + type: string + reason: + description: (brief) reason from the last termination + of the container + type: string + signal: + description: Signal from the last termination of the container + format: int32 + type: integer + startedAt: + description: Time at which previous execution of the container + started + format: date-time + type: string + required: + - exitCode + type: object + waiting: + description: Details about a waiting container + properties: + message: + description: Message regarding why the container is not + yet running. + type: string + reason: + description: (brief) reason the container is not yet running. + type: string + type: object + type: object + stopSignal: + description: StopSignal reports the effective stop signal for + this container + type: string + user: + description: User represents user identity information initially + attached to the first process of the container + properties: + linux: + description: |- + Linux holds user identity information initially attached to the first process of the containers in Linux. + Note that the actual running identity can be changed if the process has enough privilege to do so. + properties: + gid: + description: GID is the primary gid initially attached + to the first process in the container + format: int64 + type: integer + supplementalGroups: + description: SupplementalGroups are the supplemental groups + initially attached to the first process in the container + items: + format: int64 + type: integer + type: array + x-kubernetes-list-type: atomic + uid: + description: UID is the primary uid initially attached + to the first process in the container + format: int64 + type: integer + required: + - gid + - uid + type: object + type: object + volumeMounts: + description: Status of volume mounts. + items: + description: VolumeMountStatus shows status of volume mounts. + properties: + mountPath: + description: MountPath corresponds to the original VolumeMount. + type: string + name: + description: Name corresponds to the name of the original + VolumeMount. + type: string + readOnly: + description: ReadOnly corresponds to the original VolumeMount. + type: boolean + recursiveReadOnly: + description: |- + RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). + An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, + depending on the mount result. + type: string + required: + - mountPath + - name + type: object + type: array + x-kubernetes-list-map-keys: + - mountPath + x-kubernetes-list-type: map + required: + - image + - imageID + - name + - ready + - restartCount + type: object + network: + properties: + nodePort: + format: int32 + type: integer + tailnet: + description: todo TailNet + type: string + type: + enum: + - NodePort + - Tailnet + - SSHGate + type: string + uniqueID: + type: string + type: object + node: + type: string + observedGeneration: + description: |- + ObservedGeneration is the most recent generation observed by the controller. + It is updated when the controller has reconciled the spec for that generation. + format: int64 + type: integer + phase: + type: string + state: + default: Running + type: string + required: + - commitRecords + type: object + type: object + x-kubernetes-validations: + - rule: self.spec.state == oldSelf.spec.state || (self.status.contentID in + self.status.commitRecords && self.status.commitRecords[self.status.contentID].commitStatus + != 'Committing') + served: true + storage: true + subresources: + status: {} diff --git a/v2/deploy/charts/devbox-v2/templates/crd-devboxreleases.yaml b/v2/deploy/charts/devbox-v2/templates/crd-devboxreleases.yaml new file mode 100644 index 0000000..bdd8538 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/crd-devboxreleases.yaml @@ -0,0 +1,91 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.20.1 + name: devboxreleases.devbox.sealos.io +spec: + group: devbox.sealos.io + names: + kind: DevBoxRelease + listKind: DevBoxReleaseList + plural: devboxreleases + singular: devboxrelease + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.phase + name: Phase + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.sourceImage + name: SourceImage + type: string + - jsonPath: .status.targetImage + name: TargetImage + type: string + - jsonPath: .spec.startDevboxAfterRelease + name: StartDevboxAfterRelease + type: boolean + name: v1alpha2 + schema: + openAPIV3Schema: + description: DevBoxRelease is the Schema for the devboxreleases API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DevBoxReleaseSpec defines the desired state of Devboxrelease. + properties: + devboxName: + type: string + notes: + type: string + startDevboxAfterRelease: + default: false + type: boolean + version: + type: string + required: + - devboxName + - version + type: object + status: + properties: + originalDevboxState: + type: string + phase: + default: Pending + enum: + - Success + - Pending + - Failed + type: string + sourceImage: + type: string + targetImage: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/v2/deploy/charts/devbox-v2/templates/frontend-appcr.yaml b/v2/deploy/charts/devbox-v2/templates/frontend-appcr.yaml new file mode 100644 index 0000000..dcb370c --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/frontend-appcr.yaml @@ -0,0 +1,23 @@ +{{- if and .Values.frontend.enabled .Values.app.enabled -}} +{{- $publicDomain := include "devbox-v2.publicDomain" . -}} +apiVersion: app.sealos.io/v1 +kind: App +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + name: devbox + namespace: {{ include "devbox-v2.namespace" . }} +spec: + data: + desc: DevBox + url: 'https://devbox.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}' + icon: 'https://devbox.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}/logo.svg' + i18n: + zh: + name: DevBox + zh-Hans: + name: DevBox + name: DevBox + type: iframe + displayType: normal +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/frontend-configmap.yaml b/v2/deploy/charts/devbox-v2/templates/frontend-configmap.yaml new file mode 100644 index 0000000..b1ad251 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/frontend-configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.frontend.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + name: devbox-frontend-config + namespace: {{ include "devbox-v2.namespace" . }} +data: + config.yaml: |- + addr: :3000 +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/frontend-deployment.yaml b/v2/deploy/charts/devbox-v2/templates/frontend-deployment.yaml new file mode 100644 index 0000000..762c786 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/frontend-deployment.yaml @@ -0,0 +1,115 @@ +{{- if .Values.frontend.enabled -}} +{{- $frontendEnv := mergeOverwrite (dict) (.Values.frontend.env | default dict) -}} +{{- if not (hasKey $frontendEnv "SEALOS_DOMAIN") -}} +{{- $_ := set $frontendEnv "SEALOS_DOMAIN" .Values.clusterDomain -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "SSH_DOMAIN") -}} +{{- $_ := set $frontendEnv "SSH_DOMAIN" (include "devbox-v2.sshDomain" .) -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "INGRESS_SECRET") -}} +{{- $_ := set $frontendEnv "INGRESS_SECRET" .Values.frontend.ingress.secretName -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "REGISTRY_ADDR") -}} +{{- $_ := set $frontendEnv "REGISTRY_ADDR" .Values.registry.address -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "ROOT_RUNTIME_NAMESPACE") -}} +{{- $_ := set $frontendEnv "ROOT_RUNTIME_NAMESPACE" (include "devbox-v2.namespace" .) -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "INGRESS_DOMAIN") -}} +{{- $_ := set $frontendEnv "INGRESS_DOMAIN" (include "devbox-v2.publicDomain" .) -}} +{{- end -}} +{{- if not (hasKey $frontendEnv "RETAG_SVC_URL") -}} +{{- $_ := set $frontendEnv "RETAG_SVC_URL" (include "devbox-v2.retagServiceUrl" .) -}} +{{- end -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + name: devbox-frontend + namespace: {{ include "devbox-v2.namespace" . }} +spec: + replicas: {{ .Values.frontend.replicaCount }} + selector: + matchLabels: + app: devbox-frontend + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 25% + maxSurge: 25% + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/frontend-configmap.yaml") . | sha256sum }} + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 8 }} + app: devbox-frontend + spec: + {{- with .Values.frontend.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + initContainers: + - name: devbox-frontend-init + image: {{ .Values.frontend.image }} + imagePullPolicy: {{ .Values.frontend.imagePullPolicy }} + env: + - name: DATABASE_URL + value: {{ index $frontendEnv "DATABASE_URL" | quote }} + command: + - sh + - -c + args: + - |- + cd /app + MIGRATION="20260125094114_add_template_repository_kind" + HAS_MIGRATION=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM _prisma_migrations WHERE migration_name='${MIGRATION}' AND rolled_back_at IS NULL LIMIT 1;") + if [ "$HAS_MIGRATION" = "1" ]; then + prisma migrate deploy + exit 0 + fi + HAS_ENUM=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM pg_enum e JOIN pg_type t ON t.oid = e.enumtypid WHERE t.typname IN ('TemplateRepositoryKind','template_repository_kind') AND e.enumlabel = 'SERVICE' LIMIT 1;") + if [ "$HAS_ENUM" = "1" ]; then + prisma migrate resolve --applied "$MIGRATION" + fi + prisma migrate deploy + containers: + - name: devbox-frontend + env: + {{- range $key := keys $frontendEnv | sortAlpha }} + - name: {{ $key }} + value: {{ index $frontendEnv $key | quote }} + {{- end }} + - name: ACCOUNT_URL + value: http://account-service.account-system.svc.cluster.local:2333 + - name: METRICS_URL + value: http://vmselect-vm-stack-victoria-metrics-k8s-stack.vm.svc.cluster.local:8481/select/0/prometheus + securityContext: + runAsNonRoot: true + runAsUser: 1001 + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + resources: + {{- toYaml .Values.frontend.resources | nindent 12 }} + image: {{ .Values.frontend.image }} + imagePullPolicy: {{ .Values.frontend.imagePullPolicy }} + volumeMounts: + - name: devbox-frontend-volume + mountPath: /config.yaml + subPath: config.yaml + {{- with .Values.frontend.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.frontend.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: devbox-frontend-volume + configMap: + name: devbox-frontend-config +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/frontend-ingress.yaml b/v2/deploy/charts/devbox-v2/templates/frontend-ingress.yaml new file mode 100644 index 0000000..cb8c666 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/frontend-ingress.yaml @@ -0,0 +1,60 @@ +{{- if and .Values.frontend.enabled .Values.frontend.ingress.enabled -}} +{{- $publicDomain := include "devbox-v2.publicDomain" . -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + annotations: + kubernetes.io/ingress.class: {{ .Values.frontend.ingress.className }} + nginx.ingress.kubernetes.io/configuration-snippet: | + more_clear_headers "X-Frame-Options:"; + more_set_headers "Content-Security-Policy: default-src * blob: data: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}; img-src * data: blob: resource: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' https://{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} https://*.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}"; + more_set_headers "X-Xss-Protection: 1; mode=block"; + higress.io/response-header-control-remove: X-Frame-Options + higress.io/response-header-control-update: | + Content-Security-Policy "default-src * blob: data: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}; img-src * data: blob: resource: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' {{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' https://{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }} https://*.{{ $publicDomain }}{{ if .Values.clusterPort }}:{{ .Values.clusterPort }}{{ end }}" + X-Xss-Protection "1; mode=block" + name: devbox-frontend + namespace: {{ include "devbox-v2.namespace" . }} +spec: + ingressClassName: {{ .Values.frontend.ingress.className }} + rules: + - host: devbox.{{ $publicDomain }} + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: devbox-frontend + port: + number: 3000 + tls: + - hosts: + - devbox.{{ $publicDomain }} + secretName: {{ .Values.frontend.ingress.secretName }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + annotations: + kubernetes.io/ingress.class: {{ .Values.frontend.ingress.className }} + name: devbox-challenge + namespace: {{ include "devbox-v2.namespace" . }} +spec: + ingressClassName: {{ .Values.frontend.ingress.className }} + rules: + - host: "" + http: + paths: + - backend: + service: + name: devbox-frontend + port: + number: 3000 + path: /api/.well-known/devbox-domain-challenge + pathType: Prefix +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/frontend-service.yaml b/v2/deploy/charts/devbox-v2/templates/frontend-service.yaml new file mode 100644 index 0000000..618ad66 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/frontend-service.yaml @@ -0,0 +1,18 @@ +{{- if .Values.frontend.enabled -}} +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "frontend") | nindent 4 }} + app: devbox-frontend + name: devbox-frontend + namespace: {{ include "devbox-v2.namespace" . }} +spec: + ports: + - name: http + port: 3000 + protocol: TCP + targetPort: 3000 + selector: + app: devbox-frontend +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-clusterrole.yaml b/v2/deploy/charts/devbox-v2/templates/server-clusterrole.yaml new file mode 100644 index 0000000..6926bc7 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-clusterrole.yaml @@ -0,0 +1,19 @@ +{{- if .Values.server.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: devbox-server +rules: + - apiGroups: ["devbox.sealos.io"] + resources: ["devboxes"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["pods/exec"] + verbs: ["create"] + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list", "watch"] +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-clusterrolebinding.yaml b/v2/deploy/charts/devbox-v2/templates/server-clusterrolebinding.yaml new file mode 100644 index 0000000..e1fe303 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-clusterrolebinding.yaml @@ -0,0 +1,14 @@ +{{- if .Values.server.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: devbox-server +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: devbox-server +subjects: + - kind: ServiceAccount + name: devbox-server + namespace: {{ include "devbox-v2.namespace" . }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-configmap.yaml b/v2/deploy/charts/devbox-v2/templates/server-configmap.yaml new file mode 100644 index 0000000..e0b3388 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-configmap.yaml @@ -0,0 +1,34 @@ +{{- if .Values.server.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 4 }} + name: devbox-server-config + namespace: {{ include "devbox-v2.namespace" . }} +data: + config.yaml: | + server: + listenAddress: {{ .Values.server.config.listenAddress | quote }} + gatewayListenAddress: {{ .Values.server.config.gatewayListenAddress | quote }} + logLevel: {{ .Values.server.config.logLevel | quote }} + lifecycleResyncInterval: {{ .Values.server.config.lifecycleResyncInterval | quote }} + auth: + jwtSigningKeyFile: "/etc/devbox-server/secret/jwt-signing.key" + ssh: + user: {{ .Values.sshgate.user | quote }} + host: {{ .Values.sshgate.host | quote }} + port: {{ .Values.sshgate.sshPort }} + privateKeySecretKey: {{ .Values.sshgate.privateKeySecretKey | quote }} + gateway: + domain: {{ .Values.gateway.domain | quote }} + pathPrefix: {{ .Values.gateway.pathPrefix | quote }} + port: {{ .Values.gateway.port }} + devbox: + createDefaults: + image: {{ .Values.server.createDefaults.image | quote }} + storageLimit: {{ .Values.server.createDefaults.storageLimit | quote }} + resource: + cpu: {{ .Values.server.createDefaults.resource.cpu | quote }} + memory: {{ .Values.server.createDefaults.resource.memory | quote }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-deployment.yaml b/v2/deploy/charts/devbox-v2/templates/server-deployment.yaml new file mode 100644 index 0000000..79bc8f5 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-deployment.yaml @@ -0,0 +1,85 @@ +{{- if .Values.server.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 4 }} + app: devbox-server + name: devbox-server + namespace: {{ include "devbox-v2.namespace" . }} +spec: + replicas: {{ .Values.server.replicaCount }} + selector: + matchLabels: + app: devbox-server + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/server-configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/server-secret.yaml") . | sha256sum }} + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 8 }} + app: devbox-server + spec: + serviceAccountName: devbox-server + {{- with .Values.server.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: devbox-server + image: {{ .Values.server.image }} + imagePullPolicy: {{ .Values.server.imagePullPolicy }} + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + args: + - "--config=/etc/devbox-server/config/config.yaml" + ports: + - name: http + containerPort: 8090 + - name: gateway + containerPort: 8091 + volumeMounts: + - name: config + mountPath: /etc/devbox-server/config + readOnly: true + - name: secret-jwt-key + mountPath: /etc/devbox-server/secret + readOnly: true + readinessProbe: + httpGet: + path: /healthz + port: http + initialDelaySeconds: 3 + periodSeconds: 5 + livenessProbe: + httpGet: + path: /healthz + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + resources: + {{- toYaml .Values.server.resources | nindent 12 }} + {{- with .Values.server.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.server.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: config + configMap: + name: devbox-server-config + - name: secret-jwt-key + secret: + secretName: devbox-server-jwt-key +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-role.yaml b/v2/deploy/charts/devbox-v2/templates/server-role.yaml new file mode 100644 index 0000000..e8cd126 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-role.yaml @@ -0,0 +1,11 @@ +{{- if .Values.server.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: devbox-server-leader-election + namespace: {{ include "devbox-v2.namespace" . }} +rules: + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-rolebinding.yaml b/v2/deploy/charts/devbox-v2/templates/server-rolebinding.yaml new file mode 100644 index 0000000..94b905e --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-rolebinding.yaml @@ -0,0 +1,15 @@ +{{- if .Values.server.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: devbox-server-leader-election + namespace: {{ include "devbox-v2.namespace" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: devbox-server-leader-election +subjects: + - kind: ServiceAccount + name: devbox-server + namespace: {{ include "devbox-v2.namespace" . }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-secret.yaml b/v2/deploy/charts/devbox-v2/templates/server-secret.yaml new file mode 100644 index 0000000..83f177f --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-secret.yaml @@ -0,0 +1,12 @@ +{{- if .Values.server.enabled -}} +apiVersion: v1 +kind: Secret +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 4 }} + name: devbox-server-jwt-key + namespace: {{ include "devbox-v2.namespace" . }} +type: Opaque +stringData: + jwt-signing.key: {{ .Values.server.auth.jwtSigningKey | quote }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-service.yaml b/v2/deploy/charts/devbox-v2/templates/server-service.yaml new file mode 100644 index 0000000..f023208 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.server.enabled -}} +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 4 }} + app: devbox-server + name: devbox-server + namespace: {{ include "devbox-v2.namespace" . }} +spec: + type: ClusterIP + selector: + app: devbox-server + ports: + - name: http + port: 8090 + targetPort: http + - name: gateway + port: 8091 + targetPort: gateway +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/templates/server-serviceaccount.yaml b/v2/deploy/charts/devbox-v2/templates/server-serviceaccount.yaml new file mode 100644 index 0000000..c79caa6 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/templates/server-serviceaccount.yaml @@ -0,0 +1,9 @@ +{{- if .Values.server.enabled -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + {{- include "devbox-v2.componentLabels" (dict "context" . "component" "server") | nindent 4 }} + name: devbox-server + namespace: {{ include "devbox-v2.namespace" . }} +{{- end }} diff --git a/v2/deploy/charts/devbox-v2/values.yaml b/v2/deploy/charts/devbox-v2/values.yaml new file mode 100644 index 0000000..3a7ac24 --- /dev/null +++ b/v2/deploy/charts/devbox-v2/values.yaml @@ -0,0 +1,141 @@ +nameOverride: "" +fullnameOverride: "" + +clusterDomain: "" +clusterPort: "" +publicDomain: "" +sshDomain: "" + +registry: + address: sealos.hub:5000 + user: admin + password: passw0rd + +app: + enabled: true + +controller: + image: ghcr.io/sealos-apps/devbox-v2-controller:latest + imagePullPolicy: Always + config: + defaultBaseImage: docker.io/library/alpine:3.23 + mergeBaseImageTopLayer: false + resources: + requests: + cpu: 100m + memory: 640Mi + limits: + cpu: 1500m + memory: 2000Mi + nodeSelector: + devbox.sealos.io/node: "" + tolerations: + - effect: NoSchedule + key: devbox.sealos.io/node + operator: Exists + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + affinity: {} + +server: + enabled: true + replicaCount: 1 + image: ghcr.io/sealos-apps/devbox-v2-server:latest + imagePullPolicy: Always + auth: + jwtSigningKey: "" + config: + listenAddress: ":8090" + gatewayListenAddress: ":8091" + logLevel: info + lifecycleResyncInterval: 30m + createDefaults: + image: ghcr.io/labring-actions/devbox-base-expt/sandbox-v1:latest-en-us-amd64 + storageLimit: 1Gi + resource: + cpu: 200m + memory: 512Mi + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: "1" + memory: 512Mi + nodeSelector: {} + tolerations: [] + affinity: {} + +frontend: + enabled: true + replicaCount: 1 + image: ghcr.io/sealos-apps/devbox-v2-frontend:latest + imagePullPolicy: Always + env: + CURRENCY_SYMBOL: usd + DATABASE_URL: "" + JWT_SECRET: "" + NODE_TLS_REJECT_UNAUTHORIZED: "1" + REGION_UID: "" + CUSTOM_SCRIPTS: "[]" + DEVBOX_AFFINITY_ENABLE: "true" + DEVBOX_DOMAIN_CHALLENGE_SECRET: default-dev-secret-change-in-production + DOCUMENT_URL_EN: https://sealos.io/docs/overview/intro + DOCUMENT_URL_ZH: https://sealos.run/docs/overview/intro + ENABLE_ADVANCED_CONFIG: "false" + ENABLE_IMPORT_FEATURE: "false" + ENABLE_WEBIDE_FEATURE: "false" + GPU_ENABLE: "false" + MEMORY_SLIDE_MARK_LIST: 2,4,8,16,32 + CPU_SLIDE_MARK_LIST: 1,2,4,8,16 + NFS_STORAGE_CLASS_NAME: nfs-csi + PRIVACY_URL_EN: https://sealos.io/docs/msa/privacy-policy + PRIVACY_URL_ZH: https://sealos.run/docs/msa/privacy-policy + STORAGE_LIMIT: 10Gi + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 2000m + memory: 2048Mi + nodeSelector: {} + tolerations: [] + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - devbox-frontend + topologyKey: kubernetes.io/hostname + ingress: + enabled: true + className: nginx + secretName: wildcard-cert + +gateway: + domain: "" + pathPrefix: /codex + port: 1317 + + +httpgate: + enabled: true + ingress: + enabled: false + +sshgate: + enabled: true + user: devbox + host: "" + sshPort: 2233 + privateKeySecretKey: SEALOS_DEVBOX_PRIVATE_KEY diff --git a/v2/deploy/install.sh b/v2/deploy/install.sh new file mode 100644 index 0000000..d7be352 --- /dev/null +++ b/v2/deploy/install.sh @@ -0,0 +1,242 @@ +#!/usr/bin/env bash +set -euo pipefail + +timestamp() { + date +"%Y-%m-%d %T" +} + +info() { + local flag + flag="$(timestamp)" + echo -e "\033[36m INFO [$flag] >> $* \033[0m" +} + +warn() { + local flag + flag="$(timestamp)" + echo -e "\033[33m WARN [$flag] >> $* \033[0m" +} + +error() { + local flag + flag="$(timestamp)" + echo -e "\033[31m ERROR [$flag] >> $* \033[0m" + exit 1 +} + +decode_base64() { + local raw=$1 + local decoded="" + + if decoded="$(printf '%s' "${raw}" | base64 --decode 2>/dev/null)"; then + printf '%s' "${decoded}" + return 0 + fi + + if decoded="$(printf '%s' "${raw}" | base64 -d 2>/dev/null)"; then + printf '%s' "${decoded}" + return 0 + fi + + return 1 +} + +get_secret_data() { + local namespace=$1 + local secret_name=$2 + local key=$3 + local encoded="" + + encoded="$(kubectl get secret "${secret_name}" -n "${namespace}" -o "jsonpath={.data.${key}}" 2>/dev/null || true)" + [ -n "${encoded}" ] || return 1 + + decode_base64 "${encoded}" +} + +get_configmap_data() { + local namespace=$1 + local name=$2 + local key=$3 + + kubectl get configmap "${name}" -n "${namespace}" -o "jsonpath={.data.${key}}" 2>/dev/null || true +} + +get_sealos_config() { + local key=$1 + get_configmap_data "sealos-system" "sealos-config" "${key}" +} + +resolve_desktop_frontend_value() { + local key=$1 + local value="" + + for namespace in sealos sealos-system; do + value="$(get_configmap_data "${namespace}" "desktop-frontend-config" "${key}")" + if [ -n "${value}" ]; then + printf '%s' "${value}" + return 0 + fi + done + + return 1 +} + +find_existing_server_jwt_secret() { + if kubectl get secret devbox-server-jwt-key -n devbox-server >/dev/null 2>&1; then + echo "devbox-server-jwt-key" + return 0 + fi + + return 1 +} + +ensure_user_values_file() { + mkdir -p "${USER_VALUES_DIR}" + + if [ ! -f "${USER_VALUES_FILE}" ]; then + cp "${DEFAULT_VALUES_FILE}" "${USER_VALUES_FILE}" + CREATED_DEFAULT_VALUES="true" + info "Generated default user values at ${USER_VALUES_FILE}" + return 0 + fi + + CREATED_DEFAULT_VALUES="false" + info "Using user values from ${USER_VALUES_FILE}" +} + +RELEASE_NAME="${RELEASE_NAME:-devbox-v2}" +NAMESPACE="${NAMESPACE:-devbox-system}" +HELM_OPTS="${HELM_OPTS:-}" +HELM_TIMEOUT="${HELM_TIMEOUT:-20m}" +DEFAULT_VALUES_FILE="./charts/devbox-v2/values.yaml" +USER_VALUES_DIR="/root/.sealos/cloud/values/apps/devbox-v2" +USER_VALUES_FILE="${USER_VALUES_DIR}/values.yaml" +CREATED_DEFAULT_VALUES="false" + +ensure_user_values_file + +cloud_domain="${SEALOS_DOMAIN:-$(get_sealos_config cloudDomain)}" +[ -n "${cloud_domain}" ] || error "Failed to resolve cloud domain from SEALOS_DOMAIN or sealos-config.data.cloudDomain" + +public_domain="${PUBLIC_DOMAIN:-${INGRESS_DOMAIN:-${cloud_domain}}}" +ssh_domain="${SSH_DOMAIN:-${cloud_domain}}" +cloud_port="${CLOUD_PORT:-}" +cert_secret_name="${CERT_SECRET_NAME:-wildcard-cert}" +ingress_class_name="${INGRESS_CLASS_NAME:-nginx}" +registry_addr="${REGISTRY_ADDR:-$(get_sealos_config registryDomain)}" +registry_addr="${registry_addr:-sealos.hub:5000}" +registry_user="${REGISTRY_USER:-admin}" +registry_password="${REGISTRY_PASSWORD:-passw0rd}" + +frontend_jwt_secret="${JWT_SECRET:-$(get_sealos_config jwtInternal)}" +if [ -z "${frontend_jwt_secret}" ]; then + frontend_jwt_secret="$(resolve_desktop_frontend_value jwtInternal || true)" +fi +if [ -z "${frontend_jwt_secret}" ]; then + frontend_jwt_secret="$(resolve_desktop_frontend_value jwt || true)" +fi + +region_uid="${REGION_UID:-}" +if [ -z "${region_uid}" ]; then + region_uid="$(resolve_desktop_frontend_value regionUid || true)" +fi + +database_url="${DATABASE_URL:-}" +if [ -z "${database_url}" ]; then + candidate_database="$(resolve_desktop_frontend_value database || true)" + if [[ "${candidate_database}" == postgres://* || "${candidate_database}" == postgresql://* ]]; then + database_url="${candidate_database}" + fi +fi + +server_jwt_signing_key="${SERVER_JWT_SIGNING_KEY:-}" +if [ -z "${server_jwt_signing_key}" ]; then + existing_server_secret="$(find_existing_server_jwt_secret || true)" + if [ -n "${existing_server_secret}" ]; then + server_jwt_signing_key="$(get_secret_data devbox-server "${existing_server_secret}" "jwt-signing.key" || true)" + fi +fi +if [ -z "${server_jwt_signing_key}" ]; then + warn "Server JWT signing key not found in cluster, generating a new one" + server_jwt_signing_key="$(openssl rand -hex 32)" +fi + +if [ "${CREATED_DEFAULT_VALUES}" = "true" ]; then + [ -n "${frontend_jwt_secret}" ] || error "Failed to resolve frontend JWT secret. Set JWT_SECRET or edit ${USER_VALUES_FILE}" + [ -n "${database_url}" ] || error "Failed to resolve database URL. Set DATABASE_URL or edit ${USER_VALUES_FILE}" +fi + +gateway_domain="${GATEWAY_DOMAIN:-devbox-gateway.${public_domain}}" +server_ssh_host="${SERVER_SSH_HOST:-${ssh_domain}}" +metrics_url="${METRICS_URL:-}" +account_url="${ACCOUNT_URL:-}" +retag_service_url="${RETAG_SVC_URL:-}" +devbox_domain_challenge_secret="${DEVBOX_DOMAIN_CHALLENGE_SECRET:-}" +nfs_storage_class_name="${NFS_STORAGE_CLASS_NAME:-}" + +helm_set_args=( + --set-string "clusterDomain=${cloud_domain}" + --set-string "publicDomain=${public_domain}" + --set-string "sshDomain=${ssh_domain}" + --set-string "frontend.ingress.secretName=${cert_secret_name}" + --set-string "frontend.ingress.className=${ingress_class_name}" + --set-string "registry.address=${registry_addr}" + --set-string "registry.user=${registry_user}" + --set-string "registry.password=${registry_password}" + --set-string "server.auth.jwtSigningKey=${server_jwt_signing_key}" + --set-string "sshgate.host=${server_ssh_host}" + --set-string "gateway.domain=${gateway_domain}" +) +if [ -n "${cloud_port}" ]; then + helm_set_args+=(--set-string "clusterPort=${cloud_port}") +fi + +if [ -n "${frontend_jwt_secret}" ]; then + helm_set_args+=(--set-string "frontend.env.JWT_SECRET=${frontend_jwt_secret}") +fi +if [ -n "${region_uid}" ]; then + helm_set_args+=(--set-string "frontend.env.REGION_UID=${region_uid}") +fi +if [ -n "${database_url}" ]; then + helm_set_args+=(--set-string "frontend.env.DATABASE_URL=${database_url}") +fi +if [ -n "${metrics_url}" ]; then + helm_set_args+=(--set-string "frontend.env.METRICS_URL=${metrics_url}") +fi +if [ -n "${account_url}" ]; then + helm_set_args+=(--set-string "frontend.env.ACCOUNT_URL=${account_url}") +fi +if [ -n "${retag_service_url}" ]; then + helm_set_args+=(--set-string "frontend.env.RETAG_SVC_URL=${retag_service_url}") +fi +if [ -n "${devbox_domain_challenge_secret}" ]; then + helm_set_args+=(--set-string "frontend.env.DEVBOX_DOMAIN_CHALLENGE_SECRET=${devbox_domain_challenge_secret}") +fi +if [ -n "${nfs_storage_class_name}" ]; then + helm_set_args+=(--set-string "frontend.env.NFS_STORAGE_CLASS_NAME=${nfs_storage_class_name}") +fi + +if [ -n "${IMAGE_REGISTRY:-}" ] && [ -n "${IMAGE_NAMESPACE:-}" ] && [ -n "${APP_VERSION:-}" ]; then + helm_set_args+=( + --set-string "controller.image=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-controller:${APP_VERSION}" + --set-string "frontend.image=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-frontend:${APP_VERSION}" + --set-string "server.image=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-server:${APP_VERSION}" + --set-string "httpgate.image=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-httpgate:${APP_VERSION}" + --set-string "sshgate.image=${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/devbox-v2-sshgate:${APP_VERSION}" + ) +fi + +helm_opts_arr=() +if [ -n "${HELM_OPTS}" ]; then + # shellcheck disable=SC2206 + helm_opts_arr=(${HELM_OPTS}) +fi + +info "Installing chart charts/devbox-v2 into namespace ${NAMESPACE}" +helm upgrade -i "${RELEASE_NAME}" -n "${NAMESPACE}" --create-namespace charts/devbox-v2 \ + -f "${DEFAULT_VALUES_FILE}" \ + -f "${USER_VALUES_FILE}" \ + "${helm_set_args[@]}" \ + "${helm_opts_arr[@]}" \ + --wait \ + --timeout "${HELM_TIMEOUT}" diff --git a/v2/httpgate/deploy/charts/httpgate/templates/daemonset.yaml b/v2/httpgate/deploy/charts/httpgate/templates/daemonset.yaml index bffd17b..64edbfb 100644 --- a/v2/httpgate/deploy/charts/httpgate/templates/daemonset.yaml +++ b/v2/httpgate/deploy/charts/httpgate/templates/daemonset.yaml @@ -38,8 +38,8 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: {{ .Values.image | quote }} + imagePullPolicy: {{ .Values.imagePullPolicy }} ports: - name: http containerPort: {{ .Values.httpPort }} diff --git a/v2/httpgate/deploy/charts/httpgate/values.yaml b/v2/httpgate/deploy/charts/httpgate/values.yaml index 9c3f587..fe783ce 100644 --- a/v2/httpgate/deploy/charts/httpgate/values.yaml +++ b/v2/httpgate/deploy/charts/httpgate/values.yaml @@ -1,9 +1,7 @@ # Default values for httpgate -image: - repository: ghcr.io/sealos-apps/devbox-v2-httpgate - pullPolicy: IfNotPresent - tag: "" # Overrides the image tag whose default is the chart appVersion +image: ghcr.io/sealos-apps/devbox-v2-httpgate:latest +imagePullPolicy: Always imagePullSecrets: [] nameOverride: "" diff --git a/v2/sshgate/deploy/charts/sshgate/values.yaml b/v2/sshgate/deploy/charts/sshgate/values.yaml index 4c95eeb..010565a 100644 --- a/v2/sshgate/deploy/charts/sshgate/values.yaml +++ b/v2/sshgate/deploy/charts/sshgate/values.yaml @@ -1,7 +1,7 @@ # Default values for sshgate image: ghcr.io/sealos-apps/devbox-v2-sshgate:latest -imagePullPolicy: IfNotPresent +imagePullPolicy: Always imagePullSecrets: [] nameOverride: ""