mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
Merge branch 'main' into add-main-controller-logic
This commit is contained in:
commit
04f3dd4119
8 changed files with 103 additions and 8 deletions
5
.github/ci/ct.yaml
vendored
Normal file
5
.github/ci/ct.yaml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
chart-dirs:
|
||||
- deploy/charts
|
||||
helm-extra-args: "--timeout=5m"
|
||||
check-version-increment: false
|
||||
target-branch: main
|
4
.github/workflows/all.yml
vendored
4
.github/workflows/all.yml
vendored
|
@ -7,8 +7,12 @@ on:
|
|||
- '*/*' # matches every branch containing a single '/'
|
||||
- '**' # matches every branch
|
||||
- '!main' # excludes main
|
||||
paths-ignore:
|
||||
- 'deploy/**'
|
||||
pull_request:
|
||||
branches: [ '!main' ]
|
||||
paths-ignore:
|
||||
- 'deploy/**'
|
||||
|
||||
env:
|
||||
KUBEBUILDER_VERSION: 2.3.1
|
||||
|
|
55
.github/workflows/helm.yml
vendored
Normal file
55
.github/workflows/helm.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
name: Helm
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
paths:
|
||||
- 'deploy/charts/**'
|
||||
pull_request:
|
||||
branches: main
|
||||
paths:
|
||||
- 'deploy/charts/**'
|
||||
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate chart
|
||||
run: |
|
||||
make crds-to-chart
|
||||
|
||||
- name: Set up Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.2
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.0.1
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
run: |
|
||||
changed=$(ct list-changed --config=.github/ci/ct.yaml)
|
||||
if [[ -n "$changed" ]]; then
|
||||
echo "::set-output name=changed::true"
|
||||
fi
|
||||
|
||||
- name: Run chart-testing (lint)
|
||||
run: ct lint --config=.github/ci/ct.yaml
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.1.0
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
run: ct install --config=.github/ci/ct.yaml
|
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
@ -5,8 +5,12 @@ on:
|
|||
branches: [ main ]
|
||||
tags:
|
||||
- '*'
|
||||
paths-ignore:
|
||||
- 'deploy/**'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- 'deploy/**'
|
||||
|
||||
env:
|
||||
KUBEBUILDER_VERSION: 2.3.1
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -24,3 +24,5 @@ bin
|
|||
|
||||
# Code test output
|
||||
cover.out
|
||||
|
||||
deploy/charts/external-secrets/templates/crds/*.yaml
|
||||
|
|
26
Makefile
26
Makefile
|
@ -7,6 +7,8 @@ SHELL := /bin/bash
|
|||
IMG ?= controller:latest
|
||||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
||||
CRD_OPTIONS ?= "crd:trivialVersions=true"
|
||||
HELM_DIR ?= deploy/charts/external-secrets
|
||||
CRD_DIR ?= config/crd/bases
|
||||
|
||||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
||||
ifeq (,$(shell go env GOBIN))
|
||||
|
@ -43,7 +45,13 @@ deploy: manifests ## Deploy controller in the Kubernetes cluster of current cont
|
|||
kustomize build config/default | kubectl apply -f -
|
||||
|
||||
manifests: controller-gen ## Generate manifests e.g. CRD, RBAC etc.
|
||||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
|
||||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=$(CRD_DIR)
|
||||
# Remove extra header lines in generated CRDs
|
||||
@for i in $(CRD_DIR)/*.yaml; do \
|
||||
tail -n +3 <"$$i" >"$$i.bkp" && \
|
||||
cp "$$i.bkp" "$$i" && \
|
||||
rm "$$i.bkp"; \
|
||||
done
|
||||
|
||||
lint/check: # Check install of golanci-lint
|
||||
@if ! golangci-lint --version > /dev/null 2>&1; then \
|
||||
|
@ -77,6 +85,22 @@ docker-build: test ## Build the docker image
|
|||
docker-push: ## Push the docker image
|
||||
docker push ${IMG}
|
||||
|
||||
helm-docs: ## Generate helm docs
|
||||
cd $(HELM_DIR); \
|
||||
docker run --rm -v $(shell pwd)/$(HELM_DIR):/helm-docs -u $(shell id -u) jnorwood/helm-docs:latest
|
||||
|
||||
crds-to-chart: # Copy crds to helm chart directory
|
||||
cp $(CRD_DIR)/*.yaml $(HELM_DIR)/templates/crds/
|
||||
# Add helm chart if statement for installing CRDs
|
||||
@for i in $(HELM_DIR)/templates/crds/*.yaml; do \
|
||||
cp "$$i" "$$i.bkp" && \
|
||||
echo "{{- if .Values.installCRDs }}" > "$$i" && \
|
||||
cat "$$i.bkp" >> "$$i" && \
|
||||
echo "{{- end }}" >> "$$i" && \
|
||||
rm "$$i.bkp"; \
|
||||
done
|
||||
|
||||
|
||||
# find or download controller-gen
|
||||
# download controller-gen if necessary
|
||||
controller-gen:
|
||||
|
|
13
main.go
13
main.go
|
@ -25,8 +25,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
// +kubebuilder:scaffold:imports
|
||||
externalsecretsv1alpha1 "github.com/external-secrets/external-secrets/api/v1alpha1"
|
||||
"github.com/external-secrets/external-secrets/controllers"
|
||||
esv1alpha1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1alpha1"
|
||||
"github.com/external-secrets/external-secrets/pkg/controllers/externalsecret"
|
||||
"github.com/external-secrets/external-secrets/pkg/controllers/secretstore"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -37,7 +38,7 @@ var (
|
|||
func init() {
|
||||
_ = clientgoscheme.AddToScheme(scheme)
|
||||
|
||||
_ = externalsecretsv1alpha1.AddToScheme(scheme)
|
||||
_ = esv1alpha1.AddToScheme(scheme)
|
||||
// +kubebuilder:scaffold:scheme
|
||||
}
|
||||
|
||||
|
@ -57,14 +58,14 @@ func main() {
|
|||
MetricsBindAddress: metricsAddr,
|
||||
Port: 9443,
|
||||
LeaderElection: enableLeaderElection,
|
||||
LeaderElectionID: "1fc40399.io",
|
||||
LeaderElectionID: "external-secrets-controller",
|
||||
})
|
||||
if err != nil {
|
||||
setupLog.Error(err, "unable to start manager")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err = (&controllers.SecretStoreReconciler{
|
||||
if err = (&secretstore.Reconciler{
|
||||
Client: mgr.GetClient(),
|
||||
Log: ctrl.Log.WithName("controllers").WithName("SecretStore"),
|
||||
Scheme: mgr.GetScheme(),
|
||||
|
@ -72,7 +73,7 @@ func main() {
|
|||
setupLog.Error(err, "unable to create controller", "controller", "SecretStore")
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = (&controllers.ExternalSecretReconciler{
|
||||
if err = (&externalsecret.Reconciler{
|
||||
Client: mgr.GetClient(),
|
||||
Log: ctrl.Log.WithName("controllers").WithName("ExternalSecret"),
|
||||
Scheme: mgr.GetScheme(),
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
esv1alpha1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1alpha1"
|
||||
"github.com/external-secrets/external-secrets/pkg/provider"
|
||||
utils "github.com/external-secrets/external-secrets/pkg/utils"
|
||||
"github.com/external-secrets/external-secrets/pkg/utils"
|
||||
|
||||
// Loading registered providers.
|
||||
_ "github.com/external-secrets/external-secrets/pkg/provider/register"
|
||||
|
|
Loading…
Reference in a new issue