Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue: issues/195 and issues/200 #225

Merged
merged 35 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7eb57f1
init
sub2zero Oct 6, 2022
f29cd01
add nginx
sub2zero Oct 6, 2022
95d069f
linter fix "deep_check" is not expected here
sub2zero Oct 6, 2022
8526b09
еуые мукышщт гзвфеу
sub2zero Oct 6, 2022
7ed3063
add example
sub2zero Oct 6, 2022
8cc7145
deploy external-secrets module
sub2zero Oct 7, 2022
0a22502
remove hardcoded
sub2zero Oct 11, 2022
3bf8cc6
chnage repo url
sub2zero Oct 11, 2022
ad7fd8b
revert back
sub2zero Oct 11, 2022
97f232c
try 0.5.9 version of exteranl _secrerts
sub2zero Oct 11, 2022
4836bd9
change repo
sub2zero Oct 11, 2022
868c687
fix for ${chart_repo}
sub2zero Oct 11, 2022
aa97d7d
change repo
sub2zero Oct 11, 2022
6e125fa
ver 0.6.0
sub2zero Oct 11, 2022
2a21f66
change podSecurityContext
sub2zero Oct 11, 2022
350e577
remove external secrets
sub2zero Oct 12, 2022
5c7acc6
sample test
sub2zero Oct 13, 2022
1525f29
some clean up
sub2zero Oct 17, 2022
6790da1
remove tested
sub2zero Oct 17, 2022
132fff8
add test for infra
sub2zero Oct 17, 2022
b46cfee
срфтпу тфьу ащк еуыеашду
sub2zero Oct 17, 2022
80bcb27
rework for els module insted sak-k8s
sub2zero Oct 18, 2022
2f37e1f
update eks version
sub2zero Oct 18, 2022
a3ef3a2
test
sub2zero Oct 19, 2022
e17db24
remove argo chart
sub2zero Oct 19, 2022
dfbf349
revert argocd chart
sub2zero Oct 19, 2022
08d7299
remove hello
sub2zero Oct 19, 2022
c3ba9e9
revert it
sub2zero Oct 19, 2022
dbb4aca
add some Readme
sub2zero Oct 19, 2022
130be0d
fix linter
sub2zero Oct 19, 2022
14e87a5
fix: update broken tflint workflow
dmiroshnik Oct 19, 2022
063ea79
fix for review
sub2zero Oct 20, 2022
afedd2b
update reamde
sub2zero Oct 20, 2022
e9e492d
Fix some review mentions
sub2zero Oct 20, 2022
85ce3e4
remove personal cluster_name
sub2zero Oct 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 0 additions & 211 deletions .github/workflows/reviewdog.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: tflint
on:
pull_request:
paths:
- '**.tf'
- '**.tfvars'
- '**.tfvars.json'
- '**.hcl'

jobs:

tflint:
name: runner / tflint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout source code

- uses: terraform-linters/setup-tflint@v2
name: Setup TFLint
with:
tflint_version: v0.41.0
github_token: ${{ secrets.github_token }}

- name: Show version
run: tflint --version

- name: Init TFLint
run: tflint --init

- name: Run TFLint
run: tflint -f compact
11 changes: 5 additions & 6 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
plugin "aws" {
enabled = true
enabled = true
deep_check = true
}

config {
module = true
deep_check = false
force = false
disabled_by_default = false
plugin "aws" {
enabled = true
version = "0.17.1"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

rule "aws_instance_invalid_type" {
Expand Down
17 changes: 17 additions & 0 deletions examples/argocd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# General
.DS_Store
.AppleDouble
.LSOverride

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
33 changes: 26 additions & 7 deletions examples/argocd/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
# About
That example demonstrates how to configure the EKS cluster with the ArgoCD application. A general idea of the usage of ArgoCD is managing all Kubernetes resources with it. ArgoCD provides us a way of implementing the GitOps methodology for Kubernetes applications.
That example demonstrates how to configure the EKS cluster with the ArgoCD application. A general idea of the usage of ArgoCD is managing all Kubernetes resources with it. ArgoCD provides us with a way of implementing the GitOps methodology for Kubernetes applications.

## Used modules
- terraform-aws-modules/vpc/aws
- terraform-aws-modules/eks/aws
- github.com/provectus/sak-argocd, curentrul does not work with k8s with 1.22, need to update helm chart
sub2zero marked this conversation as resolved.
Show resolved Hide resolved
## Implementation
First of all, you execute Terraform commands as it were for `common` example (please follow these instructions to understand how to use SAK). At this step, you will generate all required AWS resources such as EC2 instances, EKS cluster, IAM roles, etc. Also, Terraform will generate a few local files with ArgoCD applications.

The next phase is it uploading these files to your GitHub repository. Please follow ArgoProj's documentation for more detailed information about [how it works](https://argoproj.github.io/argo-cd/#how-it-works)
## How to use
That example creates a minimal EKS cluster without any additional software except ArgoCD.
You can get KubeConfig for newly created EKS cluster with following aws-cli command:
``` bash
aws eks update-kubeconfig --name <your-cluster-name> --region <your-region>
```

So for accessing it needs to establish port forwarding for Kubernetes service, you can do it by next command:
You can get KubeConfig for the newly created EKS cluster with the following aws-cli command:
So for access, it needs to establish port forwarding for Kubernetes service, you can do it by the next command:
``` bash
kubectl -n argocd port-forward svc/argocd-server 8080:80
```
Now you can open http://127.0.0.1:8080 in a browser, the password for accessing ArgoCD UI is stored in AWS System Manager Paramstore, you can retrieve it by command:
``` bash
aws --region <your-region> ssm get-parameter --with-decryption --name /<your-cluster-name>/argocd/password | jq -r '.Parameter.Value'
```

### ArgoCD
to get current password:
for the first time use init password ```kubectl get secrets argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -D```

after deploy helm chart:

```bash
kubectl get secret -n argocd argocd-secret -o json | \
jq '.data|to_entries|map({key, value:.value|@base64d})|from_entries'
```

to set a password:

```bash
kubectl patch secret -n argocd argocd-secret \
sub2zero marked this conversation as resolved.
Show resolved Hide resolved
-p '{"stringData": { "admin.password": "'$(htpasswd -bnBC 10 "" newpassword | tr -d ':\n')'"}}'
```
23 changes: 23 additions & 0 deletions examples/argocd/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
locals {
### VPC locals

zones = coalescelist(var.availability_zones, data.aws_availability_zones.available.names)
cidr = var.cidr != null ? var.cidr : "10.${var.network}.0.0/16"
private = var.cidr != null ? [for i, z in local.zones : cidrsubnet(local.cidr, var.network_delimiter, i)] : [for i, _ in local.zones : "10.${var.network}.20${i}.0/24"]
public = var.cidr != null ? [for i, z in local.zones : cidrsubnet(local.cidr, var.network_delimiter, pow(2, var.network_delimiter) - i)] : [for i, _ in local.zones : "10.${var.network}.${i}.0/24"]

#EKS module local
environment = var.environment
project = var.project
cluster_name = var.cluster_name
domain = ["${local.cluster_name}.${var.domain_name}"]
subnets = module.vpc.private_subnets

registry = "https://registry.${local.domain[0]}"

docker_config_json = jsonencode(
{
"\"registry-mirrors\"" = ["\"${local.registry}\""]
})

}
Loading