Skip to content

Commit

Permalink
chore: bump KIC to 3.1.3 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Apr 23, 2024
1 parent 1bc0486 commit 837bbcb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/samples/aigateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
spec:
containers:
- name: controller
image: kong/kubernetes-ingress-controller:3.1.2
image: kong/kubernetes-ingress-controller:3.1
env:
- name: CONTROLLER_LOG_LEVEL
value: debug
2 changes: 1 addition & 1 deletion config/samples/controlplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: controller
image: kong/kubernetes-ingress-controller:3.1.2
image: kong/kubernetes-ingress-controller:3.1
readinessProbe:
initialDelaySeconds: 1
periodSeconds: 3
Expand Down
2 changes: 1 addition & 1 deletion config/samples/gateway-httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ spec:
spec:
containers:
- name: controller
image: kong/kubernetes-ingress-controller:3.1.2
image: kong/kubernetes-ingress-controller:3.1
readinessProbe:
initialDelaySeconds: 1
periodSeconds: 1
Expand Down
20 changes: 6 additions & 14 deletions hack/generators/kic/webhook-config-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"os"
"text/template"

"github.com/kong/gateway-operator/hack/generators/kic"
kicversions "github.com/kong/gateway-operator/internal/versions"
"github.com/samber/lo"
admregv1 "k8s.io/api/admissionregistration/v1"
"k8s.io/apimachinery/pkg/util/yaml"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/kong/gateway-operator/hack/generators/kic"
kicversions "github.com/kong/gateway-operator/internal/versions"
)

const (
Expand Down Expand Up @@ -48,16 +49,7 @@ func generateHelpersForAllConfiguredVersions() {
}

// Render template.
tpl, err := template.New("tpl").Funcs(map[string]any{
// Inject a function that filters out Delete operations from the list of operations.
// It's used to make sure we do not generate webhooks that handle DELETE operations.
// We will be able to drop this workaround once we release KIC 3.1.2 or 3.2.0.
"withoutDeletes": func(operations []admregv1.OperationType) []admregv1.OperationType {
return lo.Reject(operations, func(operation admregv1.OperationType, _ int) bool {
return operation == admregv1.Delete
})
},
}).Parse(generateValidatingWebhookConfigurationForKICVersionTemplate)
tpl, err := template.New("tpl").Parse(generateValidatingWebhookConfigurationForKICVersionTemplate)
if err != nil {
log.Fatalf("Failed to parse 'generateValidatingWebhookConfigurationForKICTemplate' template: %s", err)
}
Expand Down Expand Up @@ -85,7 +77,7 @@ func generateHelpersForAllConfiguredVersions() {

// Write the output to a file.
outPath := fmt.Sprintf(validatingWebhookConfigurationGeneratorForVersionOutputPath, sanitizedConstraint)
if err := os.WriteFile(outPath, buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(outPath, buf.Bytes(), 0o644); err != nil {
log.Fatalf("Failed to write output to %s: %s", outPath, err)
}
log.Printf("Successfully generated %s\n", outPath)
Expand Down Expand Up @@ -114,7 +106,7 @@ func generateMasterHelper() {

// Write the output to a file.
outPath := validatingWebhookConfigurationGeneratorMasterOutputPath
if err := os.WriteFile(outPath, buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(outPath, buf.Bytes(), 0o644); err != nil {
log.Fatalf("Failed to write output to %s: %s", outPath, err)
}
log.Printf("Successfully generated %s\n", outPath)
Expand Down
2 changes: 1 addition & 1 deletion hack/generators/kic/webhook-config-generator/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func GenerateValidatingWebhookConfigurationForKIC_{{ .SanitizedVersionConstraint
},
},
Operations: []admregv1.OperationType{
{{- range (withoutDeletes .Operations) }}
{{- range .Operations }}
"{{ . }}",
{{- end }}
},
Expand Down
4 changes: 2 additions & 2 deletions internal/versions/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
// and those tests create KIC's URLs for things like roles or CRDs.
// Since KIC only defines the full tags in its repo (as expected) we cannot use
// a partial version here, as it would not match KIC's tag.
DefaultControlPlaneVersion = "3.1.2"
DefaultControlPlaneVersion = "3.1.3"
)

// minimumControlPlaneVersion indicates the bare minimum version of the
Expand All @@ -35,7 +35,7 @@ var minimumControlPlaneVersion = semver.MustParse("3.1.2")
// the release 5.0, a new entry '">=5.0": "5.0"' should be added to this map, and the previous most
// updated entry should be limited to "<5.0".
var ManifestsVersionsForKICVersions = map[string]semver.Version{
">=3.1": semver.MustParse("3.1.2"),
">=3.1": semver.MustParse("3.1.3"),
}

// IsControlPlaneImageVersionSupported is a helper intended to validate the
Expand Down

0 comments on commit 837bbcb

Please sign in to comment.