Commit graph

65 commits

Author SHA1 Message Date
Nic Klaassen 8ed3e892ca
feat: add Login Rule CRD for k8s operator (#23415)
This PR adds a k8s Custom Resource Definition for Login Rules, which
will be used in a following PR to enable configuration of Teleport Login
Rules via kubectl.

This CRD, similar to the currently existing CRDs, is generated from the
protobuf spec. The difference is that login rules are defined in their
own package, do not use gogo syntax in the proto file, and the login
rule type does not contain an explicit "spec" field. Some workarounds in
crdgen/main.go and crdgen/schemagen.go cover over these differences to
make login rules appear like any other resource.
2023-03-24 18:13:12 +00:00
Nic Klaassen 9c2422b83d
chore: update k8s operator CRDs (#23414)
This commit updates copied and generated code under
integrations/operator.

First of all, this commit includes the result of running make manifests in
integrations/operator to update the CRDs used by the k8s operator. These
are generated from the .proto files in the API package and are only
updated when someone runs make manifests.

Second, this commit updates the unit tests in
integrations/operator/crdgen. A static copy of the .proto files is kept
there so that every teleport PR updating the protobufs does not have to
break the CRD tests. Previously only types.proto and wrappers.proto were
kept there, with some hacks to make the imports work. Now that our
import structure is a little more complicated, I am copying all of the
api .proto files in. Only types explicitly listed in crdgen/main.go
actually generate CRDs. The test snapshots are necessarily updated here.
2023-03-24 16:52:01 +00:00
Hugo Shaka b64398ffe2
kube-updater: Add StatefulSet controller (#23074)
Reconciling StatefulSets requires more work than reconciling deployments
because they are really conservative about rollouts and can end up stuck
really fast. The StatefulSet controller does exactly what the Deployment
controller does except that it also tries to deleted unhealthy pods
belonging to older revisions of the StatefulSet. This approach allows to
unblock the statefulset (deleted pods will be replaced by pods using the
lastest PodSpec) while not reducing availability (if the Statefulset is
broken but some old pod is still working we don't touch it).
2023-03-24 12:49:49 +00:00
Justinas Stankevičius 6af6e7f566
Vendor slack plugin and supporting libraries (#23045)
* Vendor slack plugin and supporting libraries

* Fix up plugin integration tests (wip)

* Run GCI on vendored code

* Use newtype instead of type alias

golangci-lint currently panics on this,
"skip-files" et al don't help, as it is a linter panic, not an error

See d717045480

* Remove long-runing plugins tests from difftest

* Move access plugin tests to unit-tests-integrations
2023-03-22 19:39:07 +00:00
Hugo Shaka 5040fbda56
kube-updater: add Dockerfile & GHA pipelines (#22983) 2023-03-22 13:05:02 +00:00
Hugo Shaka cc4fdd95f9
kube-updater: implement the maintenance window trigger (#23267) 2023-03-20 22:03:14 +00:00
Hugo Shaka c1ff4d4dc9
kube-updater: HTTP version getters and maintenance triggers (#22150)
This PR adds the following version getters:
- basic HTTP (getting version from an s3 bucket)

Also the following maintenance triggers:
- basic HTTP (getting maintenance from an s3 bucket)

It also adds the following changes:
- add a common `cache` package to cache the lookups involving network
  requests to ensure we don't issue too many calls to external resources
- add a common `basichttp` package providing a test HTTP server and a
  simple HTTP client

Part of https://github.com/gravitational/teleport/issues/22450
2023-03-17 14:33:49 +00:00
Hugo Shaka 22a3a22f47
kube-updater: Add cosign image validator (#22516)
This commit implements the cosign image signature validation in the updater.

Cosign does all the heavy lifting, so this is a 90% tests / 10% actual code PR.

Testing the validator against various valid and invalid signed images
was tricky, and I had to craft custom fixtures. As fixture creation is
complex, I put all the logic into a dedicated tool generating test
layers and manifests we can reproductively test against. In retrospect,

Part of https://github.com/gravitational/teleport/issues/22450
2023-03-17 14:19:31 +00:00
Noah Stride acb255cd88
GitLab Delegated Joining (#22705)
* Add type for GitLab ProvisionToken

* Add default behaviour for domain

* Add IDTokenClaims for GitLab

* Add gitlab token source and token validator

* Thread GitLab support through auth and tbot packages

* Adjust cluster name fetching in token validator

* Initialize GitLab token validator in auth

* Improve comment on `sub`

* Working GitLab CI delegated joining

* Add additional token rule fields

* Add checking for new configuration fields

* add additional test cases for validation of gitlab config struct

* Add TestAuth_RegisterUsingToken_GitLab

* Add tests for IDTokenSource

* Fix imports

* Add tests for GitLab Token Validator

* Fix some comments that were incomplete

* Add license headers
2023-03-16 16:19:11 +00:00
Hugo Shaka b2d5ea586c
kube-updater: Implement UnhealthyWorkloadTrigger (#22737)
This trigger allows a maintenance to start if the teleport-kube-agent is
unhealthy. A workload is unhealthy if at least one if its managed pods
is unhealthy. A pod is unhealthy if it has not been ready for 10 minutes
or more.
2023-03-16 02:09:26 +00:00
Zac Bergquist 2ae9d770fc
Refactor tctl's dependencies (#22693)
* Move configuration from lib/service to lib/service/servicecfg

The new servicecfg package will hold only configuration for services.
This will allow other packages (like tctl and tsh) to depend on
servicecfg without pulling in all of lib/service (which has a number
of platform-specific details).

This is the first step towards being able to build tctl for Windows.

* Move PAM and BPF config into servicecfg

This breaks a compile-time dependency on BPF/PAM for tctl.
2023-03-09 17:48:36 +00:00
dependabot[bot] c0fbd62698
Bump golang.org/x/net in /integrations/kube-agent-updater (#22673)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.1-0.20221206200815-1e63c2f08a10 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-07 18:17:44 +00:00
Hugo Shaka 0d6f7a422a
Fix flaky test detetion for updater (#22690)
* Fix flaky test detetion for updater

* fixup! Fix flaky test detetion for updater
2023-03-07 04:49:01 +00:00
Hugo Shaka 3a9c96d37a
kube-updater: initial commit (#22067)
This PR implements the core of the kube-agent-updater, which is part of
https://github.com/gravitational/teleport/issues/21516#issue-1576935859

In order to have a fully working updater we still need to:
- implement the interfaces for version retrieval, image validation and maintenance trigger
- add statefulset support (and deal with the potential deadlocks)
- implement the CI and release pipeline (Dockerfile, README, Makefile, github action, drone)
- integrate in the `teleport-kube-agent` helm chart

Those changes will happen in subsequent PRs.
2023-03-06 18:40:28 +00:00
Hugo Shaka 9e1f53d33a
Move operator into integrations/ (#22618)
* Move operator into `integrations/`

* fixup! Move operator into `integrations/`

* fixup! fixup! Move operator into `integrations/`

* fixup! fixup! fixup! Move operator into `integrations/`

* fixup! fixup! fixup! fixup! Move operator into `integrations/`
2023-03-06 17:59:02 +00:00