Commit Graph

21 Commits

Author SHA1 Message Date
Alex Leong 049bc0cb04
feat(multicluster): Add Link v1alpha3 (#13801)
We add a new v1alpha3 resource version to the Link custom resource.  This version adds `excludedAnnotations` and `excludedLabels` fields to the spec which will be used to exclude labels and annotations from being copied onto mirror and federated services.

Signed-off-by: Alex Leong <alex@buoyant.io>
2025-03-19 12:13:16 -07:00
Alex Leong 396af7c946
refactor(multicluster): Replace use of unstructured API with typed bindings for Link CR (#13420)
The linkerd-multicluster extension uses client-go's `unstructured` API to access Link custom resources.  This API allowed us to develop quickly without the work of generating typed bindings.  However, using the unstrucutred API is error prone since fields must be accessed by their string name.  It is also inconsistent with the rest of the project which uses typed bindings.

We replace the use of the unstructured API for Link resources with generated typed bindings.  The client-go APIs are slightly different and client-go does not provide a way to update subresources for typed bindings.  Therefore, when updating a Link's status subresource, we use a patch instead of an update.

Signed-off-by: Alex Leong <alex@buoyant.io>
2024-12-10 11:44:19 -08:00
Alex Leong bcc563812a
Update generated client-go code (#13167)
Our generated client-go code committed in the repo has diverged from the code generated by the codegen tools.

We bring them back in sync by running bin/updated-codegen.sh. This should be a non-functional and non-breaking change.

Signed-off-by: Alex Leong <alex@buoyant.io>
2024-10-22 17:08:43 -07:00
Alejandro Pedraza 71291fe7bc
Add `accessPolicy` field to Server CRD (#12845)
Followup to #12844

This new field defines the default policy for Servers, i.e. if a request doesn't match the policy associated to a Server then this policy applies. The values are the same as for `proxy.defaultInboundPolicy` and the `config.linkerd.io/default-inbound-policy` annotation (all-unauthenticated, all-authenticated, cluster-authenticated, cluster-unauthenticated, deny), plus a new value "audit". The default is "deny", thus remaining backwards-compatible.

This field is also exposed as an additional printer column.
2024-07-22 09:01:09 -05:00
Kevin Ingelman 5f068bfbd7
Restore Server v1beta1 Go API definition (#12529)
The `v1beta1` Go API definition for Servers was removed in #11920, in favor of the `v1beta2` definition that was being added. For backwards compatibility, the `v1beta1` definition should have been left in place.

Signed-off-by: Kevin Ingelman <ki@buoyant.io>
2024-05-01 16:16:48 -07:00
Matei David 98e38a66b6
Rename meshTls to meshTLS in ExternalWorkload CRD (#12098)
The ExternalWorkload resource we introduced has a minor naming
inconsistency; `Tls` in `meshTls` is not capitalised. Other resources
that we have (e.g. authentication resources) capitalise TLS (and so does
Go, it follows a similar naming convention).

We fix this in the workload resource by changing the field's name and
bumping the version to `v1beta1`.

Upgrading the control plane version will continue to work without
downtime. However, if an existing resource exists, the policy controller
will not completely initialise. It will not enter a crashloop backoff,
but it will also not become ready until the resource is edited or
deleted.

Signed-off-by: Matei David <matei@buoyant.io>
2024-02-20 11:00:13 -08:00
Zahari Dichev 391ce919f5
policy: regenerate Server go bindings (#11920)
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2024-01-15 11:09:31 +02:00
Matei David 9fbd3c0290
Introduce bindings for ExternalWorkload resources (#11888)
We introduced an ExternalWorkload CRD for mesh expansion. This change
follows up by adding bindings for Rust and Go code.

For Go code:
* We add a new schema and ExternalWorkload types
* We also update the code-gen script to generate informers
* We add a new informer type to our abstractions built on-top of
  client-go, including a function to check if a client has access to the
  resource.

For Rust code:
* We add ExternalWorkload bindings to the policy controller.

---------

Signed-off-by: Matei David <matei@buoyant.io>
2024-01-08 14:04:20 +00:00
Alex Leong 0f5145118b
update codegen to use kube::codegen (#11722)
Recent versions of the code-generator package have replaced the `generate-groups.sh` script that we use to generate client-go bindings for custom resource types with a new script called `kube_codegen.sh`.  This PR updates our `update-codgen.sh` script to use `kube_codegen.sh` instead of `generate-groups.sh`.

Signed-off-by: Alex Leong <alex@buoyant.io>
2023-12-13 11:36:27 -08:00
Kevin Ingelman b02a6a0d83
Add codegen for httproute v1beta3 (#11008)
Add go client codegen for HttpRoute v1beta3. This will be necessary for any of the go controllers (i.e. metrics-api) or go CLI commands to interact with HttpRoute v1beta3 resources in kubernetes.

Signed-off-by: Kevin Ingelman <ki@buoyant.io>
2023-06-14 15:01:56 -07:00
Alex Leong 21bf27e541
Add codegen for httproute (#8994)
Add go client codegen for HttpRoute.  This will be necessary for any of the go controllers (i.e. metrics-api) or go CLI commands to interact with HttpRoute resources in kubernetes.

Signed-off-by: Alex Leong <alex@buoyant.io>
Co-authored-by: Oliver Gould <ver@buoyant.io>
2022-07-28 13:35:14 -07:00
Oliver Gould 172e877e3e
Add Go types for Policy CRDs (#8171)
c1a1430d added new policy CRDs: `AuthoriationPolicy`,
`MeshTLSAuthentication` and `NetworkAuthentiction` with a controller
implemented in Rust.

This change adds Go types for these resources so that they may be
accessed from the CLI, etc.

Co-authored-by: Zahari Dichev zaharidichev@gmail.com
Signed-off-by: Zahari Dichev zaharidichev@gmail.com
Signed-off-by: Oliver Gould <ver@buoyant.io>
2022-03-31 09:30:46 -07:00
Zahari Dichev 40cdb7fc23
add mc crd to codegen (#7335)
Currently, the MC `Link` CRD is being handled using the dynamic k8s client. It would be useful for consumers of this API if there was a typed API for this CRD.

The solution is to update the codegen script to generate this code.

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2021-11-23 15:49:14 -07:00
Zahari Dichev d1b444ee41
fix wrong group names in fake client (#7173)
The `Group` attribute of the`GroupVersionResource` is wrong for the fake clients.
This leads to tests failing as types are not registered and keyed correctly.

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Co-authored-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
2021-10-29 16:02:06 -06:00
Kevin Leimkuhler 00e018d277
Add policy CRD APIs (#7095)
This adds the policy CRD APIs for `Server` and `ServerAuthorization` CRDs.

The structure of each (in their respective `types.go`) is based off the `policy-crd.yaml` specs for each CRD.

Unlike service profiles, servers and server authorizations use the `oneof` extensively so I encoded that as a struct with a pointer for each possible `oneof`. For example, a server's `PodSelector` is either `MatchExpressions` or `MatchLabels`. Therefore, a `PodSelector` is defined as:

```
type PodSelector struct {
	MatchExpressions *MatchExpressions
	MatchLabels      *MatchLabels
}
```

Closes #6970 

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
2021-10-22 15:54:09 -06:00
Tarun Pothulapati d0caaa86c4
Bump k8s client-go to v0.19.2 (#5002)
Fixes #4191 #4993

This bumps Kubernetes client-go to the latest v0.19.2 (We had to switch directly to 1.19 because of this issue). Bumping to v0.19.2 required upgrading to smi-sdk-go v0.4.1. This also depends on linkerd/stern#5

This consists of the following changes:

- Fix ./bin/update-codegen.sh by adding the template path to the gen commands, as it is needed after we moved to GOMOD.
- Bump all k8s related dependencies to v0.19.2
- Generate CRD types, client code using the latest k8s.io/code-generator
- Use context.Context as the first argument, in all code paths that touch the k8s client-go interface

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2020-09-28 12:45:18 -05:00
Alex Leong d8eebee4f7
Upgrade to client-go 0.17.4 and smi-sdk-go 0.3.0 (#4221)
Here we upgrade our dependencies on client-go to 0.17.4 and smi-sdk-go to 0.3.0.  Since smi-sdk-go uses client-go 0.17.4, these upgrades must be performed simultaneously.

This also requires simultaneously upgrading our dependency on linkerd/stern to a SHA which also uses client-go 0.17.4.  This keeps all of our transitive dependencies synchronized on one version of client-go.

This ALSO requires updating our codegen scripts to use the 0.17.4 version of code-generator and running it to generate 0.17.4 compatible generated code.  I took this opportunity to update our code generation script to properly use the version of code-generater from `go.mod` rather than a hardcoded SHA.

Signed-off-by: Alex Leong <alex@buoyant.io>
2020-04-01 10:07:23 -07:00
Alejandro Pedraza 3de35ccc58
Remove Discovery service leftovers (#3500)
Followup to #2990, which refactored `linkerd endpoints` to use the
`Destination.Get` API instead of the `Discovery.Endpoints` API, leaving
the Discovery with no implented methods. This PR removes all the Discovery
code leftovers.

Fixes #3499
2019-10-15 11:20:21 -05:00
Alex Leong d6ef9ea460
Update ServiceProfile CRD to version v1alpha2 and remove validation (#3078)
The openAPIV3Schema validation in the ServiceProfiles CRD is very limited in what it can validate and is obviated by more sophisticated validation done by the validating admission controller.  Therefore, we would like to remove the openAPIV3Schema validation to reduce the size and complexity of the CRD object.

To do so, we must also bump the version of the ServiceProfile custom resource from v1alpha1 to v1alpha2.  This ensures that when the controller is upgraded, it will attempt to watch the v1alpha2 resource.  If it cannot (because, for example, the controller pod started before the ServiceProfile CRD was updated and therefore the v1alpha2 version does not exist) then it will go into a crash loop backoff until it can.  This essentially means that the controller will wait for the CRD to be upgraded to include v1alpha2 before it will start.  

Bumping the version is necessary because if we did not, it would be possible for the controller to start before the CRD is updated (removing the validation).  In this case, when the CRD is edited, the controller will lose its list watch on ServiceProfiles and will stop getting updates.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-07-23 11:46:31 -07:00
Thomas Rampelberg ea61630f9d
Update client-go to 1.13.1 (#2160)
* Update client-go to 1.13.1

Fixes #2145

* Update Dockerfile-bin with new tag

* Update all the dockerfile tags

* Clean gopkg and do not apply cluster defaults

* Update for klog

* Match existing behavior with klog

* Add klog to gopkg.lock

* Update go-deps shas

* Update klog comment

* Update comment to be a non-sentence
2019-01-28 17:42:14 -08:00
Alex Leong f1f5b49f59
Add generated Kubernetes client for ServiceProfile custom resource (#1752)
To support reading and writing of the ServiceProfile custom resource, we add a codegen'd Kubernetes client for this resource.

* Adding the ServiceProfile type and related boilerplate to /controller/gen/apis/serviceprofile. This boilerplate also contains directives that control how codegen works.
* A script in /hack which invokes codegen that generates Kubernetes client machinery for interacting with ServiceProfile resources. The majority of the generated code lives in /controller/gen/client.
* The above-mentioned generated code.

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-10-11 11:43:35 -07:00