Skip to content

Commit

Permalink
Merge pull request #162 from caseydavenport/rename-kube-controllers
Browse files Browse the repository at this point in the history
Rename calico/kube-policy-controller to calico/kube-controllers
  • Loading branch information
caseydavenport authored Sep 27, 2017
2 parents 94560dd + f3c3822 commit 11feb59
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dist/
.vscode/
image.created
vendor/
dist/kube-policy-controller
dist/kube-controllers
.go-pkg-cache
st-kubeconfig.yaml
*.coverprofile
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
FROM alpine:3.5
MAINTAINER Casey Davenport <[email protected]>

ADD dist/kube-policy-controller-linux-amd64 /usr/bin/kube-policy-controller
ENTRYPOINT ["/usr/bin/kube-policy-controller"]
ADD dist/kube-controllers-linux-amd64 /usr/bin/kube-controllers
ENTRYPOINT ["/usr/bin/kube-controllers"]
4 changes: 2 additions & 2 deletions Dockerfile-ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
FROM ppc64le/alpine:3.6
MAINTAINER Casey Davenport <[email protected]>

ADD dist/kube-policy-controller-linux-ppc64le /usr/bin/kube-policy-controller
ENTRYPOINT ["/usr/bin/kube-policy-controller"]
ADD dist/kube-controllers-linux-ppc64le /usr/bin/kube-controllers
ENTRYPOINT ["/usr/bin/kube-controllers"]
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ETCD_IMAGE?=quay.io/coreos/etcd:v3.2.5$(ARCHTAG)
default: help

# Makefile configuration options
CONTAINER_NAME=calico/kube-policy-controller$(ARCHTAG)
CONTAINER_NAME=calico/kube-controllers$(ARCHTAG)
PACKAGE_NAME?=github.com/projectcalico/k8s-policy
GO_BUILD_VER:=latest
CALICO_BUILD?=calico/go-build$(ARCHTAG):$(GO_BUILD_VER)
Expand All @@ -45,12 +45,12 @@ DOCKER_GO_BUILD := mkdir -p .go-pkg-cache && \
###############################################################################
## Builds the controller binary and docker image.
docker-image: image.created$(ARCHTAG)
image.created$(ARCHTAG): dist/kube-policy-controller-linux-$(ARCH)
image.created$(ARCHTAG): dist/kube-controllers-linux-$(ARCH)
# Build the docker image for the policy controller.
docker build -t $(CONTAINER_NAME) -f Dockerfile$(ARCHTAG) .
touch $@

dist/kube-policy-controller-linux-$(ARCH):
dist/kube-controllers-linux-$(ARCH):
$(MAKE) OS=linux ARCH=$(ARCH) binary-containerized

## Populates the vendor directory.
Expand Down Expand Up @@ -80,7 +80,7 @@ binary: vendor
if [ "$(OS)" == "linux" ]; then \
INSTALL_FLAG=" -i "; \
fi; \
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -v $$INSTALL_FLAG -o dist/kube-policy-controller-$(OS)-$(ARCH) \
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -v $$INSTALL_FLAG -o dist/kube-controllers-$(OS)-$(ARCH) \
-ldflags "-X main.VERSION=$(GIT_VERSION)" ./main.go

## Build the controller binary in a container.
Expand Down Expand Up @@ -179,13 +179,13 @@ endif
@echo "Now push the tag and images."
@echo ""
@echo " git push $(VERSION)"
@echo " docker push calico/kube-policy-controller:$(VERSION)"
@echo " docker push quay.io/calico/kube-policy-controller:$(VERSION)"
@echo " docker push calico/kube-controllers:$(VERSION)"
@echo " docker push quay.io/calico/kube-controllers:$(VERSION)"
@echo ""
@echo "If this is a stable release, also push the latest images."
@echo ""
@echo " docker push calico/kube-policy-controller:latest"
@echo " docker push quay.io/calico/kube-policy-controller:latest"
@echo " docker push calico/kube-controllers:latest"
@echo " docker push quay.io/calico/kube-controllers:latest"


## Removes all build artifacts.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Calico Network Policy Controllers for Kubernetes
# Calico Controllers for Kubernetes
<img src="http://docs.projectcalico.org/images/felix.png" width="100" height="100">

This repository contains a collection of kubernetes controllers which implement the Kubernetes NetworkPolicy API for Calico deployed using the
This repository contains a collection of kubernetes controllers for Calico deployed using the
etcd datastore. Note that when using Calico configured to use the [Kubernetes datastore][kdd], the controllers in this repository are not needed.

## Get Started Using Calico
Expand Down
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Resulting artifacts
Creating a new release creates the following artifact
* `calico/kube-policy-controller:$VERSION` container images (and the quay.io variant)
* `calico/kube-controllers:$VERSION` container images (and the quay.io variant)

## Preparing for a release
Ensure that the branch you want to release from (typically master) is in a good state.
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ func main() {

for _, controllerType := range strings.Split(config.EnabledControllers, ",") {
switch controllerType {
case "endpoint":
case "workloadendpoint":
podController := pod.NewPodController(k8sClientset, calicoClient)
go podController.Run(config.EndpointWorkers, config.ReconcilerPeriod, stop)
go podController.Run(config.WorkloadEndpointWorkers, config.ReconcilerPeriod, stop)
case "profile":
namespaceController := namespace.NewNamespaceController(k8sClientset, calicoClient)
go namespaceController.Run(config.ProfileWorkers, config.ReconcilerPeriod, stop)
case "policy":
policyController := networkpolicy.NewPolicyController(extensionsClient, calicoClient)
go policyController.Run(config.PolicyWorkers, config.ReconcilerPeriod, stop)
default:
log.Fatalf("Invalid controller '%s' provided. Valid options are endpoint, profile, policy", controllerType)
log.Fatalf("Invalid controller '%s' provided. Valid options are workloadendpoint, profile, policy", controllerType)
}
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ type Config struct {
ReconcilerPeriod string `default:"5m" split_words:"true"`

// Which controllers to run.
EnabledControllers string `default:"policy,profile,endpoint" split_words:"true"`
EnabledControllers string `default:"policy,profile,workloadendpoint" split_words:"true"`

// Number of workers to run for each controller.
EndpointWorkers int `default:"1" split_words:"true"`
ProfileWorkers int `default:"1" split_words:"true"`
PolicyWorkers int `default:"1" split_words:"true"`
WorkloadEndpointWorkers int `default:"1" split_words:"true"`
ProfileWorkers int `default:"1" split_words:"true"`
PolicyWorkers int `default:"1" split_words:"true"`

// Path to a kubeconfig file to use for accessing the k8s API.
Kubeconfig string `default:"" split_words:"false"`
Expand Down
12 changes: 6 additions & 6 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = Describe("Config", func() {
os.Unsetenv("LOG_LEVEL")
os.Unsetenv("RECONCILER_PERIOD")
os.Unsetenv("ENABLED_CONTROLLERS")
os.Unsetenv("ENDPOINT_WORKERS")
os.Unsetenv("WORKLOAD_ENDPOINT_WORKERS")
os.Unsetenv("PROFILE_WORKERS")
os.Unsetenv("POLICY_WORKERS")
os.Unsetenv("KUBECONFIG")
Expand All @@ -42,7 +42,7 @@ var _ = Describe("Config", func() {
os.Setenv("LOG_LEVEL", "debug")
os.Setenv("RECONCILER_PERIOD", "2m5s")
os.Setenv("ENABLED_CONTROLLERS", "policy")
os.Setenv("ENDPOINT_WORKERS", "3")
os.Setenv("WORKLOAD_ENDPOINT_WORKERS", "3")
os.Setenv("PROFILE_WORKERS", "3")
os.Setenv("POLICY_WORKERS", "3")
os.Setenv("KUBECONFIG", "/home/user/.kube/config")
Expand All @@ -51,7 +51,7 @@ var _ = Describe("Config", func() {
// setWrongEnv() function sets environment variables
// with values of wrong data type
setWrongEnv := func() {
os.Setenv("ENDPOINT_WORKERS", "somestring")
os.Setenv("WORKLOAD_ENDPOINT_WORKERS", "somestring")
os.Setenv("PROFILE_WORKERS", "somestring")
os.Setenv("POLICY_WORKERS", "somestring")
}
Expand All @@ -74,8 +74,8 @@ var _ = Describe("Config", func() {
It("shoud return default values", func() {
Expect(config.LogLevel).To(Equal("info"))
Expect(config.ReconcilerPeriod).To(Equal("5m"))
Expect(config.EnabledControllers).To(Equal("policy,profile,endpoint"))
Expect(config.EndpointWorkers).To(Equal(1))
Expect(config.EnabledControllers).To(Equal("policy,profile,workloadendpoint"))
Expect(config.WorkloadEndpointWorkers).To(Equal(1))
Expect(config.ProfileWorkers).To(Equal(1))
Expect(config.PolicyWorkers).To(Equal(1))
Expect(config.Kubeconfig).To(Equal(""))
Expand Down Expand Up @@ -104,7 +104,7 @@ var _ = Describe("Config", func() {
Expect(config.LogLevel).To(Equal("debug"))
Expect(config.ReconcilerPeriod).To(Equal("2m5s"))
Expect(config.EnabledControllers).To(Equal("policy"))
Expect(config.EndpointWorkers).To(Equal(3))
Expect(config.WorkloadEndpointWorkers).To(Equal(3))
Expect(config.ProfileWorkers).To(Equal(3))
Expect(config.PolicyWorkers).To(Equal(3))
Expect(config.Kubeconfig).To(Equal("/home/user/.kube/config"))
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/system/apiserver-reconnection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ docker run --detach --name=calico-policy-controller \
-v ${PWD}/st-kubeconfig.yaml:/st-kubeconfig.yaml \
-e ETCD_ENDPOINTS=http://${ETCD_IP}:2379 \
-e KUBECONFIG=/st-kubeconfig.yaml \
-e ENABLED_CONTROLLERS="endpoint,profile,policy" \
-e ENABLED_CONTROLLERS="workloadendpoint,profile,policy" \
-e LOG_LEVEL="debug" \
calico/kube-policy-controller$ARCHTAG
calico/kube-controllers$ARCHTAG
sleep 2

# Create a trap which emits policy controller logs on failure.
Expand Down
4 changes: 2 additions & 2 deletions tests/testutils/policy_controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func RunPolicyController(etcdIP, kconfigfile string) *containers.Container {
return containers.Run("calico-policy-controller",
"--privileged",
"-e", fmt.Sprintf("ETCD_ENDPOINTS=http://%s:2379", etcdIP),
"-e", "ENABLED_CONTROLLERS=endpoint,profile,policy",
"-e", "ENABLED_CONTROLLERS=workloadendpoint,profile,policy",
"-e", "LOG_LEVEL=debug",
"-e", fmt.Sprintf("KUBECONFIG=%s", kconfigfile),
"-e", "RECONCILER_PERIOD=10s",
"-v", fmt.Sprintf("%s:%s", kconfigfile, kconfigfile),
fmt.Sprintf("%s",os.Getenv("CONTAINER_NAME")))
fmt.Sprintf("%s", os.Getenv("CONTAINER_NAME")))
}

0 comments on commit 11feb59

Please sign in to comment.