Skip to content

Instantly share code, notes, and snippets.

View fabianvf's full-sized avatar

Fabian von Feilitzsch fabianvf

View GitHub Profile
from openshift.dynamic import DynamicClient
import kubernetes
namespace = 'your-namespace'
name = 'your-name'
client = DynamicClient(kubernetes.config.new_client_from_config())
v1_pods = client.resources.get(api_version='v1', kind='Pod')
v1_events = client.resources.get(api_version='v1', kind='Event')
- name: Retrieve results
k8s_log:
api_version: v1
kind: Pod
name: "{{ item.metadata.name }}"
namespace: "{{ meta.namespace }}"
register: result_log
with_items: "{{ client_pods.resources }}"
---
- actual:
items:
- a
- b
- c
desired:
items:
- d
from __future__ import print_function
import os
import re
import yaml
base_dirs = {
'build': 'scaffold.BuildDir',
'build/test-framework': 'scaffold.BuildTestDir',
Server [https://localhost:8443]: I1218 13:39:00.356890 1821 round_trippers.go:383] HEAD https://master.example.org:8443/
I1218 13:39:00.357019 1821 round_trippers.go:390] Request Headers:
I1218 13:39:00.393071 1821 round_trippers.go:408] Response Status: in 36 milliseconds
I1218 13:39:00.393112 1821 round_trippers.go:411] Response Headers:
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n):
I1218 13:39:01.832955 1821 round_trippers.go:383] GET https://master.example.org:8443/.well-known/oauth-authorization-server
I1218 13:39:01.832976 1821 round_trippers.go:390] Request Headers:
I1218 13:39:01.832987 1821 round_trippers.go:393] X-Csrf-Token: 1
import kubernetes
from openshift.dynamic import DynamicClient
import urllib3
urllib3.disable_warnings()
def get_client(**kwargs):
configuration = kubernetes.client.Configuration()
import kubernetes
from openshift.dynamic import DynamicClient
import urllib3
urllib3.disable_warnings()
def get_client(**kwargs):
configuration = kubernetes.client.Configuration()
@fabianvf
fabianvf / auth.py
Last active December 7, 2018 16:41
from openshift import client
configuration = client.Configuration()
configuration.api_key = {'authorization': 'Bearer {0}'.format(api_key)}
configuration.host = host
client.Configuration.set_default(configuration)
api = client.OapiApi()
res = api.list_project()
print(res)
$id: http://example.com/root.json
$schema: http://json-schema.org/draft-07/schema#
properties:
brokerClusterRole:
$id: '#/properties/brokerClusterRole'
default: admin
title: The Broker ClusterRole Schema
type: string
brokerConfig:
$id: '#/properties/brokerConfig'