Skip to content

Commit

Permalink
update go 1.22.7
Browse files Browse the repository at this point in the history
  • Loading branch information
koba1t committed Sep 14, 2024
1 parent 4034e36 commit 5ba8523
Show file tree
Hide file tree
Showing 70 changed files with 99 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

run:
deadline: 5m
go: '1.21'
go: '1.22'

linters:
enable-all: true
Expand Down
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/api

go 1.21
go 1.22.7

require (
github.com/blang/semver/v4 v4.0.0
Expand Down
49 changes: 29 additions & 20 deletions cmd/config/docs/api-conventions/functions-impl.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# Running Configuration Functions using kustomize CLI

Configuration functions can be implemented using any toolchain and invoked using any
container workflow orchestrator including Tekton, Cloud Build, or run directly using `docker run`.
Configuration functions can be implemented using any toolchain and invoked using
any container workflow orchestrator including Tekton, Cloud Build, or run
directly using `docker run`.

Run `config help docs-fn-spec` to see the Configuration Functions Specification.

`kustomize fn run` is an example orchestrator for invoking Configuration Functions. This
document describes how to implement and invoke an example function.
`kustomize fn run` is an example orchestrator for invoking Configuration
Functions. This document describes how to implement and invoke an example
function.

## Example Function Implementation

Following is an example for implementing an nginx abstraction using a configuration
function.
Following is an example for implementing an nginx abstraction using a
configuration function.

### `nginx-template.sh`

`nginx-template.sh` is a simple bash script which uses a _heredoc_ as a templating solution
for generating Resources from the functionConfig input fields.
`nginx-template.sh` is a simple bash script which uses a _heredoc_ as a
templating solution for generating Resources from the functionConfig input
fields.

The script wraps itself using `config run wrap -- $0` which will:

1. Parse the `ResourceList.functionConfig` (provided to the container stdin) into env vars
1. Parse the `ResourceList.functionConfig` (provided to the container stdin)
into env vars
2. Merge the stdout into the original list of Resources
3. Defaults filenames for newly generated Resources (if they are not set as annotations)
to `config/NAME_KIND.yaml`
3. Defaults filenames for newly generated Resources (if they are not set as
annotations) to `config/NAME_KIND.yaml`
4. Format the output

```bash
Expand Down Expand Up @@ -82,10 +86,11 @@ End-of-message

### Dockerfile

`Dockerfile` installs `kustomize fn` and copies the script into the container image.
`Dockerfile` installs `kustomize fn` and copies the script into the container
image.

```
FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
RUN go get sigs.k8s.io/kustomize/cmd/config
RUN mv /go/bin/config /usr/bin/config
COPY nginx-template.sh /usr/bin/nginx-template.sh
Expand All @@ -94,20 +99,23 @@ CMD ["nginx-template.sh]

## Example Function Usage

Following is an example of running the `kustomize fn run` using the preceding API.
Following is an example of running the `kustomize fn run` using the preceding
API.

When run by `kustomize fn run`, functions are run in containers with the
following environment:

- Network: `none`
- User: `nobody`
- Security Options: `no-new-privileges`
- Volumes: the volume containing the `functionConfig` yaml is mounted under `/local` as `ro`
- Volumes: the volume containing the `functionConfig` yaml is mounted under
`/local` as `ro`

### Input

`dir/nginx.yaml` contains a reference to the Function. The contents of `nginx.yaml`
are passed to the Function through the `ResourceList.functionConfig` field.
`dir/nginx.yaml` contains a reference to the Function. The contents of
`nginx.yaml` are passed to the Function through the
`ResourceList.functionConfig` field.

```yaml
apiVersion: example.com/v1beta1
Expand All @@ -123,9 +131,10 @@ spec:
replicas: 5
```
- `annotations[config.kubernetes.io/function].container.image`: the image to use for this API
- `annotations[config.kubernetes.io/local-config]`: mark this as not a Resource that should
be applied
- `annotations[config.kubernetes.io/function].container.image`: the image to use
for this API
- `annotations[config.kubernetes.io/local-config]`: mark this as not a Resource
that should be applied

### Output

Expand Down
2 changes: 1 addition & 1 deletion cmd/config/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/config

go 1.21
go 1.22.7

require (
github.com/go-errors/errors v1.4.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/

Expand Down
2 changes: 1 addition & 1 deletion cmd/config/internal/commands/e2e/e2econtainerconfig/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerconfig

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.14.2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerenvgenerator

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.14.2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainer-render-helm-chart

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.14.2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainersimplegenerator

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.14.2

Expand Down
2 changes: 1 addition & 1 deletion cmd/config/internal/generateddocs/api/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/depprobcheck/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/depprobcheck

go 1.21
go 1.22.7

require (
k8s.io/cli-runtime v0.20.4
Expand Down
2 changes: 1 addition & 1 deletion cmd/gorepomod/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/gorepomod

go 1.21
go 1.22.7

require (
github.com/spf13/viper v1.17.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/k8scopy/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/k8scopy

go 1.21
go 1.22.7

require (
github.com/stretchr/testify v1.8.4
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdtogo/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module sigs.k8s.io/kustomize/cmd/mdtogo

go 1.21
go 1.22.7
2 changes: 1 addition & 1 deletion cmd/pluginator/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/cmd/pluginator/v2

go 1.21
go 1.22.7

require (
github.com/spf13/cobra v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/pluginator/internal/krmfunction/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *Converter) Convert() error {
}

func (c *Converter) getDockerfile() string {
return `FROM golang:1.21-bullseye
return `FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY . .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module main

go 1.21
go 1.22.7

require (
github.com/spf13/cobra v1.4.0
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/application-cr/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/application-cr/image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/application-cr

go 1.21
go 1.22.7

require (
k8s.io/apimachinery v0.29.0
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/fn-framework-application/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/fn-framework-application

go 1.21
go 1.22.7

require (
github.com/spf13/cobra v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/injection-tshirt-sizes/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/injection-tshirt-sizes/image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/injection-tshirt-sizes

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.13.7

Expand Down
2 changes: 1 addition & 1 deletion functions/examples/template-go-nginx/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/template-go-nginx/image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/template-go-nginx

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.13.7

Expand Down
2 changes: 1 addition & 1 deletion functions/examples/validator-kubeval/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM alpine:latest as schemas
RUN apk --no-cache add git
RUN git clone --depth 1 https://github.com/instrumenta/kubernetes-json-schema.git

FROM golang:1.21-bullseye as function
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye as function
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
Expand Down
2 changes: 1 addition & 1 deletion functions/examples/validator-kubeval/image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/validator-kubeval

go 1.21
go 1.22.7

require (
github.com/instrumenta/kubeval v0.16.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

FROM golang:1.21-bullseye
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/functions/examples/validator-resource-requests

go 1.21
go 1.22.7

require sigs.k8s.io/kustomize/kyaml v0.13.7

Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.21
go 1.22.7

use (
./api
Expand Down
2 changes: 1 addition & 1 deletion hack/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/hack

go 1.21
go 1.22.7

require (
github.com/campoy/embedmd v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion kustomize.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# build
FROM golang:alpine as builder
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye as builder
ARG VERSION
ARG COMMIT
ARG DATE
Expand Down
2 changes: 1 addition & 1 deletion kustomize/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/kustomize/v5

go 1.21
go 1.22.7

require (
github.com/google/go-cmp v0.6.0
Expand Down
2 changes: 1 addition & 1 deletion kyaml/fn/framework/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func AddGenerateDockerfile(cmd *cobra.Command) {
Use: "gen [DIR]",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if err := os.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM golang:1.21-alpine as builder
if err := os.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye as builder
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion kyaml/fn/framework/command/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestCommand_dockerfile(t *testing.T) {
t.FailNow()
}

expected := `FROM golang:1.21-alpine as builder
expected := `FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye as builder
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY go.mod go.sum ./
Expand Down
Loading

0 comments on commit 5ba8523

Please sign in to comment.