Skip to content

Instantly share code, notes, and snippets.

View mikaelkrief's full-sized avatar

Mikael mikaelkrief

View GitHub Profile
@mikaelkrief
mikaelkrief / listeHarborImage.ps1
Created October 22, 2024 10:38
Liste des images de Harbor
function Get-HarborProjectsWithRepositoriesAndExportCsv {
param (
[string]$HarborURL, # URL de votre instance Harbor (par exemple, https://harbor.mondomaine.com)
[string]$Username, # Nom d'utilisateur pour se connecter à Harbor
[string]$Password, # Mot de passe pour se connecter à Harbor
[string]$OutputFile = "HarborProjects.csv", # Chemin du fichier CSV de sortie
[int]$Page = 1, # Numéro de page (par défaut 1)
[int]$PageSize = 10, # Taille de la page (par défaut 10 projets par page)
[string]$Sort = "name", # Option de tri (par exemple, "name" ou "-name" pour tri inverse)
[string]$ProjectName = "" # Filtre par nom de projet (optionnel)
@mikaelkrief
mikaelkrief / Get-K8sPodImagesByNamespace.ps1
Last active October 21, 2024 15:59
Get all pods image by namespaces
function Get-K8sPodImagesByNamespace {
param (
[string]$KubeConfigPath = "$HOME/.kube/config", # Chemin vers le fichier kubeconfig
[string[]]$ExcludedNamespaces = @("kube-system", "kube-public", "kube-node-lease", "default") # Namespaces à exclure
)
# Vérifie si kubectl est accessible
if (-not (Get-Command kubectl -ErrorAction SilentlyContinue)) {
Write-Error "kubectl n'est pas installé ou n'est pas accessible dans le PATH."
return
@mikaelkrief
mikaelkrief / azPesterAks.ps1
Created August 12, 2024 13:40
Azure Pester
# Define the resource parameters
$resourceGroupName = "YourResourceGroupName"
$aksClusterName = "YourAKSClusterName"
$expectedLocation = "eastus" # Replace with your expected location
$expectedNodeCount = 3 # Replace with your expected node count
$expectedKubernetesVersion = "1.25.0" # Replace with your expected Kubernetes version
# Import the Az module
Import-Module Az
kind: Pod
apiVersion: v1
metadata:
name: app
namespace: myapp
spec:
containers:
- name: mypod
image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
resources:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azurefile
namespace: myapp
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile-csi
volumeName: azurefile
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: file.csi.azure.com
name: azurefile
spec:
capacity:
storage: 5Gi
accessModes:
@mikaelkrief
mikaelkrief / rg.yaml
Last active January 9, 2024 17:56
ASO Azure file Share
apiVersion: resources.azure.com/v1api20200601
kind: ResourceGroup
metadata:
name: rg-app
namespace: myapp
spec:
location: eastus
@mikaelkrief
mikaelkrief / tfinfracostdemo.tf
Created January 11, 2023 13:34
Terraform code from infracost demo
terraform {
required_version = "~> 1.0"
required_providers {
azurerm = {
version = "~> 3.35"
}
}
}
provider "azurerm" {
TERRAFORM_VERSION="0.12.20"
curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
&& curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS \
&& curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import \
&& curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig \
&& gpg --verify terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig terraform_${TERRAFORM_VERSION}_SHA256SUMS \
&& shasum -a 256 -c terraform_${TERRAFORM_VERSION}_SHA256SUMS 2>&1 | grep "${TERRAFORM_VERSION}_linux_amd64.zip:\sOK" \
&& unzip -o terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
resource "azuredevops_build_definition" "build-def1" {
name = "build-def-CI"
project_id = "${azuredevops_project.project.name}"
description = "It' definition created by Terraform"
repository {
name = "${azuredevops_project.project.name}"
type = "TfsGit"
branch = "master"
}