Commit Graph
523 Commits
Author SHA1 Message Date
Yael Jay PerezandHugo Shaka 54951cfc26 Allow for resource limits and requests for pre-deployment jobs (#23077)
* Update predeploy_job.yaml

Adding the ability to allow for requests and limits to be added to the predeploy_job like already done for deployments.

* Update predeploy_job.yaml

Add the ability for the proxy predeploy_job to have limits and requests like the deployment. Using same values from Values file.

* Update predeploy_test.yaml

Adding tests for resource limits on predeploy job for auth and proxy.

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

---------

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>
2023-03-15 17:08:07 +00:00
Vitor EnesandEdoardo Spadolini 6a1d1aedc3 Emit new AgentMetadataEvent (#22068)
* Emit new `AgentMetadataEvent`

Part of https://github.com/gravitational/cloud/issues/3550.

This commits adds a new `UpstreamInventoryAgentMetadata` that is sent
from a Teleport agent to an auth server.
Once received, it is transformed into an `AgentMetadataEvent` and sent
to PreHog.

Most `UpstreamInventoryAgentMetadata` fields are intentionally kept as
empty in this PR. Follow up PRs will be opened with the mechanisms
required to fill them (as described in #21337).

* server_id -> host_id

* compute OS and host architecture

* Compute OS version and container runtime

* Close stream if agent receives an agent metadata message

* cmd -> exec ; file -> read

* implement fetchOSVersion for linux

* Remove unused import

* Add note about `agentMetadataCh`

* Allow commands with args

* Remove parseFun abstraction

* fetch glibc version

* fetch container orchestrator

* Fix lint

* Fix TODO

* Add note about glibc version

* cmd -> command

* fetch cloud environment

* fetch install methods

* GLibCVersion -> GlibcVersion

* Use `http.NewRequestWithContext`

* Add missing comment

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* GLibCVersion -> GlibcVersion

* Fix lint

* Fix helm unit tests

* Add missing comments

* 5 second timeout on http requests

* Spawn gorountine that fetches metadata on each new stream

* Use `defaults.HTTPClient()`

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Add missing import

* Handle error

* Revert "Spawn gorountine that fetches metadata on each new stream"

This reverts commit fe4f2790be.

* Send agent metadata to auth server once per stream

* Improve note about agentMetadataDone

* Don't process command output & file content on the agent

Since agents cannot be trusted, regex validation and sanitization should
happen in PreHog anyways. So this commit removes such logic in favor of
moving it to PreHog.

* Fix lint

* Trim space

* Move handling of `AgentMetadataEvent` to `handleControlStream`

* Use cached hello message

* Move metadata files to lib/inventory/metadata

* make sending of agent metadata more self contained

* Minimize diff

* Send all system roles to PreHog

* Remove unused import

* Add parsing of command output / file content back

* Usage reporter refactor

* Usage reporter refactor

* Add missing handling of inventory agent metadata msg

* Fix ICS usage reporter

* Improve comments

* Add cached `metadata.Get*` methods

* Use systemctl status instead of is-active

* Add `Metadata` struct

* return pointer in `FetchMetadata`

* Pass context to `GetMetadata`

* metadataFetchConfig -> fetchConfig

* GetMetadata -> Get

* Add note about `Get` result

* Ensure install methods are non-nil

* Exit `metadata.Get` if context is closed

* Replace sync.Once with atomic.Bool.Swap

* Initialize channel

* Fix lint

* Fix lint

* Make `metadata.Get` return an error instead of bool

* Allow multiple true/false values for env vars

* Use `strings.Cut`

* Use /etc/os-release ID instead of NAME

* Improve `autoEmitMetadata`

* Use `gnu_get_libc_version`

* Ubuntu -> ubuntu

* Use GOARCH

* gofmt

* Move import C up

* Variables may include quotes

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Default values for ID and VERSION_ID

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Blank lines are permitted

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Anonymize host id

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2023-03-10 12:45:29 +00:00
Steven MartinandAlex Fornuto 5e646a90b0 AWS Terraform doc updates (#22559)
* Describe node instance usage in AWS Terraform

* Include link to AWS Terraform Guide

* minor wording update

* phrasing update

Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>

* phrasing update

Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>

* Update language

* Update AWS language

---------

Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>
2023-03-08 16:50:11 +00:00
Roman Tkachenko 06c40020f7 [auto] Update AMI IDs for 12.1.0 (#22718) 2023-03-07 18:35:41 +00:00
Steven Martin d281fd7c8e Examples spell fixes and discord example fix (#22606) 2023-03-03 22:45:08 +00:00
dependabot[bot] 42fd2e1911 Bump github.com/russellhaering/gosaml2 in /examples/desktop-registration (#22592)
Bumps [github.com/russellhaering/gosaml2](https://github.com/russellhaering/gosaml2) from 0.8.1 to 0.9.0.
- [Release notes](https://github.com/russellhaering/gosaml2/releases)
- [Commits](https://github.com/russellhaering/gosaml2/compare/v0.8.1...v0.9.0)

---
updated-dependencies:
- dependency-name: github.com/russellhaering/gosaml2
  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-03 16:48:12 +00:00
dependabot[bot] 0a2301b4e6 Bump golang.org/x/net in /examples/workflows (#22364)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220127200216-cd36cc0744dd 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-02-28 19:27:37 +00:00
dependabot[bot] 8cddba3c5d Bump golang.org/x/net in /examples/go-client (#22355)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220127200216-cd36cc0744dd 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-02-28 17:53:16 +00:00
Anthony SomersetandHugo Shaka d6f23feb49 fixes #21970 - remove broken config validation check in scratch mode (#22124)
* fixes #21970 - move from required to a fail check for scratch mode

* fixing typo double proxy reference

* Remove auth predeploy checks

* Remove proxy predeploy checks

---------

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>
2023-02-28 17:10:01 +00:00
dependabot[bot] 787a2af271 Bump golang.org/x/crypto in /examples/go-client (#22357)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220126234351-aa10faf2a1f8 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 14:25:50 +00:00
dependabot[bot] 1b16bae25a Bump golang.org/x/crypto in /examples/workflows (#22361)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220126234351-aa10faf2a1f8 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 14:14:48 +00:00
Steven Martin e8b4218d24 Machine ID readme example script fix (#22385)
Fix script to run
2023-02-28 12:23:46 +00:00
dependabot[bot] 17ecc61b42 Bump golang.org/x/text from 0.3.7 to 0.3.8 in /examples/workflows (#22164)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.7...v0.3.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 12:17:00 +00:00
dependabot[bot] a147d66442 Bump golang.org/x/text from 0.3.7 to 0.3.8 in /examples/go-client (#22165)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.7...v0.3.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 10:55:36 +00:00
Roman Tkachenko ae5d010427 [auto] Update AMI IDs for 12.0.4 (#22374) 2023-02-27 22:19:33 +00:00
Zac Bergquist 470fba3c8d Fix link to upstart (#22279)
The existing Wikipedia link was pointing to the disambiguation page

Closes #9797
2023-02-27 15:23:13 +00:00
Marco André Dinis 8436ea949b Discover: install ent image when cluster is enterprise (#21971)
Update the helm chart for kube-agent.
The image swap logic was already there.

Update the UI to include `enterprise: <isEnterprise>` when installing
the kube-agent.
2023-02-21 19:06:01 +00:00
Peter Nduati 9089e56c66 Extend security context to proxy init container wait-auth-update. (#21969)
* Extend security context to proxy InitContainer.

* Set securityContext for initContainers
2023-02-18 02:08:52 +00:00
b161c1d520 Clarifications in Okta SSO doc (#21777)
Clarify the usage of the `attributes_to_roles` parameter and reorder some
mapping keys for clarity in the example SAML connector resource.

Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>
Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>
2023-02-17 21:36:14 +00:00
Hugo Shaka 14b336d92a helm: fix proxy and auth config referring to the same subdict (#21760) 2023-02-13 21:02:27 +00:00
Roman Tkachenko f98ae57024 [auto] Update AMI IDs for 12.0.2 (#21743) 2023-02-13 19:17:09 +00:00
Tiago Silva 46f1166b86 Reuse auth token when upgrading an Helm chart without token (#20763)
* Reuse auth token when upgrading an Helm chart without token

When upgrading an Helm chat and not providing the auth token because it
was previously set, Helm deleted the secret and Statefulset pods become
stuck because the secret does not exist.

This PR reads the secret value from the previous upgrade/install and
reuses it during the upgrade.

Fixes #20761

* remove secret lookup
2023-02-11 00:13:39 +00:00
dependabot[bot] 0dba5c51a8 Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#21515)
Bumps [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.38.0 to 0.39.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.38.0...zpages/v0.39.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-09 15:17:19 +00:00
Hugo ShakaandGus Luxton cddd09960c helm: allow to set security contexts in teleport-kube-agent (#21076)
* helm: allow to set `initSecurityContext` in `teleport-kube-agent`

* Apply suggestions from code review

Co-authored-by: Gus Luxton <gus@goteleport.com>

* fixup! helm: allow to set `initSecurityContext` in `teleport-kube-agent`

---------

Co-authored-by: Gus Luxton <gus@goteleport.com>
2023-02-08 22:28:00 +00:00
Roman Tkachenko 7b96a36504 [auto] Update AMI IDs for 12.0.1 (#21498)
* [auto] Update AMI IDs for 12.0.1

* Delete Makefile-E

* Fix
2023-02-08 22:16:58 +00:00
Zac Bergquist bf3078e970 add example for registering desktops via API (#21154) 2023-02-08 18:08:32 +00:00
Hugo Shaka 03708a8011 helm: disable PSPs on 1.23 and document PSA usage (#21258)
* helm: disbale PSPs on 1.23 and document PSA usage

In 1.25 Kubernetes removes PSP support, this has 2 consequences:
- Helm will break after upgrading if PSPs are deployed
- We cannot set security policies anymore

This commit documents those two behaviours and makes the chart disable
PSPs on 1.23 and higher to ensure a smooth upgrade path.

* helm: Remove stale 'migrate from legacy charts' guide
2023-02-06 15:39:01 +00:00
Hugo Shaka 2b3b9f7bf8 docs: Document teleport-cluster v12 Helm chart (#19881) 2023-02-02 15:37:08 +00:00
Hugo Shaka d3e886ba1d helm: Fix proxy's ProvisionToken on etcd backend (#21034)
Fixes #20960

etcd had a previously unknown TTL limitation (TTL is stored as
nanoseconds in a signed int64, max TTL is ~= 29 years). Creating
very long-lived resources with expiry higher than the max TTL is not
supported and the process crashes on startup as it cannot apply the
token.
2023-01-31 21:14:12 +00:00
Gus Luxton 3ba20b4a2d helm: Rename port from k8s -> kube for consistency between charts (#21017) 2023-01-31 20:41:35 +00:00
Zac Bergquist 9e3114adeb [auto] Update AMI IDs for 11.3.1 (#20934) 2023-01-31 00:29:26 +00:00
Gus Luxton a6747768b2 helm: Expose ports on containers (#20485)
* helm: Expose ports on containers

Some Kubernetes tooling expects to see the ports that a container exposes registered on the individual containers themselves as well as the underlying Service. This change makes it a little easier for users to deploy the teleport-cluster chart behind their own load balancers or using a ClusterIP, by being explicit about exactly which ports are expected to be routed to each container.

* Expose tls port 3080

* Expose port 3080 before others

* Rename https -> tls

* Add 3021 for proxy peering when enterprise is true
2023-01-30 17:23:43 +00:00
Hugo Shaka 210e59c366 helm: fix operator invalid mounts with TLS secret (#20641)
Fixes an issue where the operator sidecar tries to mount the public TLS certificates but the volume is not declared.

```
$ helm install -n teleport teleport-repro /home/shaka/work/teleport/examples/chart/teleport-cluster --set teleportVersionOverride=12.0.0-alpha.1 --set clusterName=teleport.example.com --set tls.existingSecretName=my-tls-secret --set tls.existingCASecretName=my-root-ca --set operator.enabled=true
# [...]
Error: INSTALLATION FAILED: Deployment.apps "teleport-repro-auth" is invalid: spec.template.spec.containers[1].volumeMounts[0].name: Not found: "teleport-tls"
```

The operator does not need those certs to work.
2023-01-25 16:11:31 +00:00
Hugo Shaka b23dcd680a helm: default 2fa to on instead of otp (#20631)
This change adds support for FIDO2/webauthn/hardware tokens by default.
OTP 2fa fill remains functional. This is a major change and should be
part of a major release, even if this should be seamless for most users.

Warning: `webauthn.rp_id` should not change in the cluster life, else
2fa tokens will have to be re-registered.

Users accessing the cluster under a different name than `clusterName`
will have to set rp_id
(`auth.teleportConfig.auth_service.authentication.webauthn.rp_id`) to be
able to register second factors. As we strongly encourage users to have
a resolvable `clusterName` and `publicAddr` support got added recently,
this seems an acceptable edge case.
2023-01-25 13:10:25 +00:00
Hugo Shaka 9262f95665 helm: add resources to load-test the Helm chart (#19754) 2023-01-24 15:45:44 +00:00
Hugo Shaka 4aaac53d25 helm: fix potential deadlock during proxy install (#20488) 2023-01-20 18:00:41 +00:00
Roman TkachenkoandSteven Martin ae386a5b23 Update AMI IDs for 11.2.2 (#20466)
Co-authored-by: Steven Martin <steven@goteleport.com>
2023-01-20 09:43:48 +01:00
Steven Martin ca4e6b1079 Remove no longer maintained AWS Cloudformation example (#20417) 2023-01-20 00:15:40 +00:00
Roman Tkachenko bf4ad5db62 Update version to 13.0.0-dev (#20372) 2023-01-18 19:01:11 -05:00
Hugo Shaka fb14caf70c helm: add wait initContainer and preStop hooks (#20106)
Part of [RFD-096](https://github.com/gravitational/teleport/pull/18274): managing the major upgrades safely

This commit's main purpose is to block proxies running a new Teleport major version from connecting to auth pods running an old Teleport version.

This commit does 3 things:
- adding initContainers and preStop hooks to the `teleport-cluster` Helm chart (initContainers were designed in RFD 096, preStop was a nice additoin coming from [the wait PR](https://github.com/gravitational/teleport/pull/19277))
- fixing a bug in the `wait` command (the DNS error was not properly unwrapped and not recognized as a DNS error)
- fixing missing override support on some auth Deployment values. As a rule of thumb for future review, we should not use .Values directly and prefer using $auth and $proxy
2023-01-13 16:50:00 +00:00
Yann Toqué deb332709f feat(teleport-cluster chart): Add nodeSelector field
see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
Levering this field allows to place pod associated with the deployment to be on the specified node

Signed-off-by: Yann Toqué <toqueyann@gmail.com>
2023-01-12 19:44:06 -05:00
Tiago Silva 3a5c1e2639 Adds a post-delete hook to delete the kube-agent state secrets (#20043)
This PR adds a `post-delete` hook that cleans the state secret that each Pod creates when it receives the identity from the Teleport Auth Server.

Fixes #20035
Fixes #18854
2023-01-12 22:27:30 +00:00
Hugo Shaka 1d43b0f76d helm: add proxy config tests 2023-01-12 16:44:22 -05:00
Hugo Shaka 59db56c278 helm: reload proxy certs automatically 2023-01-12 16:44:22 -05:00
Hugo Shaka 46e949a2f6 helm: support passing raw config in teleport-kube-agent (#20129)
This commit implements arbitrary configuration passing to Teleport, like what was done for the `teleport-cluster` in https://github.com/gravitational/teleport/pull/18857. This allows users to deploy services or set fields the chart does not support.

The huge snapshot diffs are caused by order changes in the config (the YAML export orders keys alphabetically). I validated that the old and new snapshots were strictly equivalent with the following python snippet:

```python
import yaml
import pathlib
import deepdiff

old = yaml.safe_load(Path("./config-snapshot.old").open())
new = yaml.safe_load(Path("./config-snapshot.new").open())

old_content = { k: yaml.safe_load(yaml.safe_load(v[1])["data"]["teleport.yaml"]) for (k,v) in old.items() }
new_content = { k: yaml.safe_load(yaml.safe_load(v[1])["data"]["teleport.yaml"]) for (k,v) in new.items() }

diff = deepdiff.DeepDiff(old_content, new_content)
print(diff)
```
2023-01-12 21:32:03 +00:00
Zac Bergquist d608c5e132 [auto] Update AMI IDs for 11.2.1 (#20118) 2023-01-12 20:35:07 +00:00
Hugo Shaka ab51a9b5ea helm: support dnsConfig in teleport-kube-agent chart (#20096)
Adds support for `dnsConfig` and `dnsPolicy` configuration in the `teleport-kube-agent` chart.
2023-01-11 19:57:20 +00:00
Hugo Shaka 4ca4b54075 Deploy split proxy/auth with helm chart (#18857)
This commit refactors the `teleport-cluster` Helm chart to deploy separately proxy and auth pods.
It allows users to pass raw teleport configuration to the deployed Teleport nodes.
Finally, it removes the `custom` chart mode as the mode was broken by the split. A new `scratch` mode has been introduced.

See [the corresponding RFD](https://github.com/gravitational/teleport/pull/18274) describing the design.
2023-01-11 17:50:35 +00:00
Zac Bergquist f67da97c0b [auto] Update AMI IDs for 11.2.0 (#19972) 2023-01-09 15:53:22 +00:00
Tiago Silva 40861809a6 Add RoleV6 resource type (#19324)
This PR includes a new Role resource version that is compatible with V5 spec.

The new resource introduces the `kubernetes_resources` definition that allows operators to limit the Kubernetes resources that each member can access. The `kubernetes_resources` entries must follow the following format: `{"kind":"<kind>", "namespace":"<namespace>","name":"<pod>"}`. Currently, it only supports objects of `kind` `pod`. Valid examples `<namespace>/<name>:
- `*/*`: matches all pods in all namespaces.
- `default/*`: matches all pods in the `default` namespace.
- `*/nginx-*`: matches every pod prefixed with `nginx-` in every namespace.

For older resource versions - V5, V4, V3 - `kubernetes_resources` is automatically populated with `{"kind":"pod","namespace":"*","name":"*"}` to keep compatibility. For the newest version, it's mandatory to define its value otherwise access to pods will be denied.

Part of #18434
2023-01-05 09:58:12 +00:00