Posts

Azure vnet allocating and planning subnets

Image
 When setting up Azure VNET it is important to plan your address spaces especially when it is intended for use with AKS - as these ips cannot overlap. When creating VNET, you are required to configure your address spaces before you can use it.  Altho you can come back and change it but then might take some additional effort. This is how you can change your VNET address spaces. After you created these, then you will start to create subnets which in terms harness these configurations. So it important to have some planning in place.

AKS configuring pod-cidr with portal

Image
We can configure pod-cidr on the portal using the following UI.

windows wsl resetting password for root or user

From the powershell of the application, run the following command  wsl --user root and then to reset your password simple run  passwd

kind create cluster - the node with the same name already exist

Image
If you're having this error, the way to resolve it is to delete the container. In my case, i am running docker so I had to remove the running container.    

kubectl - setting the API server endpoint

We can use the following to configure server endpoint ip kubectl config set-cluster kind-cluster1 --server=https://172.19.0.2:6443

c# and react implementation of kata08 code challenge

My sample implementation of the kata code challenge can be found here:- https://github.com/mitzenjeremywoo/mitzenjeremywoo-kata08-test--challenge

terraform azurerm - registering azure provider

To register a specific provider, we typically would do the following.   az provider register --namespace Microsoft.PolicyInsights You can do the same thing by running the following configuring the following in terraform:  resource "azurerm_resource_provider_registration" "policyregistration" {   name = "Microsoft.PolicyInsights" }

azure devops c# dotnet core sdk - creating build definition / pipeline for your repository.

Creating azure devops build definition can be challenging due to the large options that is available. Below is the most basic code sample that you can use the successfully create a build definition (essentially a pipeline) for your repository.  Please note: You might get into other issues like invalid service connection, etc. Really depends on what you specify in the build definitions.  Suggest that you make incremental changes. Here is the code base.  var _azureGitClient = connection.GetClient < BuildHttpClient > (); var buildDefinition = new BuildDefinition {     Name = "My New Build Definition" ,     Project = new TeamProjectReference { Name = projectName , Id = repo.ProjectReference.Id } ,       Repository = new BuildRepository     {         Type = RepositoryTypes.TfsGit ,         Name = "name-of-your-repository" ,         Url = new Uri($ "https...

azcopy error: get cached token failed to ensure token fresh

Looking into an azcopy issue complaining about this error.  " failed to perform copy command due to error: get cached token failed to ensure token fresh, please log in with azcopy's login command again, Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token" . I am sure my service principal is working fine and has the proper secrets and expiry configured.  And was able to resolve this by using azcopy binary version 10.27.1 (the latest at this time).  No luck with version 10.25.0 

sqlpackage vs sqlcmd

sqlpackage is a tool that allows us to deploy sqlproj/dacpac/bacpac files across different platform such as windows, linux. It uses a slightly different sqlproj format - removing some of the dependencies sqlproj has on msbuild.  Unfortunately it cannot be used for ispac / ssis packages.  I was abit confused when the docs mentioned  SqlAzureDacpacDeployment  - giving me the impression that sqlpackages is readily available as an azure devops task.  Upon some googling - this tasks uses sqlcmd.  The differences between sqlpackage and sqlcmd are highlighted below:-  Key Differences Feature SqlPackage sqlcmd Primary Purpose Database schema and data management (DACPAC/BACPAC). SQL script execution and database interaction. Typical Use Cases - Deploying database schemas. - Extracting or exporting schemas and data. - Publishing database updates. - Running ad hoc T-SQL commands. - Automating scripts for database tasks. - Querying or modifying data directly. Inpu...

quick code snippet to setup automoq

 This is a quick start example of setup mock for Automoq.  var mocker = new AutoMocker (); var creditCardValidator = mocker . CreateInstance < CreditCardValidator >(); mocker . GetMock < ICreditCardValidator >(). Setup ( x => x . Validate ( "fakecardnunber" , new DateTime ( 2024 , 12 , 12 ))). Returns ( new CreditCardValidationResult ( "" , true )); var result = creditCardValidator . Validate ( "fakecardnunber" , new DateTime ( 2024 , 12 , 12 )); Assert . IsTrue ( result . Valid );                    

istio envoyfilter lua to do some logging

Sometimes for doing troubleshooting, we need to create an envoyfilter to logs certain responses or headers related data. To do so we can use the following example:-  apiVersion : networking.istio.io/v1alpha3 kind : EnvoyFilter metadata :   name : log-headers   namespace : default spec :   workloadSelector :     labels :       app : httpbin   configPatches :   - applyTo : HTTP_FILTER     match :       context : SIDECAR_INBOUND     patch :       operation : INSERT_BEFORE       value :         name : envoy.filters.http.lua         typed_config :           '@type' : type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua           inlineCode : |             function envoy_on_request(request_handle)               req...

react app - creating a container and renders outputs from a rest API call

 This is a simple component that serves as a container to load data and renders its output using another component called ProductItem. Here is an example of the container code. It uses react useEffect to call an API endpoint.  import { ProductItem } from "./ProductItem" ; import { useEffect , useState } from "react" ; import { Item } from "./Item" ; import { ProductFetchEndpoint } from "../AppConstant" ; import { CalculateTotal } from "./CalculateTotal" ; const ProductContainer = () => {   const [ items , setStoreItems ] = useState < Item []>([]);   const [ loading , setLoading ] = useState < boolean >( true );   const [ error , setError ] = useState < string | null >( null );   useEffect (() => {     const fetchProducts = async () => {       try {         setLoading ( true );         setError ( null );         co...

istioctl experimental describe pod

Image
 This is a pretty handy tool if anyone were to try out this command here - which shows quite alof of information such as pod, services, destination rule, any peer authentication and virtual services. By running this command, you get an idea of how your services are interconnected and makes life easy to do troubleshooting to some extend. :)