Skip to content

Commit

Permalink
chore: upgrade controller-gen from 0.4.1 to 0.14.0 (#17893)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev authored Apr 18, 2024
1 parent 3a46e8c commit 33f5714
Show file tree
Hide file tree
Showing 10 changed files with 713 additions and 666 deletions.
30 changes: 30 additions & 0 deletions docs/operator-manual/upgrading/2.11-2.12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# v2.11 to 2.12

## Server-Side Apply Management of ApplicationSet Fields

### Summary

If you are using server-side apply with multiple field managers to manage a single `selector` or `labelSelector` field
in an ApplicationSet, that field management must be changed to be atomic starting with 2.12.

### Details

Argo CD 2.12 upgraded its controller-gen version from 0.4.1 to 0.14.0. As part of that change, several ApplicationSet
CRD fields now have `x-kubernetes-map-type: atomic`.

Each of the affected fields is a label selector with two child keys: `matchLabels` and `matchExpressions`.

Prior to this change, two field managers could manage the `matchLabels` and `matchExpressions` fields independently.
Starting with the 2.12 CRD, a single field manager must manage both of those fields. This behavior is in line with the
upstream behavior of the label selector struct.

See the [Kubernetes server-side apply merge strategy docs](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy)
for more information about the fields' behavior.

The affected ApplicationSet fields are the following (jq selector syntax):

* `.spec.generators[].selector`
* `.spec.generators[].cluster.selector`
* `.spec.generators[].clusterDecisionResource.labelSelector`
* `.spec.generators[].matrix.generators[].selector`
* `.spec.generators[].merge.generators[].selector`
2 changes: 2 additions & 0 deletions docs/operator-manual/upgrading/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/<v

<hr/>

* [v2.11 to v2.12](./2.11-2.12.md)
* [v2.10 to v2.11](./2.10-2.11.md)
* [v2.9 to v2.10](./2.9-2.10.md)
* [v2.8 to v2.9](./2.8-2.9.md)
* [v2.7 to v2.8](./2.7-2.8.md)
Expand Down
1 change: 0 additions & 1 deletion hack/gen-crd-spec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func getCustomResourceDefinitions() map[string]*extensionsobj.CustomResourceDefi
crdYamlBytes, err := exec.Command(
"controller-gen",
"paths=./pkg/apis/application/...",
"crd:trivialVersions=true",
"crd:crdVersions=v1",
"output:crd:stdout",
).Output()
Expand Down
2 changes: 1 addition & 1 deletion hack/installers/install-codegen-go-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ go_mod_install k8s.io/code-generator/cmd/lister-gen
go_mod_install k8s.io/kube-openapi/cmd/openapi-gen

# controller-gen is run by ./hack/gen-crd-spec to generate the CRDs
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0

# swagger cli is used to generate swagger docs
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.28.0
Expand Down
336 changes: 170 additions & 166 deletions manifests/core-install.yaml

Large diffs are not rendered by default.

267 changes: 128 additions & 139 deletions manifests/crds/application-crd.yaml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions manifests/crds/applicationset-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
name:
type: string
requeueAfterSeconds:
Expand Down Expand Up @@ -657,6 +658,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
template:
properties:
metadata:
Expand Down Expand Up @@ -2419,6 +2421,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
name:
type: string
requeueAfterSeconds:
Expand Down Expand Up @@ -3015,6 +3018,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
template:
properties:
metadata:
Expand Down Expand Up @@ -6880,6 +6884,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
type: object
type: array
template:
Expand Down Expand Up @@ -7476,6 +7481,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
name:
type: string
requeueAfterSeconds:
Expand Down Expand Up @@ -8072,6 +8078,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
template:
properties:
metadata:
Expand Down Expand Up @@ -11937,6 +11944,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
type: object
type: array
mergeKeys:
Expand Down Expand Up @@ -14637,6 +14645,7 @@ spec:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
type: object
type: array
goTemplate:
Expand Down
60 changes: 33 additions & 27 deletions manifests/crds/appproject-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,28 @@ spec:
- name: v1alpha1
schema:
openAPIV3Schema:
description: 'AppProject provides a logical grouping of applications, providing
controls for: * where the apps may deploy to (cluster whitelist) * what
may be deployed (repository whitelist, resource whitelist/blacklist) * who
can access these applications (roles, OIDC group claims bindings) * and
what they can do (RBAC policies) * automation access to these roles (JWT
tokens)'
description: |-
AppProject provides a logical grouping of applications, providing controls for:
* where the apps may deploy to (cluster whitelist)
* what may be deployed (repository whitelist, resource whitelist/blacklist)
* who can access these applications (roles, OIDC group claims bindings)
* and what they can do (RBAC policies)
* automation access to these roles (JWT tokens)
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 All @@ -46,9 +52,9 @@ spec:
description: ClusterResourceBlacklist contains list of blacklisted
cluster level resources
items:
description: GroupKind specifies a Group and a Kind, but does not
force a version. This is useful for identifying concepts during
lookup stages without having partially valid types
description: |-
GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying
concepts during lookup stages without having partially valid types
properties:
group:
type: string
Expand All @@ -63,9 +69,9 @@ spec:
description: ClusterResourceWhitelist contains list of whitelisted
cluster level resources
items:
description: GroupKind specifies a Group and a Kind, but does not
force a version. This is useful for identifying concepts during
lookup stages without having partially valid types
description: |-
GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying
concepts during lookup stages without having partially valid types
properties:
group:
type: string
Expand All @@ -92,9 +98,9 @@ spec:
not set.
type: string
namespace:
description: Namespace specifies the target namespace for the
application's resources. The namespace will only be set for
namespace-scoped resources that have not set a value for .metadata.namespace
description: |-
Namespace specifies the target namespace for the application's resources.
The namespace will only be set for namespace-scoped resources that have not set a value for .metadata.namespace
type: string
server:
description: Server specifies the URL of the target cluster's
Expand All @@ -107,9 +113,9 @@ spec:
description: NamespaceResourceBlacklist contains list of blacklisted
namespace level resources
items:
description: GroupKind specifies a Group and a Kind, but does not
force a version. This is useful for identifying concepts during
lookup stages without having partially valid types
description: |-
GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying
concepts during lookup stages without having partially valid types
properties:
group:
type: string
Expand All @@ -124,9 +130,9 @@ spec:
description: NamespaceResourceWhitelist contains list of whitelisted
namespace level resources
items:
description: GroupKind specifies a Group and a Kind, but does not
force a version. This is useful for identifying concepts during
lookup stages without having partially valid types
description: |-
GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying
concepts during lookup stages without having partially valid types
properties:
group:
type: string
Expand Down
Loading

0 comments on commit 33f5714

Please sign in to comment.