Skip to content

Instantly share code, notes, and snippets.

View nontster's full-sized avatar
😁
Focusing

Nont Banditwong nontster

😁
Focusing
View GitHub Profile
@nontster
nontster / clean_docker_nexus.sh
Created November 25, 2022 02:01 — forked from matzegebbe/clean_docker_nexus.sh
Nexus Repository Manager keep the last X docker images delete all other
#!/bin/bash
REPO_URL="https://repository.xxx.net/repository/"
USER="admin"
PASSWORD="datpassword"
BUCKET="portal-docker"
KEEP_IMAGES=10
IMAGES=$(curl --silent -X GET -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -u ${USER}:${PASSWORD} "${REPO_URL}${BUCKET}/v2/_catalog" | jq .repositories | jq -r '.[]' )
@nontster
nontster / example-ingress-int.yaml
Created February 9, 2021 14:34
Ingress example-ingress-int for expose internal traffic
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress-int
annotations:
kubernetes.io/ingress.class: "nginx-int"
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: hello-world.info
@nontster
nontster / example-ingress.yaml
Created February 9, 2021 14:13
example-ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: hello-world.info
http:
@nontster
nontster / ds-nginx-ingress-controller.yaml
Last active February 9, 2021 14:01
The internal nginx ingress controller daemonset
apiVersion: apps/v1
kind: DaemonSet
metadata:
annotations:
name: nginx-ingress-controller-int
namespace: ingress-nginx
spec:
selector:
matchLabels:
app: ingress-nginx-int
version: '3.6'
services:
cassandra:
image: cassandra:3.11.2
volumes:
- type: volume
source: cassandra_data
target: /var/lib/cassandra
restart: always
networks:
Questions are not from any actual exam!!!
Q: Create a secret that has the following username password data:
username=missawesome
password=123kube321
Create a pod running nginx that has access to those data items in a volume mount path at /tmp/secret-volume
log into the nginx pod you created and list the items and cat the output of the data items to a file "credentials.txt"
curl -s -4 https://ifconfig.co
@Repository
public interface HostRepository extends CustomCassandraRepository<VmByHost, HostKey> {
List<VmByHost> findDistinctByKeyHostName();
}
@Configuration
@EnableCassandraRepositories(basePackages = "co.nontster.vcloud.cmdb.persistence.repository",
repositoryBaseClass = CustomCassandraRepositoryImpl.class)
public class CassandraConfiguration extends AbstractCassandraConfiguration {
//
}
public CustomCassandraRepositoryImpl(CassandraEntityInformation<T, ID> metadata, CassandraOperations operations) {
super(metadata, operations);
this.entityInformation = metadata;
this.operations = operations;
this.mappingContext = operations.getConverter().getMappingContext();
}
@Override
public <S extends T> List<S> insert(Iterable<S> entities, int ttl) {