Skip to content

Commit ed6f173

Browse files
dploegerDennis Ploeger
authored andcommitted
feat: Added CA-Certificates
This is a replacement of certificates, which is deprecated with this. Includes a feature to set a deprecation in the docs and adds a little not to prefer the FEATURES variable over the USE_ variable. Fixes #133
1 parent 67f81e2 commit ed6f173

10 files changed

Lines changed: 115 additions & 30 deletions

File tree

README.md

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Currently supported cloud flavours are:
1818
Following features and tools are supported:
1919
* 🐟 Fish Shell
2020
* 📷 AzCopy
21-
* 🪪 Certificates
21+
* 🪪 CA-Certificates
22+
* 🪪 Certificates ⚠️ Deprecated: Please use the ca-certificates feature instead.
2223
* 📨 cmctl
2324
* ⚙️ Direnv
2425
* ⛵️ Helm
@@ -55,6 +56,7 @@ Following features and tools are supported:
5556
* [Features](#features)
5657
* [Fish Shell](#_fish)
5758
* [AzCopy](#azcopy)
59+
* [CA-Certificates](#ca-certificates)
5860
* [Certificates](#certificates)
5961
* [cmctl](#cmctl)
6062
* [Direnv](#direnv)
@@ -369,7 +371,7 @@ Installs and configures the [Fish Shell](https://fishshell.com/) with configured
369371

370372
#### Configuration
371373

372-
* USE_fish: Enable this feature
374+
* USE_fish: Enable this feature (it's recommended to use the FEATURES variable instead)
373375
* DEBUG_fish: Debug this feature
374376

375377
### <a id="azcopy"></a> AzCopy
@@ -378,16 +380,34 @@ Installs [AzCopy](https://github.com/Azure/azure-storage-azcopy)
378380

379381
#### Configuration
380382

381-
* USE_azcopy: Enable this feature
383+
* USE_azcopy: Enable this feature (it's recommended to use the FEATURES variable instead)
382384
* DEBUG_azcopy: Debug this feature
383385

384-
### <a id="certificates"></a> Certificates
386+
### <a id="ca-certificates"></a> CA-Certificates
385387

386388
Adds specified trusted certificate authorities into the container
387389

388390
#### Configuration
389391

390-
* USE_certificates: Enable this feature
392+
* USE_ca-certificates: Enable this feature (it's recommended to use the FEATURES variable instead)
393+
* DEBUG_ca-certificates: Debug this feature
394+
* Add a volume mount to the `volumes:` section of docker compose like this:
395+
(...)
396+
volumes:
397+
- "<Path to directory with CA .pem files>:/certificates"
398+
* Volume-target /certificates: Target directory for certificates. If something different than /certificates is used, environment
399+
CERTIFICATES_PATH needs to be set to this path
400+
* Environment CERTIFICATES_PATH: The container path to the volume mount that holds trusted certificate authorities as .pem files
401+
(optional). Defaults to `/certificates`. If something different than the default is used, the volume-target needs to be adapted to
402+
the same directory
403+
404+
### <a id="certificates"></a> Certificates ⚠️ Deprecated: Please use the ca-certificates feature instead.
405+
406+
Adds specified trusted certificate authorities into the container
407+
408+
#### Configuration
409+
410+
* USE_certificates: Enable this feature (it's recommended to use the FEATURES variable instead)
391411
* DEBUG_certificates: Debug this feature
392412
* Add a volume mount to the `volumes:` section of docker compose like this:
393413
(...)
@@ -405,7 +425,7 @@ Installs the cert-manager Command Line Tool
405425

406426
#### Configuration
407427

408-
* USE_cmctl: Enable this feature
428+
* USE_cmctl: Enable this feature (it's recommended to use the FEATURES variable instead)
409429
* DEBUG_cmctl: Debug this feature
410430
* Environment CMCTL_VERSION: Version of cmctl to install (optional)
411431
Defaults to `latest`
@@ -416,7 +436,7 @@ Installs [Direnv](https://direnv.net/)
416436

417437
#### Configuration
418438

419-
* USE_direnv: Enable this feature
439+
* USE_direnv: Enable this feature (it's recommended to use the FEATURES variable instead)
420440
* DEBUG_direnv: Debug this feature
421441

422442
### <a id="helm"></a> Helm
@@ -425,7 +445,7 @@ Installs [Helm](https://helm.sh)
425445

426446
#### Configuration
427447

428-
* USE_helm: Enable this feature
448+
* USE_helm: Enable this feature (it's recommended to use the FEATURES variable instead)
429449
* DEBUG_helm: Debug this feature
430450
* Environment HELM_VERSION (required): Valid Helm version to install (e.g. 1.5.4)
431451

@@ -435,7 +455,7 @@ Installs the [JSON parser and processor jq](https://stedolan.github.io/jq/)
435455

436456
#### Configuration
437457

438-
* USE_jq: Enable this feature
458+
* USE_jq: Enable this feature (it's recommended to use the FEATURES variable instead)
439459
* DEBUG_jq: Debug this feature
440460

441461
### <a id="k9s"></a> k9s
@@ -444,7 +464,7 @@ Installs [k9s](https://k9scli.io/)
444464

445465
#### Configuration
446466

447-
* USE_k9s: Enable this feature
467+
* USE_k9s: Enable this feature (it's recommended to use the FEATURES variable instead)
448468
* DEBUG_k9s: Debug this feature
449469
* Environment K9S_VERSION (optional): Valid k9s version to install (defaults to latest)
450470

@@ -455,7 +475,7 @@ Installs [kc](https://github.com/dodevops/cloudcontrol/blob/master/feature/kc/kc
455475

456476
#### Configuration
457477

458-
* USE_kc: Enable this feature
478+
* USE_kc: Enable this feature (it's recommended to use the FEATURES variable instead)
459479
* DEBUG_kc: Debug this feature
460480

461481
### <a id="krew"></a> krew
@@ -464,7 +484,7 @@ Installs [Krew](https://krew.sigs.k8s.io/)
464484

465485
#### Configuration
466486

467-
* USE_krew: Enable this feature
487+
* USE_krew: Enable this feature (it's recommended to use the FEATURES variable instead)
468488
* DEBUG_krew: Debug this feature
469489
* Environment KREW_VERSION (optional): Valid Krew version to install (defaults to latest)
470490
* Environment KREW_PLUGINS (optional): A comma separated list of kubectl plugins to install via krew
@@ -475,7 +495,7 @@ Installs [kubectl node-shell](https://github.com/kvaps/kubectl-node-shell)
475495

476496
#### Configuration
477497

478-
* USE_kubectlnodeshell: Enable this feature
498+
* USE_kubectlnodeshell: Enable this feature (it's recommended to use the FEATURES variable instead)
479499
* DEBUG_kubectlnodeshell: Debug this feature
480500

481501
### <a id="kubernetes"></a> Kubernetes
@@ -484,7 +504,7 @@ Installs and configures [kubernetes](https://kubernetes.io/docs/reference/kubect
484504

485505
#### Configuration
486506

487-
* USE_kubernetes: Enable this feature
507+
* USE_kubernetes: Enable this feature (it's recommended to use the FEATURES variable instead)
488508
* DEBUG_kubernetes: Debug this feature
489509
* Environment KUBECTL_DEFAULT_CONTEXT: Sets the default kubectl context after initialisation and when using the
490510
k8s-relogin script
@@ -533,7 +553,7 @@ Installs additional packages into the container
533553

534554
#### Configuration
535555

536-
* USE_packages: Enable this feature
556+
* USE_packages: Enable this feature (it's recommended to use the FEATURES variable instead)
537557
* DEBUG_packages: Debug this feature
538558
* Environment PACKAGES: A whitespace separated list of packages to install. The packages will be installed with the flavour's default package manager.
539559

@@ -543,7 +563,7 @@ Installs [Packer](https://packer.io)
543563

544564
#### Configuration
545565

546-
* USE_packer: Enable this feature
566+
* USE_packer: Enable this feature (it's recommended to use the FEATURES variable instead)
547567
* DEBUG_packer: Debug this feature
548568
* Environment PACKER_VERSION (required): Valid Packer version to install (e.g. 1.5.4)
549569

@@ -553,7 +573,7 @@ Runs commands inside the shell when entering the cloud control container
553573

554574
#### Configuration
555575

556-
* USE_run: Enable this feature
576+
* USE_run: Enable this feature (it's recommended to use the FEATURES variable instead)
557577
* DEBUG_run: Debug this feature
558578
* Environment RUN_COMMANDS: Valid shell commands to run
559579

@@ -563,7 +583,7 @@ Installs [sops](https://github.com/getsops/sops)
563583

564584
#### Configuration
565585

566-
* USE_sops: Enable this feature
586+
* USE_sops: Enable this feature (it's recommended to use the FEATURES variable instead)
567587
* DEBUG_sops: Debug this feature
568588
* Environment SOPS_VERSION (required): Valid sops version (e.g. 3.8.1)
569589
* Environment specific for the key you use, see [sops documentation](https://github.com/getsops/sops?tab=readme-ov-file#22encrypting-using-age)
@@ -575,7 +595,7 @@ Installs [stern](https://github.com/stern/stern), a multi pod and container log
575595

576596
#### Configuration
577597

578-
* USE_stern: Enable this feature
598+
* USE_stern: Enable this feature (it's recommended to use the FEATURES variable instead)
579599
* DEBUG_stern: Debug this feature
580600
* Environment STERN_VERSION (required): Valid Stern version (e.g. 1.21.0)
581601

@@ -585,7 +605,7 @@ Installs the [Tanzu CLI](https://github.com/vmware-tanzu/tanzu-cli)
585605

586606
#### Configuration
587607

588-
* USE_tanzucli: Enable this feature
608+
* USE_tanzucli: Enable this feature (it's recommended to use the FEATURES variable instead)
589609
* DEBUG_tanzucli: Debug this feature
590610
* Environment TANZU_CLI_VERSION: Tanzu CLI version to install (required)
591611

@@ -595,7 +615,7 @@ Installs and configures [Terraform](https://terraform.io)
595615

596616
#### Configuration
597617

598-
* USE_terraform: Enable this feature
618+
* USE_terraform: Enable this feature (it's recommended to use the FEATURES variable instead)
599619
* DEBUG_terraform: Debug this feature
600620
* Add a volume mount to the `volumes:` section of docker compose like this:
601621
(...)
@@ -622,7 +642,7 @@ Installs [Terragrunt](https://github.com/gruntwork-io/terragrunt)
622642

623643
#### Configuration
624644

625-
* USE_terragrunt: Enable this feature
645+
* USE_terragrunt: Enable this feature (it's recommended to use the FEATURES variable instead)
626646
* DEBUG_terragrunt: Debug this feature
627647
* Environment TERRAGRUNT_VERSION (required): Valid version of terragrunt to install
628648

@@ -632,7 +652,7 @@ Configures the container's timezone
632652

633653
#### Configuration
634654

635-
* USE_timezone: Enable this feature
655+
* USE_timezone: Enable this feature (it's recommended to use the FEATURES variable instead)
636656
* DEBUG_timezone: Debug this feature
637657
* Environment TZ: The timezone to use
638658

@@ -642,7 +662,7 @@ Installs the [Velero](https://velero.io) kubernetes backup CLI
642662

643663
#### Configuration
644664

645-
* USE_velero: Enable this feature
665+
* USE_velero: Enable this feature (it's recommended to use the FEATURES variable instead)
646666
* DEBUG_velero: Debug this feature
647667
* Environment VELERO_VERSION (required): Valid velero version to install (e.g. 1.4.2)
648668

@@ -652,7 +672,7 @@ Installs [Vim](https://www.vim.org/)
652672

653673
#### Configuration
654674

655-
* USE_vim: Enable this feature
675+
* USE_vim: Enable this feature (it's recommended to use the FEATURES variable instead)
656676
* DEBUG_vim: Debug this feature
657677

658678
### <a id="yq"></a> YQ
@@ -661,7 +681,7 @@ Installs the [YAML parser and processor yq](https://github.com/mikefarah/yq)
661681

662682
#### Configuration
663683

664-
* USE_yq: Enable this feature
684+
* USE_yq: Enable this feature (it's recommended to use the FEATURES variable instead)
665685
* DEBUG_yq: Debug this feature
666686
* Environment YQ_VERSION (required): Valid YQ version to install (e.g. 4.5.0)
667687

@@ -847,3 +867,5 @@ flowchart TD
847867
click F "https://github.com/dodevops/cloudcontrol/blob/develop/.github/workflows/test.yml" "Test workflow"
848868
click H "https://github.com/dodevops/cloudcontrol/blob/develop/.github/workflows/release.yml" "Release workflow"
849869
```mermaid
870+
ase workflow"
871+
```mermaid

README.md.gotmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Currently supported cloud flavours are:
1818
Following features and tools are supported:
1919

2020
{{- range .Features}}
21-
* {{ if .Icon }}{{.Icon}}{{ end }} {{ .Title -}}
21+
* {{ if .Icon }}{{.Icon}}{{ end }} {{ .Title -}}{{- if .Deprecation }} ⚠️ Deprecated: {{ .Deprecation }}{{- end -}}
2222
{{ end }}
2323

2424
## Table of contents
@@ -268,13 +268,13 @@ environment variable in the docker-compose file. Then you can debug with the run
268268
## Features
269269

270270
{{- range $name, $feature := .Features }}
271-
### <a id="{{ $name }}"></a> {{ $feature.Title }}
271+
### <a id="{{ $name }}"></a> {{ $feature.Title }}{{- if $feature.Deprecation }} ⚠️ Deprecated: {{ $feature.Deprecation }}{{- end }}
272272

273273
{{ $feature.Description }}
274274

275275
#### Configuration
276276

277-
* USE_{{ trimPrefix "_" $name }}: Enable this feature
277+
* USE_{{ trimPrefix "_" $name }}: Enable this feature (it's recommended to use the FEATURES variable instead)
278278
* DEBUG_{{ trimPrefix "_" $name }}: Debug this feature
279279
{{- range $feature.Configuration }}
280280
* {{ indent 2 . | trim }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
icon: "🪪"
2+
title: "CA-Certificates"
3+
description: "Adds specified trusted certificate authorities into the container"
4+
configuration:
5+
- |
6+
Add a volume mount to the `volumes:` section of docker compose like this:
7+
(...)
8+
volumes:
9+
- "<Path to directory with CA .pem files>:/certificates"
10+
- |
11+
Volume-target /certificates: Target directory for certificates. If something different than /certificates is used, environment
12+
CERTIFICATES_PATH needs to be set to this path
13+
- |
14+
Environment CERTIFICATES_PATH: The container path to the volume mount that holds trusted certificate authorities as .pem files
15+
(optional). Defaults to `/certificates`. If something different than the default is used, the volume-target needs to be adapted to
16+
the same directory

feature/ca-certificates/goss/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CERTIFICATES_PATH=/goss-sup
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
file:
2+
{{if eq .Env.FLAVOUR "aws" }}
3+
/etc/pki/ca-trust/source/anchors/testcert.pem:
4+
{{else if ne .Env.FLAVOUR "aws" }}
5+
/usr/local/share/ca-certificates/testcert.pem:
6+
{{end}}
7+
exists: true
8+
{{if eq .Env.FLAVOUR "aws" }}
9+
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:
10+
exists: true
11+
contains:
12+
- Bogus Broccoli X2
13+
{{else if ne .Env.FLAVOUR "aws" }}
14+
/etc/ssl/certs/ca-certificates.crt:
15+
exists: true
16+
contains:
17+
- uc2j3cICeXo1cOybQ1iWAjEA3Ooawl8eQyR4wrjCofUE8h44p0j7Yl/kBlJZT8+9
18+
{{end}}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIICTjCCAdSgAwIBAgIRAIPgc3k5LlLVLtUUvs4K/QcwCgYIKoZIzj0EAwMwaDEL
3+
MAkGA1UEBhMCVVMxMzAxBgNVBAoTKihTVEFHSU5HKSBJbnRlcm5ldCBTZWN1cml0
4+
eSBSZXNlYXJjaCBHcm91cDEkMCIGA1UEAxMbKFNUQUdJTkcpIEJvZ3VzIEJyb2Nj
5+
b2xpIFgyMB4XDTIwMDkwNDAwMDAwMFoXDTQwMDkxNzE2MDAwMFowaDELMAkGA1UE
6+
BhMCVVMxMzAxBgNVBAoTKihTVEFHSU5HKSBJbnRlcm5ldCBTZWN1cml0eSBSZXNl
7+
YXJjaCBHcm91cDEkMCIGA1UEAxMbKFNUQUdJTkcpIEJvZ3VzIEJyb2Njb2xpIFgy
8+
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEOvS+w1kCzAxYOJbA06Aw0HFP2tLBLKPo
9+
FQqR9AMskl1nC2975eQqycR+ACvYelA8rfwFXObMHYXJ23XLB+dAjPJVOJ2OcsjT
10+
VqO4dcDWu+rQ2VILdnJRYypnV1MMThVxo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
11+
VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU3tGjWWQOwZo2o0busBB2766XlWYwCgYI
12+
KoZIzj0EAwMDaAAwZQIwRcp4ZKBsq9XkUuN8wfX+GEbY1N5nmCRc8e80kUkuAefo
13+
uc2j3cICeXo1cOybQ1iWAjEA3Ooawl8eQyR4wrjCofUE8h44p0j7Yl/kBlJZT8+9
14+
vbtH7QiVzeKCOTQPINyRql6P
15+
-----END CERTIFICATE-----

feature/ca-certificates/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
. /feature-installer-utils.sh
2+
3+
if [[ "${FLAVOUR}" =~ (azure|simple|tanzu|gcloud) ]]
4+
then
5+
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /usr/local/share/ca-certificates/
6+
execHandle "Updating certificate bundle" sudo su - -c "cat /usr/local/share/ca-certificates/*.pem >> /etc/ssl/certs/ca-certificates.crt"
7+
elif [[ "${FLAVOUR}" == "aws" ]]
8+
then
9+
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /etc/pki/ca-trust/source/anchors/
10+
execHandle "Updating certificate bundle" sudo /usr/bin/update-ca-trust
11+
fi

feature/certificates/feature.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ configuration:
1313
- |
1414
Environment CERTIFICATES_PATH: The container path to the volume mount that holds trusted certificate authorities as .pem files
1515
(optional). Defaults to `/certificates`. If something different than the default is used, the volume-target needs to be adapted to
16-
the same directory
16+
the same directory
17+
deprecation: "Please use the ca-certificates feature instead."

internal/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ type YamlDescriptor struct {
1111
Configuration []string
1212
Test TestConfiguration
1313
Platforms []string
14+
Deprecation string
1415
}

tests/Test_tanzu

12.1 MB
Binary file not shown.

0 commit comments

Comments
 (0)