common-network-policy-operator

module
v0.0.0-...-c7c462f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2019 License: MIT

README

Common Network Policy Operator

MIT License Go Report Card

Common Policy Operator is auto create common network policy to all namespaces.

Requirement

  • kubectl
  • Kustomize

Installation

$ kubectl config current-context <TARGET CLUSTER CONTEXT>
$ kubectl apply -f https://raw.githubusercontent.com/bells17/common-network-policy-operator/1.0.2/config/deploy.yaml

If install is success, you can check resources as below:

$ kubectl get po -n common-network-policy-operator-system
NAME                                                     READY     STATUS    RESTARTS   AGE
common-network-policy-operator-controller-manager-0   1/1       Running   0          1m

$ kubectl get crd
NAME                                                           CREATED AT
commonnetworkpolicies.commonnetworkpolicies.bells17.io   2018-11-09T00:00:00Z

Usage

You can apply to your cluster using the following example.

apiVersion: commonnetworkpolicies.bells17.io/v1alpha1
kind: CommonNetworkPolicy
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: sample-networkpolicy
spec:
  namePrefix: common
  excludeNamespaces:
  - kube-system
  - common-network-policy-operator-system
  policySpec:
    podSelector: {}
    policyTypes:
    - Egress

---
apiVersion: commonnetworkpolicies.bells17.io/v1alpha1
kind: CommonNetworkPolicy
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: sample-networkpolicy2
spec:
  namePrefix: common
  excludeNamespaces:
  - kube-system
  - common-network-policy-operator-system
  policySpec:
    podSelector: {}
    ingress:
    - {}

After apply, create commonnetworkpolicies and networkpolicies such as below:

$ kubectl get commonnetworkpolicies
NAME                    CREATED AT
sample-networkpolicy    1m
sample-networkpolicy2   1m

$ kubectl get networkpolicies --all-namespaces=true
NAMESPACE     NAME                              POD-SELECTOR   AGE
default       common-sample-networkpolicy    <none>         1m
default       common-sample-networkpolicy2   <none>         1m
docker        common-sample-networkpolicy    <none>         1m
docker        common-sample-networkpolicy2   <none>         1m
kube-public   common-sample-networkpolicy    <none>         1m
kube-public   common-sample-networkpolicy2   <none>         1m

LICENSE

Copyright 2018 bells17.

Licensed under the MIT License.

Directories

Path Synopsis
cmd
pkg
apis
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
apis/commonnetworkpolicies
Package commonnetworkpolicies contains commonnetworkpolicies API versions
Package commonnetworkpolicies contains commonnetworkpolicies API versions
apis/commonnetworkpolicies/v1alpha1
Package v1alpha1 contains API Schema definitions for the commonnetworkpolicies v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bells17/common-network-policy-operator/pkg/apis/commonnetworkpolicies +k8s:defaulter-gen=TypeMeta +groupName=commonnetworkpolicies.bells17.io Package v1alpha1 contains API Schema definitions for the commonnetworkpolicies v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bells17/common-network-policy-operator/pkg/apis/commonnetworkpolicies +k8s:defaulter-gen=TypeMeta +groupName=commonnetworkpolicies.bells17.io
Package v1alpha1 contains API Schema definitions for the commonnetworkpolicies v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bells17/common-network-policy-operator/pkg/apis/commonnetworkpolicies +k8s:defaulter-gen=TypeMeta +groupName=commonnetworkpolicies.bells17.io Package v1alpha1 contains API Schema definitions for the commonnetworkpolicies v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bells17/common-network-policy-operator/pkg/apis/commonnetworkpolicies +k8s:defaulter-gen=TypeMeta +groupName=commonnetworkpolicies.bells17.io
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/commonnetworkpolicies/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/commonnetworkpolicies/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL