Skip to content

Commit

Permalink
Dependency, k8s, and image updates (#402)
Browse files Browse the repository at this point in the history
* update go and tests workflow

Use go 1.19.3, bump action versions, and test with k8s 1.21-1.25

* update image versions

alpine 3.16.2 -> 3.16.3
ubi-minimal 8.6 -> 8.7

* update go deps

    go list -u -m -json all | jq -r 'select(.Indirect != true and .Update != null) | .Path+"@"+.Update.Version' | xargs -L1 go get
    go mod tidy

github.com/cenkalti/backoff/v4 v4.1.1 => v4.1.3
github.com/hashicorp/go-hclog v1.0.0 => v1.3.1
github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1 => v0.1.2
github.com/hashicorp/vault/sdk v0.2.1 => v0.6.1
github.com/mitchellh/cli v1.1.4 => v1.1.5
github.com/operator-framework/operator-lib v0.8.0 => v0.11.0
github.com/prometheus/client_golang v1.11.1 => v1.12.1
github.com/stretchr/testify v1.8.0 => v1.8.1
k8s.io/api v0.22.2 => v0.25.4
k8s.io/apimachinery v0.22.2 => v0.25.4
k8s.io/client-go v0.22.2 => v0.25.4

* update more actions

* corev1.Handler => corev1.LifecycleHandler

* update set-output usage in workflows

* changelog++ and vault 1.12.1
  • Loading branch information
tvoran committed Nov 16, 2022
1 parent d5a5e18 commit 9664f15
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 547 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}

Expand Down Expand Up @@ -137,4 +137,3 @@ jobs:
target: ubi
arch: amd64
redhat_tag: quay.io/redhat-isv-containers/5f89bbc30b94cf64cfeb500b:${{env.version}}-ubi

4 changes: 2 additions & 2 deletions .github/workflows/jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
id: preprocess
run: |
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
echo "::set-output name=type::PR"
echo "type=PR" >> $GITHUB_OUTPUT
else
echo "::set-output name=type::ISS"
echo "type=ISS" >> $GITHUB_OUTPUT
fi
- name: Create ticket
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Determine Go version
id: get-go-version
run: |
echo "Building with Go $(cat .go-version)"
echo "::set-output name=go-version::$(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
test:
env:
Expand All @@ -24,10 +24,10 @@ jobs:
- get-go-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# cache/restore go mod
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
Expand All @@ -36,7 +36,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}

Expand All @@ -59,37 +59,37 @@ jobs:
strategy:
fail-fast: false
matrix:
kind-k8s-version: [1.19.16, 1.20.15, 1.21.12, 1.22.9, 1.23.6, 1.24.2]
kind-k8s-version: [1.21.14, 1.22.15, 1.23.13, 1.24.7, 1.25.3]
runs-on: ubuntu-latest
steps:
# Setup test tools from https://github.com/hashicorp/vault-helm/blob/main/.github/workflows/setup-test-tools/action.yaml
- uses: actions/setup-node@v2
with:
node-version: '14'
- uses: actions/setup-node@v3
- run: npm install -g bats@${BATS_VERSION}
shell: bash
env:
BATS_VERSION: '1.5.0'
BATS_VERSION: '1.8.2'
- run: bats -v
shell: bash
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install yq
shell: bash

# Checkout vault-helm for acceptance test code.
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: "hashicorp/vault-helm"
ref: "v0.20.1"
ref: "v0.22.1"
path: "vault-helm"

- name: Create K8s Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.4.0
with:
cluster_name: kind
config: vault-helm/test/kind/config.yaml
node_image: kindest/node:v${{ matrix.kind-k8s-version }}
version: v0.14.0
version: v0.16.0

- uses: actions/download-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.2
1.19.3
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
## Unreleased

Changes:
* Building with go 1.19.3
* Default to Vault v1.12.1

Features:
* Allow modifying agent and agent-init containers with json-patch [GH-399](https://github.com/hashicorp/vault-k8s/pull/399)
* Support for setting [`exit_on_err`](https://github.com/hashicorp/vault/pull/17091) in the agent auto-auth method config [GH-400](https://github.com/hashicorp/vault-k8s/pull/400).

Improvements:
* Dependency updates:
* github.com/cenkalti/backoff/v4 v4.1.1 => v4.1.3
* github.com/hashicorp/go-hclog v1.0.0 => v1.3.1
* github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1 => v0.1.2
* github.com/hashicorp/vault/sdk v0.2.1 => v0.6.1
* github.com/mitchellh/cli v1.1.4 => v1.1.5
* github.com/operator-framework/operator-lib v0.8.0 => v0.11.0
* github.com/prometheus/client_golang v1.11.1 => v1.12.1
* github.com/stretchr/testify v1.8.0 => v1.8.1
* k8s.io/api v0.22.2 => v0.25.4
* k8s.io/apimachinery v0.22.2 => v0.25.4
* k8s.io/client-go v0.22.2 => v0.25.4

## 1.0.1 (October 24, 2022)

Changes:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# `default` is the production docker image which cannot be built locally.
# For local dev and testing purposes, please build and use the `dev` docker image.

ARG ALPINE_VERSION=3.16.2
ARG ALPINE_VERSION=3.16.3

FROM docker.mirror.hashicorp.services/alpine:${ALPINE_VERSION} as dev

Expand Down Expand Up @@ -61,7 +61,7 @@ ENTRYPOINT ["/bin/vault-k8s"]

# This target creates a production ubi release image
# for the project for use on OpenShift.
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6 as ubi
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 as ubi

ARG PRODUCT_NAME
ARG PRODUCT_VERSION
Expand Down
4 changes: 2 additions & 2 deletions agent-inject/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"strconv"
"strings"

"github.com/evanphx/json-patch"
jsonpatch "github.com/evanphx/json-patch"
"github.com/hashicorp/vault/sdk/helper/strutil"
corev1 "k8s.io/api/core/v1"
)

const (
DefaultVaultImage = "hashicorp/vault:1.12.0"
DefaultVaultImage = "hashicorp/vault:1.12.1"
DefaultVaultAuthType = "kubernetes"
DefaultVaultAuthPath = "auth/kubernetes"
DefaultAgentRunAsUser = 100
Expand Down
2 changes: 1 addition & 1 deletion agent-inject/agent/container_sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (a *Agent) createLifecycle() corev1.Lifecycle {
flags := a.vaultCliFlags()
flags = append(flags, "-self")

lifecycle.PreStop = &corev1.Handler{
lifecycle.PreStop = &corev1.LifecycleHandler{
Exec: &corev1.ExecAction{
Command: []string{"/bin/sh", "-c", fmt.Sprintf("/bin/sleep %d && /bin/vault token revoke %s", a.RevokeGrace, strings.Join(flags[:], " "))},
},
Expand Down
6 changes: 2 additions & 4 deletions agent-inject/agent/container_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"testing"

"github.com/evanphx/json-patch"
jsonpatch "github.com/evanphx/json-patch"
"github.com/hashicorp/vault-k8s/agent-inject/internal"
"github.com/hashicorp/vault/sdk/helper/pointerutil"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -115,7 +115,6 @@ func TestContainerSidecarVolume(t *testing.T) {
}

func TestContainerSidecarVolumeWithIRSA(t *testing.T) {

annotations := map[string]string{
AnnotationVaultRole: "foobar",
// this will have different mount path
Expand Down Expand Up @@ -1278,7 +1277,6 @@ func TestContainerCache(t *testing.T) {
}

func TestAgentJsonPatch(t *testing.T) {

baseContainer := corev1.Container{
Name: "vault-agent",
Image: "foobar-image",
Expand All @@ -1299,7 +1297,7 @@ func TestAgentJsonPatch(t *testing.T) {
{Name: "vault-secrets", MountPath: "/vault/secrets"},
},
Lifecycle: &v1.Lifecycle{
PreStop: &v1.Handler{
PreStop: &v1.LifecycleHandler{
Exec: &v1.ExecAction{
Command: []string{"/bin/sh", "-c", "/bin/sleep 5 && /bin/vault token revoke -address=http://foobar:1234 -self"},
},
Expand Down
2 changes: 1 addition & 1 deletion deploy/injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
- name: AGENT_INJECT_VAULT_ADDR
value: "https://vault.$(NAMESPACE).svc:8200"
- name: AGENT_INJECT_VAULT_IMAGE
value: "hashicorp/vault:1.12.0"
value: "hashicorp/vault:1.12.1"
- name: AGENT_INJECT_TLS_AUTO
value: vault-agent-injector-cfg
- name: AGENT_INJECT_TLS_AUTO_HOSTS
Expand Down
86 changes: 48 additions & 38 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,82 +3,92 @@ module github.com/hashicorp/vault-k8s
go 1.19

require (
github.com/cenkalti/backoff/v4 v4.1.1
github.com/cenkalti/backoff/v4 v4.1.3
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/hashicorp/go-hclog v1.0.0
github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1
github.com/hashicorp/vault/sdk v0.2.1
github.com/hashicorp/go-hclog v1.3.1
github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.2
github.com/hashicorp/vault/sdk v0.6.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/kr/text v0.2.0
github.com/mitchellh/cli v1.1.4
github.com/operator-framework/operator-lib v0.8.0
github.com/mitchellh/cli v1.1.5
github.com/operator-framework/operator-lib v0.11.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.1
github.com/prometheus/client_golang v1.14.0
github.com/radovskyb/watcher v1.0.7
github.com/stretchr/testify v1.7.0
k8s.io/api v0.22.2
k8s.io/apimachinery v0.22.2
k8s.io/client-go v0.22.2
github.com/stretchr/testify v1.8.1
k8s.io/api v0.25.4
k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.4
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.26.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
sigs.k8s.io/controller-runtime v0.9.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/controller-runtime v0.12.1 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 9664f15

Please sign in to comment.