Skip to content

Commit

Permalink
[release/1.3.x] config entry: add validate_clusters to mesh config en…
Browse files Browse the repository at this point in the history
…try (#4265)

* only bump consul modules
* run make ctrl-generate and ctrl-manifests
* bring back a change that gets overwritten by make scripts causing helm tests to fail
* fix unit test
* bump k8s.io dependencies
* fix lint by updating to k8s.io/utils/ptr from k8s.io/utils/pointer
* update v2 code from k8s.io/utils/ptr from k8s.io/utils/pointer
* update k8s dependencies for cli, cni modules
* update consul modules for cli
* update sdk in cni since it's lagging
  • Loading branch information
ndhanushkodi authored Aug 28, 2024
1 parent 5acc4cb commit 4cc276a
Show file tree
Hide file tree
Showing 100 changed files with 5,097 additions and 4,212 deletions.
3 changes: 3 additions & 0 deletions .changelog/4256.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
config-entry: add validate_clusters to mesh config entry
```
3 changes: 3 additions & 0 deletions .github/scripts/skip_check_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,17 @@ CONTROLLER_GEN=$(shell which controller-gen)
endif

.PHONY: ensure-controller-gen-version
ensure-controller-gen-version: ## Ensure controller-gen version is v0.12.1.
ensure-controller-gen-version: ## Ensure controller-gen version is v0.14.0.
ifeq (, $(shell which $(CONTROLLER_GEN)))
@echo "You don't have $(CONTROLLER_GEN), please install it first."
else
ifeq (, $(shell $(CONTROLLER_GEN) --version | grep v0.12.1))
@echo "controller-gen version is not v0.12.1, uninstall the binary and install the correct version with 'make get-controller-gen'."
@echo "Found version: $(shell $(CONTROLLER_GEN) --version)"
@exit 1
else
@echo "Found correct version: $(shell $(CONTROLLER_GEN) --version)"
endif
ifeq (, $(shell $(CONTROLLER_GEN) --version | grep v0.14.0))
@echo "controller-gen version is not v0.14.0, uninstall the binary and install the correct version with 'make get-controller-gen'."
@echo "Found version: $(shell $(CONTROLLER_GEN) --version)"
@exit 1
else
@echo "Found correct version: $(shell $(CONTROLLER_GEN) --version)"
endif
endif

.PHONY: add-copyright-header
Expand Down
2 changes: 1 addition & 1 deletion acceptance/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
k8s.io/api v0.28.9
k8s.io/apimachinery v0.28.9
k8s.io/client-go v0.28.9
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
k8s.io/utils v0.0.0-20240821151609-f90d01438635
sigs.k8s.io/controller-runtime v0.16.5
sigs.k8s.io/gateway-api v0.7.1
)
Expand Down
4 changes: 2 additions & 2 deletions acceptance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20240821151609-f90d01438635 h1:2wThSvJoW/Ncn9TmQEYXRnevZXi2duqHWf5OX9S3zjI=
k8s.io/utils v0.0.0-20240821151609-f90d01438635/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.16.5 h1:yr1cEJbX08xsTW6XEIzT13KHHmIyX8Umvme2cULvFZw=
sigs.k8s.io/controller-runtime v0.16.5/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0=
sigs.k8s.io/gateway-api v0.7.1 h1:Tts2jeepVkPA5rVG/iO+S43s9n7Vp7jCDhZDQYtPigQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
gwv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)
Expand All @@ -32,9 +32,9 @@ import (
// the child gateways.
func TestAPIGateway_GatewayClassConfig(t *testing.T) {
var (
defaultInstances = pointer.Int32(2)
maxInstances = pointer.Int32(3)
minInstances = pointer.Int32(1)
defaultInstances = ptr.To(int32(2))
maxInstances = ptr.To(int32(3))
minInstances = ptr.To(int32(1))

namespace = "default"
gatewayClassName = "gateway-class"
Expand Down Expand Up @@ -145,16 +145,16 @@ func TestAPIGateway_GatewayClassConfig(t *testing.T) {
logger.Log(t, "updating gatewayclassconfig values")
err = k8sClient.Get(context.Background(), types.NamespacedName{Name: gatewayClassConfigName, Namespace: namespace}, gatewayClassConfig)
require.NoError(t, err)
gatewayClassConfig.Spec.DeploymentSpec.DefaultInstances = pointer.Int32(8)
gatewayClassConfig.Spec.DeploymentSpec.MinInstances = pointer.Int32(5)
gatewayClassConfig.Spec.DeploymentSpec.DefaultInstances = ptr.To(int32(8))
gatewayClassConfig.Spec.DeploymentSpec.MinInstances = ptr.To(int32(5))
err = k8sClient.Update(context.Background(), gatewayClassConfig)
require.NoError(t, err)
checkNumberOfInstances(t, k8sClient, consulClient, gateway.Name, gateway.Namespace, defaultInstances, gateway)

// Scenario: gateways should be able to scale independently and not get overridden by the controller unless it's above the max
scale(t, k8sClient, gateway.Name, gateway.Namespace, pointer.Int32(*maxInstances+1))
scale(t, k8sClient, gateway.Name, gateway.Namespace, ptr.To(int32(*maxInstances+1)))
checkNumberOfInstances(t, k8sClient, consulClient, gateway.Name, gateway.Namespace, maxInstances, gateway)
scale(t, k8sClient, gateway.Name, gateway.Namespace, pointer.Int32(0))
scale(t, k8sClient, gateway.Name, gateway.Namespace, ptr.To(int32(0)))
checkNumberOfInstances(t, k8sClient, consulClient, gateway.Name, gateway.Namespace, minInstances, gateway)

}
Expand Down
24 changes: 15 additions & 9 deletions charts/consul/templates/crd-controlplanerequestlimits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.14.0
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand Down Expand Up @@ -36,14 +36,19 @@ spec:
API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down Expand Up @@ -155,8 +160,9 @@ spec:
description: Conditions indicate the latest available observations
of a resource's current state.
items:
description: 'Conditions define a readiness condition for a Consul
resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
description: |-
Conditions define a readiness condition for a Consul resource.
See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
properties:
lastTransitionTime:
description: LastTransitionTime is the last time the condition
Expand Down
34 changes: 21 additions & 13 deletions charts/consul/templates/crd-exportedservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.14.0
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
Expand Down Expand Up @@ -41,26 +41,33 @@ spec:
description: ExportedServices is the Schema for the exportedservices API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: ExportedServicesSpec defines the desired state of ExportedServices.
properties:
services:
description: Services is a list of services to be exported and the
list of partitions to expose them to.
description: |-
Services is a list of services to be exported and the list of partitions
to expose them to.
items:
description: ExportedService manages the exporting of a service
in the local partition to other partitions.
description: |-
ExportedService manages the exporting of a service in the local partition to
other partitions.
properties:
consumers:
description: Consumers is a list of downstream consumers of
Expand Down Expand Up @@ -99,8 +106,9 @@ spec:
description: Conditions indicate the latest available observations
of a resource's current state.
items:
description: 'Conditions define a readiness condition for a Consul
resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
description: |-
Conditions define a readiness condition for a Consul resource.
See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
properties:
lastTransitionTime:
description: LastTransitionTime is the last time the condition
Expand Down
Loading

0 comments on commit 4cc276a

Please sign in to comment.