Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nhinze23 authored and cesmarvin committed Sep 1, 2023
2 parents ae5afaf + 246e2fe commit 0835fd5
Show file tree
Hide file tree
Showing 18 changed files with 715 additions and 37 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.1.2] - 2023-09-01
### Fixed
- [#21] Fixes dependency-check for components with the version-format "x.x.x-x"
- "x.x.x-x"-versions are not treated as "pre-release"-versions and are ordered accordingly

## [v0.1.1] - 2023-08-25
### Fixed
- [#19] Fixes operator configuration by splitting helm registry endpoint and schema into separate configmap fields
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN make compile-generic
FROM gcr.io/distroless/static:nonroot
LABEL maintainer="hello@cloudogu.com" \
NAME="k8s-component-operator" \
VERSION="0.1.1"
VERSION="0.1.2"

WORKDIR /
COPY --from=builder /workspace/target/k8s-component-operator .
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Set these to the desired values
ARTIFACT_ID=k8s-component-operator
VERSION=0.1.1
VERSION=0.1.2
## Image URL to use all building/pushing image targets
IMAGE_DEV=${K3CES_REGISTRY_URL_PREFIX}/${ARTIFACT_ID}:${VERSION}
IMAGE=cloudogu/${ARTIFACT_ID}:${VERSION}
GOTAG?=1.20.3
MAKEFILES_VERSION=7.12.0
MAKEFILES_VERSION=7.13.1
LINT_VERSION?=v1.52.1
STAGE?=production

Expand Down Expand Up @@ -84,7 +84,7 @@ kill-operator-pod:
##@ Helm-Repo-Config
.PHONY: helm-repo-config
helm-repo-config: ## Creates a configMap and a secret for the helm repo connection from env vars HELM_REPO_USERNAME, HELM_REPO_PASSWORD, HELM_REPO_ENDPOINT.
@kubectl create configmap component-operator-helm-repository --from-literal=endpoint=${HELM_REPO_ENDPOINT} --from-literal=schema=oci
@kubectl create configmap component-operator-helm-repository --from-literal=endpoint=${HELM_REPO_ENDPOINT} --from-literal=schema=oci --from-literal=plainHttp=${HELM_REPO_PLAIN_HTTP}
@kubectl create secret generic component-operator-helm-registry --from-literal=config.json='{"auths": {"${HELM_REPO_ENDPOINT}": {"auth": "$(shell printf "%s:%s" "${HELM_REPO_USERNAME}" "${HELM_REPO_PASSWORD}" | base64 -w0)"}}}'

##@ Debug
Expand Down
2 changes: 1 addition & 1 deletion build/make/k8s-controller.mk
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ k8s-integration-test: $(K8S_INTEGRATION_TEST_DIR) manifests generate envtest ##
CONTROLLER_GEN = $(UTILITY_BIN_PATH)/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.3)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0)

KUSTOMIZE = $(UTILITY_BIN_PATH)/kustomize
.PHONY: kustomize
Expand Down
3 changes: 3 additions & 0 deletions build/make/k8s-helm-temp-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: replaceme
version: 0.0.0
27 changes: 5 additions & 22 deletions build/make/k8s.mk
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ k8s-helm-delete: ${BINARY_HELM} check-k8s-namespace-env-var ## Uninstalls the cu
@${BINARY_HELM} uninstall ${ARTIFACT_ID} --namespace=${NAMESPACE} ${BINARY_HELM_ADDITIONAL_UNINST_ARGS} || true

.PHONY: k8s-helm-generate-chart
k8s-helm-generate-chart: ${K8S_HELM_TARGET}/Chart.yaml ## Generates the final helm chart.
k8s-helm-generate-chart: ${K8S_HELM_TARGET}/Chart.yaml k8s-helm-create-temp-dependencies ## Generates the final helm chart.

${K8S_HELM_TARGET}/Chart.yaml: $(K8S_RESOURCE_TEMP_FOLDER)
@echo "Generate helm chart..."
Expand Down Expand Up @@ -135,44 +135,27 @@ ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml: $(K8S_PRE_GENERATE_
@sed -i "s/'{{ .Namespace }}'/'{{ .Release.Namespace }}'/" ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml

.PHONY: k8s-helm-package-release
k8s-helm-package-release: ${BINARY_HELM} k8s-helm-delete-existing-tgz ${K8S_HELM_RELEASE_TGZ} k8s-helm-delete-temp-dependencies k8s-helm-remove-dependency-charts ## Generates and packages the helm chart with release urls.
k8s-helm-package-release: ${BINARY_HELM} k8s-helm-delete-existing-tgz ${K8S_HELM_RELEASE_TGZ} ## Generates and packages the helm chart with release urls.

.PHONY: k8s-helm-delete-existing-tgz
k8s-helm-delete-existing-tgz: ## Remove an existing Helm package.
# remove
@rm -f ${K8S_HELM_RELEASE_TGZ}*

${K8S_HELM_RELEASE_TGZ}: ${BINARY_HELM} ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml k8s-helm-create-temp-dependencies $(K8S_POST_GENERATE_TARGETS) ## Generates and packages the helm chart with release urls.
${K8S_HELM_RELEASE_TGZ}: ${BINARY_HELM} ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml k8s-helm-generate-chart $(K8S_POST_GENERATE_TARGETS) ## Generates and packages the helm chart with release urls.
@echo "Package generated helm chart"
@${BINARY_HELM} package ${K8S_HELM_TARGET} -d ${K8S_HELM_TARGET} ${BINARY_HELM_ADDITIONAL_PACK_ARGS}

.PHONY: k8s-helm-create-temp-dependencies
k8s-helm-create-temp-dependencies: k8s-helm-generate-chart
k8s-helm-create-temp-dependencies: ${BINARY_YQ} ${K8S_HELM_TARGET}/Chart.yaml
# we use helm dependencies internally but never use them as "official" dependency because the namespace may differ
# instead we create empty dependencies to satisfy the helm package call and delete the whole directory from the chart.tgz later-on.
@echo "Create helm temp dependencies (if they exist)"
@for dep in `yq -e '.dependencies[].name // ""' ${K8S_HELM_TARGET}/Chart.yaml`; do \
@for dep in `${BINARY_YQ} -e '.dependencies[].name // ""' ${K8S_HELM_TARGET}/Chart.yaml`; do \
mkdir -p ${K8S_HELM_TARGET}/${K8S_HELM_TARGET_DEP_DIR}/$${dep} ; \
sed "s|replaceme|$${dep}|g" $(BUILD_DIR)/make/k8s-helm-temp-chart.yaml > ${K8S_HELM_TARGET}/${K8S_HELM_TARGET_DEP_DIR}/$${dep}/Chart.yaml ; \
done

.PHONY: k8s-helm-delete-temp-dependencies
k8s-helm-delete-temp-dependencies:
@echo "Delete helm temp dependencies (if they exist)"
@rm -rf ${K8S_HELM_TARGET}/${K8S_HELM_TARGET_DEP_DIR}

.PHONY: k8s-helm-remove-dependency-charts
k8s-helm-remove-dependency-charts: ${K8S_HELM_RELEASE_TGZ}
# deleting dirs from a .tgz is hard so un-tar,remove dir,re-tar is a good alternative
# but only if any dependency directory actually exists
@if tar -tf ${K8S_HELM_RELEASE_TGZ} ${ARTIFACT_ID}/${K8S_HELM_TARGET_DEP_DIR} > /dev/null 2>&1; then \
echo "Remove dependency files from ${K8S_HELM_RELEASE_TGZ}" ; \
gzip --to-stdout --decompress ${K8S_HELM_RELEASE_TGZ} | \
tar --to-stdout --delete "${ARTIFACT_ID}/${K8S_HELM_TARGET_DEP_DIR}" -f - | \
gzip > ${K8S_HELM_RELEASE_TGZ}.temp ; \
rm ${K8S_HELM_RELEASE_TGZ} && mv ${K8S_HELM_RELEASE_TGZ}.temp ${K8S_HELM_RELEASE_TGZ} ; \
fi

.PHONY: chart-import
chart-import: check-all-vars check-k8s-artifact-id k8s-helm-generate-chart k8s-helm-package-release image-import ## Imports the currently available image into the cluster-local registry.
@echo "Import ${K8S_HELM_RELEASE_TGZ} into K8s cluster ${K3CES_REGISTRY_URL_PREFIX}..."
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ kind: Kustomization
images:
- name: controller
newName: cloudogu/k8s-component-operator
newTag: 0.1.1
newTag: 0.1.2
3 changes: 1 addition & 2 deletions config/samples/dogu-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ metadata:
name: k8s-dogu-operator
spec:
name: k8s-dogu-operator
namespace: k8s
version: 0.35.0
namespace: k8s
8 changes: 8 additions & 0 deletions config/samples/k8s-ces-control.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: k8s.cloudogu.com/v1
kind: Component
metadata:
name: k8s-ces-control
spec:
name: k8s-ces-control
namespace: k8s
version: 0.1.0
8 changes: 8 additions & 0 deletions config/samples/k8s-host-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: k8s.cloudogu.com/v1
kind: Component
metadata:
name: k8s-host-change
spec:
name: k8s-host-change
namespace: k8s
version: 0.1.1
8 changes: 8 additions & 0 deletions config/samples/k8s-service-discovery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: k8s.cloudogu.com/v1
kind: Component
metadata:
name: k8s-service-discovery
spec:
name: k8s-service-discovery
namespace: k8s
version: 0.13.0
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.20
require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/bombsimon/logrusr/v2 v2.0.1
github.com/cloudogu/cesapp-lib v0.12.1
github.com/cloudogu/k8s-apply-lib v0.4.2
github.com/go-logr/logr v1.2.4
github.com/mittwald/go-helm-client v0.12.3
Expand Down Expand Up @@ -46,6 +47,7 @@ require (
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudogu/cesapp-lib v0.12.1 h1:FBHviZwc3fZB3cMqhK7BqRQD5HZZJcDt6BiG7kAKrTc=
github.com/cloudogu/cesapp-lib v0.12.1/go.mod h1:PTQqI3xs1ReJMXYE6BGTF33yAfmS4J7P8UiE4AwDMDY=
github.com/cloudogu/go-helm-client v0.0.0-20230822080918-4b3b24282d0d h1:wORDIdIYkMpsHrNUXbyhllPYpM8fbXIYqv0jvrcIj6I=
github.com/cloudogu/go-helm-client v0.0.0-20230822080918-4b3b24282d0d/go.mod h1:b1jCbr7z27zWDtVPp3IjXDMwe7GrHxg/L8jOC5jW9Ls=
github.com/cloudogu/k8s-apply-lib v0.4.2 h1:D5hTYvIZya+tAyGCUGaZ1T83otvpQwzrZXz5JPHQQ5M=
Expand Down Expand Up @@ -78,6 +80,8 @@ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHz
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4=
github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q=
github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/emicklei/go-restful/v3 v3.10.2 h1:hIovbnmBTLjHXkqEBUz3HGpXZdM7ZrE9fJIZIqlJLqE=
github.com/emicklei/go-restful/v3 v3.10.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down
Loading

0 comments on commit 0835fd5

Please sign in to comment.