From ab14466683e7ebc285e43538e55c0d57ca8868eb Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 21:28:08 -0300 Subject: [PATCH 1/6] fix: controlando versionamento MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O cache do Vagrant e arquivos que podem ser compartilhados via o Virtualbox Guest Additions não devem ser versionados. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c93932d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vagrant +*.crt From fbb8f3f9b35ff0a1288946ee7254375acdb285ee Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 21:31:04 -0300 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20n=C3=A3o=20execut=C3=A1veis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vagrantfile | 0 environment.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 Vagrantfile mode change 100755 => 100644 environment.yaml diff --git a/Vagrantfile b/Vagrantfile old mode 100755 new mode 100644 diff --git a/environment.yaml b/environment.yaml old mode 100755 new mode 100644 From 7bf9241ecc6fe5a46b0646c9435f78f687208372 Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 21:33:09 -0300 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20ordem=20de=20inicializa=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Com essa nova ordem de declaração de servidores, as VM's podem ser ligadas na ordem correta com "vagrant up" e também desligadas com "vagrant halt", garantindo que a ordem de dependências entre elas seja respeitada, o que evita erros. --- environment.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/environment.yaml b/environment.yaml index 4eef084..85cbdfd 100644 --- a/environment.yaml +++ b/environment.yaml @@ -1,4 +1,12 @@ --- +- name: kube-infra + box: devopsbox/ubuntu-20.04 + hostname: kube-infra + ipaddress: 172.16.1.103 + memory: 512 + cpus: 1 + provision: provision/ansible/kube-infra.yaml + - name: kube-master box: devopsbox/ubuntu-20.04 hostname: kube-master @@ -22,11 +30,3 @@ memory: 2560 cpus: 2 provision: provision/ansible/kube-node2.yaml - -- name: kube-infra - box: devopsbox/ubuntu-20.04 - hostname: kube-infra - ipaddress: 172.16.1.103 - memory: 512 - cpus: 1 - provision: provision/ansible/kube-infra.yaml From a1d2578971909ddade355d4ec1eb3f8e441f3363 Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 21:37:36 -0300 Subject: [PATCH 4/6] refactor: melhorias nas VMs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - garante que as VM's estarão com pacotes atualizados, incluindo o kernel (requerido para o Virtualbox Guest Addtions) - garante que o Virtualbox Guest Additions será configurado: isso permite o uso de diretório compartilhado entre todas as VM's (/vagrant) e também o uso do recurso de Linked Clones do Virtualbox. --- Vagrantfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index a621081..642cd7a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -13,6 +13,14 @@ env = YAML.load_file('environment.yaml') # Limitando apenas a ultima versao estavel do Vagrant instalada Vagrant.require_version '>= 2.0.0' +SCRIPT = <<-EOF +echo 'unattended-upgrades unattended-upgrades/enable_auto_updates boolean false' | sudo debconf-set-selections +apt-get update +apt-get upgrade -y +apt-get autoremove -y +dpkg-reconfigure -f noninteractive unattended-upgrades +EOF + Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Iteracao com os servidores do ambiente env.each do |env| @@ -20,15 +28,25 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| srv.vm.box = env['box'] srv.vm.hostname = env['hostname'] srv.vm.network 'private_network', ip: env['ipaddress'] + if env['additional_interface'] == true srv.vm.network 'private_network', ip: '1.0.0.100', auto_config: false end + + srv.vbguest.auto_update = true + srv.vm.provider 'virtualbox' do |vb| vb.name = env['name'] vb.memory = env['memory'] vb.cpus = env['cpus'] + vb.linked_clone = true end + + srv.vm.provision 'shell', + inline: SCRIPT, + env: {DEBIAN_FRONTEND: 'noninteractive'} + srv.vm.provision 'ansible_local' do |ansible| ansible.playbook = env['provision'] ansible.install_mode = 'pip' From f11de989e2c6e907f86958f270b5dc86054f12bc Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 22:56:04 -0300 Subject: [PATCH 5/6] feat: RBAC do analista MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Melhoria na configuração de RBAC do usuário analista: agora a configuração é mais legível. - Também foi adicionada uma ClusterRole para permitir usuários de listar e obter informações de namespaces. Isso é especialmente útil para usar um kubens (https://github.com/ahmetb/kubectx) e evitar um monte de digitação --- aula04/rbac/analista-rbac.yaml | 110 +++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 aula04/rbac/analista-rbac.yaml diff --git a/aula04/rbac/analista-rbac.yaml b/aula04/rbac/analista-rbac.yaml new file mode 100644 index 0000000..47a82a3 --- /dev/null +++ b/aula04/rbac/analista-rbac.yaml @@ -0,0 +1,110 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: namespace-lister +rules: + - apiGroups: + - "" + resources: + - namespaces + verbs: + - list + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: namespace-lister +subjects: + - kind: User + name: analista + apiGroup: rbac.authorization.k8s.io +roleRef: + kind: ClusterRole + name: namespace-lister + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: analista + namespace: 4labs +rules: + - apiGroups: + - "" + resources: + - pods + - services + - services/proxy + - configmaps + - secrets + - replicationcontrollers + - events + - pods/portforward + - pods/exec + - pods/log + - endpoints + - persistentvolumeclaims + verbs: + - get + - list + - create + - update + - patch + - delete + - watch + - apiGroups: + - apps + resources: + - deployments + - deployments/scale + - replicasets + - daemonsets + - statefulsets + verbs: + - get + - list + - create + - update + - patch + - delete + - watch + - apiGroups: + - autoscaling + resources: + - horizontalpodautoscalers + verbs: + - get + - list + - create + - update + - patch + - delete + - watch + - apiGroups: + - batch + resources: + - jobs + - cronjobs + verbs: + - get + - list + - create + - update + - patch + - delete + - watch + - apiGroups: + - networking.k8s.io + resources: + - ingresses + - networkpolicies + verbs: + - get + - list + - create + - update + - patch + - delete + - watch From fc6b06c3979be8b0c873225c5152fc736e6aae4e Mon Sep 17 00:00:00 2001 From: Alceu Rodrigues de Freitas Junior Date: Sun, 16 Aug 2026 22:57:47 -0300 Subject: [PATCH 6/6] =?UTF-8?q?feat:=20valida=C3=A7=C3=A3o=20de=20arquivos?= =?UTF-8?q?=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Usando o programa yamllint e o GNU Make para buscar todos os arquivos e válida-los conforme uma configuração que tem como objetivo garantir uma legibilidade nos arquivos, além de buscar por erros. --- .yamllint.yaml | 12 ++++++++++++ Makefile | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 .yamllint.yaml create mode 100644 Makefile diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..14d3740 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,12 @@ +--- +extends: default + +rules: + indentation: + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + brackets: + forbid: true + line-length: + max: 120 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f06407c --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +lint-yaml: + find . -type f -name '*.yaml' | xargs yamllint