Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

InfraPlatform - Working branch #1

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
371425a
upd(yandex): folderID for SecretStore, get secrets by its names
vitalyu Apr 30, 2024
0bf00a2
upd(azure) ignore "secret" tag/property
vitalyu Apr 30, 2024
8060131
lint
vitalyu Apr 30, 2024
e61101a
disable e2e
vitalyu Apr 30, 2024
488dc92
docs
vitalyu Apr 30, 2024
9142e10
1
vitalyu Apr 30, 2024
418aec6
1
vitalyu Apr 30, 2024
1f42f49
1
vitalyu Apr 30, 2024
bc4c17b
Merge branch 'main' into dodo
vitalyu Apr 30, 2024
9a0812b
1
vitalyu Apr 30, 2024
114eb9e
disable rebuild-image step
vitalyu Apr 30, 2024
71b7353
upd(workflow)
vitalyu Apr 30, 2024
0544757
upd(workflow) tokens
vitalyu Apr 30, 2024
b832be7
upd(workflow) permissions
vitalyu Apr 30, 2024
3d31b5e
del(worflow) unused from main
vitalyu Apr 30, 2024
43c985a
upd(devcontainer)
vitalyu Apr 30, 2024
1b9d934
fix(devcontainer) dockefile
vitalyu Apr 30, 2024
9ae0560
fix(devcontainer)
vitalyu Apr 30, 2024
49353da
upd(devcontainer)
vitalyu Apr 30, 2024
d7ca0c8
chore()
vitalyu Apr 30, 2024
24f4ee9
add(certmanager) folderId implementation
vitalyu May 1, 2024
25f92fc
chore()
vitalyu May 1, 2024
8ef222e
upd(workflow)
vitalyu May 1, 2024
d8b1d8b
upd(workflow) helm
vitalyu May 1, 2024
599e61e
upd(workflow)
vitalyu May 1, 2024
b9ccadf
upd(workflow)
vitalyu May 1, 2024
43d2bd7
upd(workflow)
vitalyu May 1, 2024
fecd5df
upd(workflow)
vitalyu May 1, 2024
f321959
upd(workflow) undelete from main
vitalyu May 1, 2024
71eb768
upd(workflow) name
vitalyu May 1, 2024
95d64fb
upd(workflow)
vitalyu May 1, 2024
2196bde
upd(workflow) release
vitalyu May 1, 2024
15a90d7
upd(workflow) release package permission
vitalyu May 1, 2024
8229f47
upd(yandex) ListSecretsRequest PageSize: 500 -> 1000
vitalyu Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM mcr.microsoft.com/devcontainers/go:1-1.22-bookworm

USER root

# must be amd64 or arm64
ARG TARGETARCH

# BASE
RUN apt update && apt install -y git jq make unzip

# YQ
RUN cd /tmp && \
version=4.35.2 && \
curl -L --output /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v${version}/yq_linux_${TARGETARCH} && \
chmod +x /usr/local/bin/yq

# DOCKER-CLI
RUN cd /tmp && \
version=24.0.6 && \
arch=${TARGETARCH} && \
[ "$arch" = "arm64" ] && arch="aarch64"; \
[ "$arch" = "amd64" ] && arch="x86_64"; \
curl -L https://download.docker.com/linux/static/stable/${arch}/docker-${version}.tgz | tar xz && \
mv docker/docker /usr/local/bin/

# KUBECTL
RUN cd /tmp && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl" && \
chmod +x kubectl && mv kubectl /usr/local/bin/

## KUBELOGIN
RUN cd /tmp && \
version=0.0.33 && \
curl -L https://github.com/Azure/kubelogin/releases/download/v${version}/kubelogin-linux-${TARGETARCH}.zip > ./kubelogin-linux-${TARGETARCH}.zip && \
unzip /tmp/kubelogin-linux-${TARGETARCH}.zip && \
mv /tmp/bin/linux_${TARGETARCH}/kubelogin /usr/local/bin

# HELM
RUN cd /tmp && \
version=3.14.0 && \
curl -L https://get.helm.sh/helm-v${version}-linux-${TARGETARCH}.tar.gz | tar xz && \
mv linux-${TARGETARCH}/helm /usr/local/bin/helm

# KIND
RUN cd /tmp && \
version=0.20.0 && \
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v${version}/kind-linux-${TARGETARCH} && \
chmod +x ./kind && mv ./kind /usr/local/bin/

# KREW
RUN cd /tmp && \
version=0.4.4 && \
curl -L https://github.com/kubernetes-sigs/krew/releases/download/v${version}/krew-linux_${TARGETARCH}.tar.gz | tar xz && \
mv krew-linux_${TARGETARCH} /usr/local/bin/kubectl-krew && \
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> $HOME/.bashrc

# KREW PLUGINS
RUN kubectl krew install ctx ns

# K9S
RUN cd /tmp && \
version=0.27.4 && \
curl -L https://github.com/derailed/k9s/releases/download/v${version}/k9s_Linux_${TARGETARCH}.tar.gz | tar xz && \
mv k9s /usr/local/bin/
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "infra.k8s.external-secrets",
"image": "ghcr.io/dodopizza/infra.k8s.external-secrets-devcontainer:latest",
"runArgs": [
"--pull=always"
],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=${env:HOME}${env:USERPROFILE}/.kube,target=/usr/local/share/kube-localhost,type=bind,readonly"
],
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"ms-kubernetes-tools.vscode-kubernetes-tools"
],
"settings": {}
}
},
"remoteUser": "root",
"postAttachCommand": ".devcontainer/post-command.sh"
}
32 changes: 32 additions & 0 deletions .devcontainer/post-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -eu

CYAN='\033[0;36m'
NC='\033[0m'
function log() { echo -e "${CYAN}${1}${NC}"; }

function prepare_kube_config_from_host() {
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/kubernetes-helm/.devcontainer/copy-kube-config.sh
log '[~] Prepare .kube/config'
if [ -d "/usr/local/share/kube-localhost" ]; then
mkdir -p $HOME/.kube
cp -r /usr/local/share/kube-localhost/* $HOME/.kube
chown -R $(id -u) $HOME/.kube
# for internal kind cluster
sed -i -e "s/localhost/host.docker.internal/g" $HOME/.kube/config
sed -i -e "s/127.0.0.1/host.docker.internal/g" $HOME/.kube/config
# set insecure for remote clusters
yq e '.clusters[].cluster."insecure-skip-tls-verify" = true' -i $HOME/.kube/config
yq e 'del(.clusters[].cluster."certificate-authority-data")' -i $HOME/.kube/config
fi
}

if [ -d "$HOME/.kube" ]; then
log "[-] Kube config presents. Skip."
else
read -p "Copy kube config from host? [y/n]" -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] && prepare_kube_config_from_host
fi

log '[.] Done\n'
31 changes: 16 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI
on:
push:
branches:
- main
- release-*
pull_request: {}
- dodo
# - release-*
# pull_request: {}

env:
# Common versions
Expand Down Expand Up @@ -138,6 +138,7 @@ jobs:
if: needs.detect-noop.outputs.noop != 'true'
uses: ./.github/workflows/publish.yml
permissions:
packages: write
id-token: write
contents: read
strategy:
Expand All @@ -148,16 +149,16 @@ jobs:
build-arch: "amd64 arm64 s390x"
build-platform: "linux/amd64,linux/arm64,linux/s390x"
tag-suffix: "" # distroless
- dockerfile: "Dockerfile.ubi"
build-args: "CGO_ENABLED=0"
build-arch: "amd64 arm64"
build-platform: "linux/amd64,linux/arm64"
tag-suffix: "-ubi"
- dockerfile: "Dockerfile.ubi"
build-args: "CGO_ENABLED=0 GOEXPERIMENT=boringcrypto"
build-arch: "amd64"
build-platform: "linux/amd64"
tag-suffix: "-ubi-boringssl"
# - dockerfile: "Dockerfile.ubi"
# build-args: "CGO_ENABLED=0"
# build-arch: "amd64 arm64"
# build-platform: "linux/amd64,linux/arm64"
# tag-suffix: "-ubi"
# - dockerfile: "Dockerfile.ubi"
# build-args: "CGO_ENABLED=0 GOEXPERIMENT=boringcrypto"
# build-arch: "amd64"
# build-platform: "linux/amd64"
# tag-suffix: "-ubi-boringssl"
with:
dockerfile: ${{ matrix.dockerfile }}
tag-suffix: ${{ matrix.tag-suffix }}
Expand All @@ -167,6 +168,6 @@ jobs:
build-arch: ${{ matrix.build-arch }}
ref: ${{ github.ref }}
secrets:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
GHCR_USERNAME: ${{ github.actor }}
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

44 changes: 44 additions & 0 deletions .github/workflows/devcontainer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build DevContainer image
on:
workflow_dispatch:
push:
branches:
- dodo
paths:
- ".devcontainer/**"

jobs:
push:
name: Build DevContainer image
runs-on: ubuntu-latest
env:
DEVCONTAINER_IMAGE_TAG: v0.1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (for main branch)
uses: docker/build-push-action@v4
with:
file: ".devcontainer/Dockerfile"
push: true
tags: >
ghcr.io/${{ github.repository }}-devcontainer:latest,
ghcr.io/${{ github.repository }}-devcontainer:${{ env.DEVCONTAINER_IMAGE_TAG }}
platforms: |
linux/arm64
linux/amd64
- name: Output image tags
run: |
echo "## Built images with the following tags" >> $GITHUB_STEP_SUMMARY
echo "### ghcr.io/${{ github.repository }}-devcontainer:latest" >> $GITHUB_STEP_SUMMARY
echo "### ghcr.io/${{ github.repository }}-devcontainer:${{ env.DEVCONTAINER_IMAGE_TAG }}" >> $GITHUB_STEP_SUMMARY
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Deploy Docs
on:
push:
branches:
- main
- release-*
- dodo
# - release-*

permissions:
contents: read
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Helm
on:
push:
branches:
- main
- release-*
paths:
- 'deploy/charts/**'
- 'deploy/crds/**'
pull_request:
- dodo
# - release-*
paths:
- 'deploy/charts/**'
- 'deploy/crds/**'
# pull_request:
# paths:
# - 'deploy/charts/**'
# - 'deploy/crds/**'
workflow_dispatch: {}

permissions:
Expand Down Expand Up @@ -97,9 +97,9 @@ jobs:
# echo "${{ secrets.GPG_PASSPHRASE }}" > passphrase-file.txt
- name: Run chart-releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
if: |
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release-')
# if: |
# github.ref == 'refs/heads/main' ||
# startsWith(github.ref, 'refs/heads/release-')
env:
## Temporarily removing - This is making the release break
# CR_KEY: external-secrets <external-secrets@external-secrets.io>
Expand Down
45 changes: 21 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,33 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.source_ref }}
# - name: Checkout
# uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
# with:
# fetch-depth: 0
# ref: ${{ github.event.inputs.source_ref }}

- name: Create Release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
with:
tag_name: ${{ github.event.inputs.version }}
target_commitish: ${{ github.event.inputs.source_ref }}
generate_release_notes: true
target_commitish: ${{ github.ref_name }}
# generate_release_notes: true
body: |
Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}`
Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi`
Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi-boringssl`
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
# - name: Configure Git
# run: |
# git config user.name "$GITHUB_ACTOR"
# git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Update Docs
if: github.ref == 'refs/heads/main'
run: make docs.publish DOCS_VERSION=${{ github.event.inputs.version }} DOCS_ALIAS=latest
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# - name: Update Docs
# if: github.ref == 'refs/heads/dodo'
# run: make docs.publish DOCS_VERSION=${{ github.event.inputs.version }} DOCS_ALIAS=latest
# env:
# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

promote:
name: Promote Container Image
Expand All @@ -58,10 +56,9 @@ jobs:
matrix:
include:
- tag_suffix: "" # distroless image
- tag_suffix: "-ubi" # ubi image
- tag_suffix: "-ubi-boringssl" # ubi image

permissions:
packages: write
id-token: write
contents: write

Expand Down Expand Up @@ -89,8 +86,8 @@ jobs:
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Promote Container Image
run: make docker.promote
Expand All @@ -108,8 +105,8 @@ jobs:
with:
image-name: ${{ env.IMAGE_NAME }}
image-tag: ${{ env.RELEASE_TAG }}
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
GHCR_USERNAME: ${{ github.actor }}
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Release
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ cover.out
# ignore ide files (debug config etc...)
/.vscode
/.idea
__debug_bin*
.history
localtest

# helm chart dependencies
**/charts/*.tgz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type YandexLockboxProvider struct {
// +optional
APIEndpoint string `json:"apiEndpoint,omitempty"`

// If provided sets the ability to get secrets by its name in the specified folder
// +optional
FolderID string `json:"folderID,omitempty"`

// Auth defines the information necessary to authenticate against Yandex Lockbox
Auth YandexLockboxAuth `json:"auth"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type YandexCertificateManagerProvider struct {
// +optional
APIEndpoint string `json:"apiEndpoint,omitempty"`

// If provided sets the ability to get secrets by its name in the specified folder
// +optional
FolderID string `json:"folderID,omitempty"`

// Auth defines the information necessary to authenticate against Yandex Certificate Manager
Auth YandexCertificateManagerAuth `json:"auth"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type YandexLockboxProvider struct {
// +optional
APIEndpoint string `json:"apiEndpoint,omitempty"`

// If provided sets the ability to get secrets by its name in the specified folder
// +optional
FolderID string `json:"folderID,omitempty"`

// Auth defines the information necessary to authenticate against Yandex Lockbox
Auth YandexLockboxAuth `json:"auth"`

Expand Down
Loading
Loading