From 6356bfc55b43f014bb9e9beeef619cc21f26448d Mon Sep 17 00:00:00 2001 From: Nic Jackson Date: Wed, 9 Feb 2022 20:35:39 +0000 Subject: [PATCH] fix release --- .github/workflows/go.yml | 18 +- Makefile | 13 +- .../consul-release-controller/Chart.tpl | 2 +- .../consul-release-controller/Chart.yaml | 4 +- .../consul-release-controller/values.tpl | 158 ++++++++++++++++++ .../consul-release-controller/values.yaml | 2 +- docs/index.yaml | 15 +- 7 files changed, 183 insertions(+), 29 deletions(-) create mode 100644 deploy/kubernetes/charts/consul-release-controller/values.tpl diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c0b1aca..3b92523 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -137,9 +137,9 @@ jobs: release: name: Build production Docker image and release Helm chart runs-on: ubuntu-latest - needs: - - build - - functional_tests + #needs: + # - build + # - functional_tests if: ${{ github.ref == 'refs/heads/main' }} steps: @@ -175,19 +175,19 @@ jobs: run: | make build_docker env: - VERSION_ENV: ${{ steps.next_version.outputs.new_version }} + VERSION_ENV: ${{ steps.tag_version.outputs.new_version }} - name: Generate the Helm release run: | make generate_helm env: - VERSION_ENV: ${{ steps.next_version.outputs.new_version }} + VERSION_ENV: ${{ steps.tag_version.outputs.new_version }} - name: Commit changes uses: EndBug/add-and-commit@v8 with: default_author: github_actions - message: 'Update helm chart to version ${{ steps.next_version.outputs.new_version }}' + message: 'Update helm chart to version ${{ steps.tag_version.outputs.new_version }}' add: '*.yaml' - name: Bump version and push tag @@ -200,10 +200,10 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ steps.next_version.outputs.new_tag }} + tag_name: ${{ steps.tag_version.outputs.new_tag }} token: ${{ secrets.GH_TOKEN }} files: | - ./consul-release-controller-${{ steps.next_version.outputs.new_version }}.tgz + ./consul-release-controller-${{ steps.tag_version.outputs.new_version }}.tgz - name: Deploy Github pages uses: JamesIves/github-pages-deploy-action@v4.2.3 @@ -216,4 +216,4 @@ jobs: if: always() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} - description: "Built new Docker image" + description: "Built new Docker image" \ No newline at end of file diff --git a/Makefile b/Makefile index 697686d..c9319c2 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,11 @@ SHELL := /bin/bash UNAME := $(shell uname) ifeq "$(VERSION_ENV)" "" - VERSION = $(shell git log --pretty=format:'%h' -n 1) + VERSION=$(shell git log --pretty=format:'%h' -n 1) + HELM_VERSION=0.0.1-dev else - VERSION = $(VERSION_ENV) + VERSION=$(VERSION_ENV) + HELM_VERSION=$(VERSION_ENV) endif # Build and push the Arm64 and x64 images to the Docker registry @@ -75,9 +77,14 @@ generate_helm: kustomize build ./kubernetes/controller/config/helm -o ./deploy/kubernetes/charts/consul-release-controller/templates # Set the version in the chart + cp ./deploy/kubernetes/charts/consul-release-controller/Chart.tpl ./deploy/kubernetes/charts/consul-release-controller/Chart.yaml sedi=(-i) && [ "$(UNAME)" == "Darwin" ] && sedi=(-i '') ; \ - sed "$${sedi[@]}" -e 's/##VERSION##/${VERSION}/' ./deploy/kubernetes/charts/consul-release-controller/Chart.yaml + sed "$${sedi[@]}" -e 's/##VERSION##/${HELM_VERSION}/' ./deploy/kubernetes/charts/consul-release-controller/Chart.yaml + + cp ./deploy/kubernetes/charts/consul-release-controller/values.tpl ./deploy/kubernetes/charts/consul-release-controller/values.yaml + sedi=(-i) && [ "$(UNAME)" == "Darwin" ] && sedi=(-i '') ; \ + sed "$${sedi[@]}" -e 's/##VERSION##/${VERSION}/' ./deploy/kubernetes/charts/consul-release-controller/values.yaml # Now package the Helm chart into a tarball helm package ./deploy/kubernetes/charts/consul-release-controller diff --git a/deploy/kubernetes/charts/consul-release-controller/Chart.tpl b/deploy/kubernetes/charts/consul-release-controller/Chart.tpl index ee57527..bf3ea8a 100644 --- a/deploy/kubernetes/charts/consul-release-controller/Chart.tpl +++ b/deploy/kubernetes/charts/consul-release-controller/Chart.tpl @@ -21,4 +21,4 @@ version: ##VERSION## # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.16.0" +appVersion: "##VERSION##" diff --git a/deploy/kubernetes/charts/consul-release-controller/Chart.yaml b/deploy/kubernetes/charts/consul-release-controller/Chart.yaml index 8dbff57..93d4a24 100644 --- a/deploy/kubernetes/charts/consul-release-controller/Chart.yaml +++ b/deploy/kubernetes/charts/consul-release-controller/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 3568545 +version: 3.2.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.16.0" +appVersion: "3.2.2" diff --git a/deploy/kubernetes/charts/consul-release-controller/values.tpl b/deploy/kubernetes/charts/consul-release-controller/values.tpl new file mode 100644 index 0000000..8722135 --- /dev/null +++ b/deploy/kubernetes/charts/consul-release-controller/values.tpl @@ -0,0 +1,158 @@ +--- +# Default values for consul-canary +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +controller: + enabled: "true" + + container_config: + image: + repository: nicholasjackson/consul-release-controller + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "##VERSION##" + + env: + - name: HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: CONSUL_HTTP_ADDR + value: https://$(HOST_IP):8501 + - name: CONSUL_CAPATH + value: /consul/tls/client/ca/tls.crt + - name: CONSUL_HTTP_TOKEN + valueFrom: + secretKeyRef: + name: consul-controller-acl-token + key: token + # Additional environment variables to add to the controller + # deployment + # - name: MYENV + # value: myvalue + + volumeMounts: + - mountPath: /consul/tls/client/ca + name: consul-auto-encrypt-ca-cert + # Additional volume mounts to add to the container can be used to + # mount configuration or certificates needed by the specific controller implementation. + # - name: consul-ca + # mountPath: /tmp/consul/ca + + resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + additional_volumes: + - name: consul-server-ca + secret: + secretName: consul-server-cert + - name: consul-auto-encrypt-ca-cert + emptyDir: + medium: Memory + # Additional volumes to add to the controller pod + # - name: consul-ca + # secret: + # secretName: consul-ca-cert + + additional_init_containers: + - command: + - /bin/sh + - -ec + - | + consul-k8s get-consul-client-ca \ + -output-file=/consul/tls/client/ca/tls.crt \ + -server-addr=consul-server \ + -server-port=8501 \ + -ca-file=/consul/tls/ca/tls.crt + image: hashicorp/consul-k8s:0.25.0 + imagePullPolicy: IfNotPresent + name: get-auto-encrypt-client-ca + resources: + limits: + cpu: 50m + memory: 50Mi + requests: + cpu: 50m + memory: 50Mi + volumeMounts: + - mountPath: /consul/tls/ca + name: consul-server-ca + - mountPath: /consul/tls/client/ca + name: consul-auto-encrypt-ca-cert + # Add additional init containers to the controller pod + # - command: + # - /bin/sh + # - -ec + # - | + # consul-k8s get-consul-client-ca \ + # -output-file=/consul/tls/client/ca/tls.crt \ + # -server-addr=consul-server \ + # -server-port=8501 \ + # -ca-file=/consul/tls/ca/tls.crt + # image: hashicorp/consul-k8s:0.25.0 + # imagePullPolicy: IfNotPresent + # name: get-auto-encrypt-client-ca + + podAnnotations: {} + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +webhook: + enabled: "false" + type: ClusterIP + port: 443 + service: consul-release-controller-webhook + namespaceOverride: "" + + # Allows adding additional DNS Names to the cert generated + # for the webhook + additionalDNSNames: [] + + failurePolicy: Fail + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" \ No newline at end of file diff --git a/deploy/kubernetes/charts/consul-release-controller/values.yaml b/deploy/kubernetes/charts/consul-release-controller/values.yaml index 3d1a2ff..c5f0736 100644 --- a/deploy/kubernetes/charts/consul-release-controller/values.yaml +++ b/deploy/kubernetes/charts/consul-release-controller/values.yaml @@ -13,7 +13,7 @@ controller: repository: nicholasjackson/consul-release-controller pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "0.0.1" + tag: "3.2.2" env: - name: HOST_IP diff --git a/docs/index.yaml b/docs/index.yaml index 2fe77a0..a07e257 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -1,14 +1,3 @@ apiVersion: v1 -entries: - consul-release-controller: - - apiVersion: v2 - appVersion: 1.16.0 - created: "2022-02-09T06:22:40.19745639Z" - description: A Helm chart for installing the Consul release controller - digest: 6d3e762a5049bad6756548bcf7833f1f30aa654f53300376f941124b8f02c94e - name: consul-release-controller - type: application - urls: - - https://github.com/nicholasjackson/consul-release-controller/releases/download/3568545/consul-release-controller-3568545.tgz - version: "3568545" -generated: "2022-02-09T06:22:40.196736351Z" +entries: {} +generated: "2022-02-09T20:32:37.029261923Z"