Skip to content

Instantly share code, notes, and snippets.

[pweil@paperweight metering-operator]$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b011e03c9613 registry.redhat.io/redhat/redhat-operator-index:v4.6 registry serve -d... 5 hours ago Up 5 hours ago 0.0.0.0:50051->50051/tcp relaxed_brattain
[pweil@paperweight metering-operator]$ grpcurl -plaintext localhost:50051 api.Registry/ListPackages
{
"name": "amq-streams"
}
package e2e
import (
"context"
deploy "github.com/kube-reporting/metering-operator/pkg/deploy"
"github.com/kube-reporting/metering-operator/test/deployframework"
v1 "k8s.io/api/core/v1"
"k8s.io/api/storage/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
package e2e
import (
"github.com/kube-reporting/metering-operator/test/deployframework"
"github.com/kube-reporting/metering-operator/test/reportingframework"
"testing"
)
type PreInstallFunc func(ctx *deployframework.DeployerCtx) error
[pweil@pweil-fedora oc]$ ./oc image mirror -a /tmp/pull-secret.json --dir=~/mirror-file file://openshift/release:4.3.3* ${LOCAL_REGISTRY}/ocp-4.3
E0305 15:10:05.065456 10090 config.go:236] while trying to parse blob "{\n \"auths\": {\n \"localhost:5000\": {\n \"auth\": \"dXNlcjpwYXNz\",\n \"email\": \"[email protected]\"\n }\n },\n}\n": invalid character '}' looking for beginning of object key string
error: unable to load --registry-config: invalid character '}' looking for beginning of object key string
[pweil@pweil-fedora oc]$ ./oc image mirror -a /tmp/pull-secret.json --dir=~/mirror-file file://openshift/release:4.3.3* ${LOCAL_REGISTRY}/ocp-4.3
E0305 15:10:25.159586 10112 config.go:236] while trying to parse blob " \"localhost:5000\": {\n \"auth\": \"dXNlcjpwYXNz\",\n \"email\": \"[email protected]\"\n }\n": invalid character ':' after top-level value
error: unable to load --registry-config: invalid character ':' after top-level value
[pweil@pweil-fedora oc]$ ./
@pweil-
pweil- / gist:e7b156476c6171f04140370708f0cd56
Last active August 17, 2020 23:01
Air Gap Mirroring
###
# Create mirror repo following disconnected instructions
###
# create dir
mkdir -p ~/registry1/{auth,certs,data}
# create cert
openssl req -newkey rsa:4096 -nodes -sha256 -keyout ~/registry1/certs/domain.key -x509 -days 365 -out ~/registry1/certs/domain.crt
[pweil@pweil-fedora openshift-azure]$ oc version
oc v4.0.0-alpha.0+02f888e-285
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://pweilosa.eastus.cloudapp.azure.com
openshift v3.11.43
kubernetes v1.11.0+d4cacc0
Error from server (Forbidden): clusterrolebindings.authorization.openshift.io "dedicated-project-admin-0" is forbidden: attempt to grant extra privileges: [
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["create"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["delete"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["get"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["list"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["patch"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["update"]}
PolicyRule{APIGroups:[""], Resources:["limitranges"], Verbs:["watch"]}
PolicyRule{APIGroups:[""], Resources:["resourcequotas"], Verbs:["create"]}
PolicyRule{APIGroups:[""], Resources:["resourcequotas"], Verbs:["delete"]}
apiVersion: apps/v1
kind: Deployment
metadata:
name: namespace-rolebindings
namespace: openshift-infra
spec:
replicas: 1
selector:
matchLabels:
app: namespace-rolebindings
[pweil@pweil-fedora origin]$ oc observe --help
Observe changes to resources and take action on them
This command assists in building scripted reactions to changes that occur in Kubernetes or OpenShift resources. This is
frequently referred to as a 'controller' in Kubernetes and acts to ensure particular conditions are maintained. On
startup, observe will list all of the resources of a particular type and execute the provided script on each one.
Observe watches the server for changes, and will reexecute the script for each update.
Observe works best for problems of the form "for every resource X, make sure Y is true". Some examples of ways observe
can be used include:
// OpenShiftManagedCluster represents an OpenShift cluster with an
// agent only node model and a hosted control plane.
type ManagedOpenShiftCluster struct {
ID string `json:"id,omitempty"`
Location string `json:"location,omitempty" validate:"required"`
Name string `json:"name,omitempty"`
Plan *ResourcePurchasePlan `json:"plan,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Type string `json:"type,omitempty"`