Kubernetes gitconfig mounted as directory instead of file - azure

I have some helm charts in which I would like to mount the git config globally on each container.
In this case the home directory for each container is / path. When I would like to do it manually on the container I am getting following
git config --global --add safe.directory "*" error: could not lock config file //.gitconfig: Permission denied
Now I want to map my config map to the global .gitconfig file.
set {
name = "git.sync.extraVolumeMounts[0].name"
value = "git-config"
}
set {
name = "git.sync.extraVolumeMounts[0].mountPath"
value = "/.gitconfig"
}
set {
name = "git.sync.extraVolumeMounts[0].subPath"
value = ".gitconfig"
}
With such config I am getting the .gitconfig as folder not the file
bitnami#airflow-web-7cdb6f5d6f-48mzh:/$ ls -la
total 84
drwxr-xr-x 1 root root 4096 Dec 2 12:20 .
drwxr-xr-x 1 root root 4096 Dec 2 12:20 ..
drwxrwsrwx 2 root bitnami 4096 Dec 2 12:20 .gitconfig
drwxr-xr-x 1 root root 4096 Jul 30 11:21 bin
Any idea what I am doing wrong? Is there any environment variable instead I can set?
I tried to use system config but it does not work either as some folder structure is missing.

Just for future, I was able to achieve that with the usage of the proper escaping
{
"name": "git.sync.extraVolumeMounts[0].mountPath",
"type": null,
"value": "/\\.gitconfig"
},
{
"name": "git.sync.extraVolumeMounts[0].name",
"type": null,
"value": "git-config"
},
{
"name": "git.sync.extraVolumeMounts[0].subPath",
"type": null,
"value": "gitconfig"
},
This basically, creates a .gitconfig file and not a folder.
Setup is working fine.

Related

Terraform states I am trying to initialized file in an empty directory

Terraform states I am trying to initialized file in an empty directory which is my local profile: C:\Users
c:\users\a874193\kplabs\sectiontwo.
When I run an ls command it shows the tf file in there and when I look at the .tf file within the actual \sectiontwo folder it does show a more or less empty .tf file.
I am very new to TF, so please break it down to me. Thanks
provider "aws" {
region = "us-west-2"
access_key = "---------------"
secret_key = "----------------------"
}
resource "aws_instance" "kelec2" {
ami = "ami-0d593311db5abb72b"
instance_type = "t2.micro"
}
resource "aws_eip" "elastic" {
vpc = true
}
With the above I have tried to comment out the 2 resources specified, I also replaced all of this with just this:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.37.0"
}
}
}
Result when trying to run terraform init:
PS C:\Users\a874193\kplabs\sectiontwo> terraform init
Terraform initialized in an empty directory!
with Terraform immediately by creating Terraform configuration files.
Result from ls:
PS C:\Users\a874193\kplabs\sectiontwo> ls
Directory: C:\Users\a874193\kplabs\sectiontwo
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 29/10/2022 18:04 .terraform
-a---- 29/10/2022 18:04 1152 .terraform.lock.hcl
-a---- 29/10/2022 18:43 310 attributes.tf.bak
-a---- 29/10/2022 18:44 156 terraform.tfstate
-a---- 29/10/2022 18:44 15786 terraform.tfstate.backup
PS C:\Users\a874193\kplabs\sectiontwo> ls
Directory: C:\Users\a874193\kplabs\sectiontwo
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 29/10/2022 18:04 .terraform
-a---- 29/10/2022 18:04 1152 .terraform.lock.hcl
-a---- 29/10/2022 18:43 310 attributes.tf.bak
-a---- 29/10/2022 18:44 156 terraform.tfstate
-a---- 29/10/2022 18:44 15786 terraform.tfstate.backup
EDIT:
OK, I ended up adding just the kplabs folder which then showed the sectiontwo folder within the left hand pane.
It has init and produced the correct plan resources.
I think I am getting confused with the folder structure so if anyone can make any sense of why it only works when adding the kplabs folder and not the sectiontwo within the kplabs I would appreciate it.
Thanks

Terraform use local provider/plugin

I installed Terraform v1.0.1 on linux_amd64 (Oracle Linux Srv 8.4 64bit).
I’m trying to use a local provider/plugin that I saved in the folder: /root/.terraform.d/plugins
# ll /root/.terraform.d/plugins
drwxr-xr-x. 2 root root 38 Jun 29 15:42 oldversion
-rwxr-xr-x. 1 root root 30068808 Jun 29 15:42 terraform-provider-zabbix
drwxr-xr-x. 2 root root 52 Jun 29 15:42 test_plugging
This is my vim /root/.terraformrc:
provider_installation {
filesystem_mirror {
path = "/root/.terraform.d/plugins"
}
direct {
exclude = ["registry.terraform.io/*/*"]
}
}
This is my main.tf:
terraform {
required_version = ">= 0.12.6"
}
provider "zabbix" {
username = local.provider_vars.zabbix.username
password = local.provider_vars.zabbix.password
url = local.provider_vars.zabbix.endpoint
tls_insecure = true
}
but when I run: terraform init
Initializing the backend...
Initializing provider plugins...
Finding latest version of hashicorp/zabbix...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider
hashicorp/zabbix: provider registry.terraform.io/hashicorp/zabbix was
not found in any of the search locations
/root/.terraform.d/plugins
How can fix this problem?
Thanks for the help
Marco
Assuming you have a binary
~/.terraform.d/plugins/terraform.local/local/zabbix/1.0.0/linux_amd64/terraform-provider-zabbix_v1.0.0
Configure Terraform as follows
terraform {
required_providers {
zabbix = {
source = "terraform.local/local/zabbix"
version = "1.0.0"
# Other parameters...
}
}
}
Which works as follows
terraform init
Initializing the backend...
Initializing provider plugins...
- Finding terraform.local/local/zabbix versions matching "1.0.0"...
- Installing terraform.local/local/zabbix v1.0.0...
- Installed terraform.local/local/zabbix v1.0.0 (unauthenticated)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
The solution above is absolutely correct, but needs to be clarified edit .terraformrc:
provider_installation {
filesystem_mirror {
path = "/home/user/.terraform.d/plugins"
}
direct {
exclude = ["terraform.local/*/*"]
}
}

How to determine if an SFTP file is a directory in Node.js?

The ssh2 library's SFTP readdir method gives me back all the files in the remote directory. How can I tell if any of of them are directories?
Here's some example output from the library:
{ filename:
'myfile',
longname:
'-rwxr-x--- 1 myuser mygroup 19036227 Nov 21 11:05 myfile',
attrs:
Stats {
mode: 33256,
permissions: 33256,
uid: 603,
gid: 1014,
size: 19036227,
atime: 1542859216,
mtime: 1542816340 } }
The file's mode contains bits indicating its type. You can check it like this:
const fs = require('fs');
function isDir(mode) {
return (mode & fs.constants.S_IFMT) == fs.constants.S_IFDIR;
}
isDir(myfile.attrs.mode);

Meteor less source map don't get loaded in the client

I try to get less source maps working in my project but they don't seem to get passed to the client.
> meteor --version
> Release 0.8.1.3
> lessc --version
> lessc 1.7.0 (LESS Compiler) [JavaScript]
> less .meteor/packages |grep less
> less
> ls .meteor/local/build/programs/client
> -rw-r--r-- 1 mhhf staff 342679 Jun 6 13:05 473be00fc614aeff1b93b555c76b905fcc71e56b.css
> -rw-r--r-- 1 mhhf staff 463306 Jun 6 13:05 473be00fc614aeff1b93b555c76b905fcc71e56b.css.map
> less .meteor/local/build/programs/client/program.json
> ...
> {
"path": "473be00fc614aeff1b93b555c76b905fcc71e56b.css",
"where": "client",
"type": "css",
"cacheable": true,
"url": "/473be00fc614aeff1b93b555c76b905fcc71e56b.css",
"sourceMap": "473be00fc614aeff1b93b555c76b905fcc71e56b.css.map",
"sourceMapUrl": "/473be00fc614aeff1b93b555c76b905fcc71e56b.map",
"size": 342679,
"hash": "2aabe450770c6a0872fa79545aaf3f06523197d8"
},
> ...
But somehow the .css file is successfully loaded and the .css.map not.
Where should i look for the error?

gruntfile files named patterns, possible?

I'm playing around with Ghost, and I'd like to make the gruntfile compile the sass files from my theme.
So I started by modifying the sass task:
...
sass: {
admin: {
files: {
'<%= paths.adminAssets %>/css/screen.css': '<%= paths.adminAssets %>/sass/screen.scss'
}
},
themes: {
files:{
'content/themes/**/css/ie.css': 'content/themes/**/src/sass/ie.sass',
'content/themes/**/css/print.css': 'content/themes/**/src/sass/print.sass',
'content/themes/**/css/screen.css': 'content/themes/**/src/sass/screen.sass'
}
}
}
...
I realised that I could simplfy this to :
...
sass: {
admin: {
files: {
'<%= paths.adminAssets %>/css/screen.css': '<%= paths.adminAssets %>/sass/screen.scss'
}
},
themes: {
files:{
'content/themes/**/css/*.css': 'content/themes/**/src/sass/*.sass',
}
}
}
...
But then I was thinking, why isn't it replacing the stars in the destination with what it matches from the source?
Ends up it was just creating the following:
$ ls -al ./content/themes/
total 0
drwxrwxr-x 1 zenobius zenobius 50 Nov 18 02:10 .
drwxrwxr-x 1 zenobius zenobius 46 Nov 15 11:02 ..
drwxrwxr-x 1 zenobius zenobius 6 Nov 18 02:10 ** <----- sigh
drwxrwxr-x 1 zenobius zenobius 128 Nov 15 11:02 casper
drwxrwxr-x 1 zenobius zenobius 250 Nov 18 00:08 crycilium
I guess my question is really:
can i use some kind of regex named patterns
could I use a function in the files option to process the output name as the destination?
So the solution was to make use of grunt.file.expandMapping, (thanks to : https://stackoverflow.com/a/16672303/454615):
...
themes: {
files: grunt.file.expandMapping([
"content/themes/**/src/**/*.sass",
"!content/themes/**/src/**/_*.sass",
], '', {
expand: true,
ext: '.css',
rename: function(base, src) {
grunt.log.write(base + " " + src);
return src.replace('/src/', '/../'); // or some variation
}
})
}
...

Resources