Skip to content

Commit

Permalink
Merge pull request #14675 from jpeeler/sc-resync
Browse files Browse the repository at this point in the history
Resync v0.0.10 of service-catalog with origin
  • Loading branch information
eparis committed Jun 16, 2017
2 parents abf83f9 + 9f88d33 commit d40783e
Show file tree
Hide file tree
Showing 151 changed files with 14,330 additions and 4,333 deletions.
Expand Up @@ -24,6 +24,8 @@ limitations under the License.
// TEST_ZONE: GCP Zone in which to create test GKE cluster
// TEST_ACCOUNT: GCP service account credentials (JSON file) to use for testing.

def repo_url = params.REPO_URL

def updatePullRequest(flow, success = false) {
def state, message
switch (flow) {
Expand All @@ -39,10 +41,14 @@ def updatePullRequest(flow, success = false) {
default:
error('flow can only be run or verify')
}
setGitHubPullRequestStatus(
context: env.JOB_NAME,
message: message,
state: state)

step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${repo_url}"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "${JOB_NAME}"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}

// Verify required parameters
Expand Down
Expand Up @@ -249,6 +249,9 @@ test-integration: .init $(scBuildImageTarget) build
# golang integration tests
$(DOCKER_CMD) test/integration.sh

clean-e2e:
rm -f $(BINDIR)/e2e.test

test-e2e: .generate_files $(BINDIR)/e2e.test
$(BINDIR)/e2e.test

Expand Down Expand Up @@ -292,26 +295,24 @@ clean-coverage:
images: user-broker-image \
controller-manager-image apiserver-image

define build-and-tag # (service, image, mutable_image, prefix)
$(eval build_path := "$(4)build/$(1)")
$(eval tmp_build_path := "$(build_path)/tmp")
mkdir -p $(tmp_build_path)
cp $(BINDIR)/$(1) $(tmp_build_path)
docker build -t $(2) $(build_path)
docker tag $(2) $(3)
rm -rf $(tmp_build_path)
endef

user-broker-image: contrib/build/user-broker/Dockerfile $(BINDIR)/user-broker
mkdir -p contrib/build/user-broker/tmp
cp $(BINDIR)/user-broker contrib/build/user-broker/tmp
docker build -t $(USER_BROKER_IMAGE) contrib/build/user-broker
docker tag $(USER_BROKER_IMAGE) $(USER_BROKER_MUTABLE_IMAGE)
rm -rf contrib/build/user-broker/tmp
$(call build-and-tag,"user-broker",$(USER_BROKER_IMAGE),$(USER_BROKER_MUTABLE_IMAGE),"contrib/")

apiserver-image: build/apiserver/Dockerfile $(BINDIR)/apiserver
mkdir -p build/apiserver/tmp
cp $(BINDIR)/apiserver build/apiserver/tmp
docker build -t $(APISERVER_IMAGE) build/apiserver
docker tag $(APISERVER_IMAGE) $(APISERVER_MUTABLE_IMAGE)
rm -rf build/apiserver/tmp
$(call build-and-tag,"apiserver",$(APISERVER_IMAGE),$(APISERVER_MUTABLE_IMAGE))

controller-manager-image: build/controller-manager/Dockerfile $(BINDIR)/controller-manager
mkdir -p build/controller-manager/tmp
cp $(BINDIR)/controller-manager build/controller-manager/tmp
docker build -t $(CONTROLLER_MANAGER_IMAGE) build/controller-manager
docker tag $(CONTROLLER_MANAGER_IMAGE) $(CONTROLLER_MANAGER_MUTABLE_IMAGE)
rm -rf build/controller-manager/tmp
$(call build-and-tag,"controller-manager",$(CONTROLLER_MANAGER_IMAGE),$(CONTROLLER_MANAGER_MUTABLE_IMAGE))

# Push our Docker Images to a registry
######################################
Expand Down
@@ -1,6 +1,7 @@
## `service-catalog`

[![Build Status](https://travis-ci.org/kubernetes-incubator/service-catalog.svg?branch=master)](https://travis-ci.org/kubernetes-incubator/service-catalog)
[![Build Status](https://travis-ci.org/kubernetes-incubator/service-catalog.svg?branch=master)](https://travis-ci.org/kubernetes-incubator/service-catalog "Travis")
[![Build Status](https://service-catalog-jenkins.appspot.com/buildStatus/icon?job=service-catalog-master-testing)](https://service-catalog-jenkins.appspot.com/job/service-catalog-master-testing/ "Jenkins")

### Introduction

Expand Down
Expand Up @@ -32,6 +32,10 @@ spec:
cpu: 100m
memory: 30Mi
args:
{{ if .Values.apiserver.audit.activated -}}
- --audit-log-path
- {{ .Values.apiserver.audit.logPath }}
{{- end}}
- --admission-control
- "KubernetesNamespaceLifecycle"
- --secure-port
Expand Down
Expand Up @@ -31,9 +31,23 @@ spec:
limits:
cpu: 100m
memory: 30Mi
env:
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- --port
- "8080"
{{ if .Values.controllerManager.leaderElectionNamespace.activated -}}
- "--leader-election-namespace=$(K8S_NAMESPACE)"
{{- end }}
{{ if .Values.controllerManager.profiling.disabled -}}
- "--profiling=false"
{{- end}}
{{ if .Values.controllerManager.profiling.contentionProfiling -}}
- "--contention-profiling=true"
{{- end}}
{{- if not .Values.useAggregator }}
- --service-catalog-api-server-url
{{- if .Values.apiserver.insecure }}
Expand Down
@@ -1,7 +1,7 @@
# Default values for Service Catalog
apiserver:
# apiserver image to use
image: quay.io/kubernetes-service-catalog/apiserver:v0.0.7
image: quay.io/kubernetes-service-catalog/apiserver:v0.0.9
# imagePullPolicy for the apiserver; valid values are "IfNotPresent",
# "Never", and "Always"
imagePullPolicy: Always
Expand Down Expand Up @@ -49,9 +49,14 @@ apiserver:
# and authorization can be useful for quickly getting the walkthrough up and running,
# but is not suitable for production.
enabled: false
audit:
# If true, enables the use of audit features via this chart.
activated: false
# If specified, audit log goes to specified path.
logPath: "/tmp/service-catalog-apiserver-audit.log"
controllerManager:
# controller-manager image to use
image: quay.io/kubernetes-service-catalog/controller-manager:v0.0.7
image: quay.io/kubernetes-service-catalog/controller-manager:v0.0.9
# imagePullPolicy for the controller-manager; valid values are
# "IfNotPresent", "Never", and "Always"
imagePullPolicy: Always
Expand All @@ -64,4 +69,13 @@ controllerManager:
# Whether or not the controller supports a --broker-relist-interval flag. If this is
# set to true, brokerRelistInterval will be used as the value for that flag
brokerRelistIntervalActivated: true
# enables profiling via web interface host:port/debug/pprof/
profiling:
# Disable profiling via web interface host:port/debug/pprof/
disabled: false
# Enables lock contention profiling, if profiling is enabled.
contentionProfiling: false
leaderElectionNamespace:
# Whether the controller has option to set leader election namespace.
activated: false
useAggregator: false
@@ -1,5 +1,5 @@
# Default values for User-Provided Service Broker
# Image to use
image: quay.io/kubernetes-service-catalog/user-broker:v0.0.7
image: quay.io/kubernetes-service-catalog/user-broker:v0.0.9
# ImagePullPolicy; valid values are "IfNotPresent", "Never", and "Always"
imagePullPolicy: Always
Expand Up @@ -39,6 +39,8 @@ type ServiceCatalogServerOptions struct {
AuthorizationOptions *genericserveroptions.DelegatingAuthorizationOptions
// InsecureOptions are options for serving insecurely.
InsecureServingOptions *genericserveroptions.ServingOptions
// audit options for api server
AuditOptions *genericserveroptions.AuditLogOptions
// EtcdOptions are options for serving with etcd as the backing store
EtcdOptions *EtcdOptions
// TPROptions are options for serving with TPR as the backing store
Expand Down Expand Up @@ -72,6 +74,7 @@ func (s *ServiceCatalogServerOptions) addFlags(flags *pflag.FlagSet) {
s.InsecureServingOptions.AddFlags(flags)
s.EtcdOptions.addFlags(flags)
s.TPROptions.addFlags(flags)
s.AuditOptions.AddFlags(flags)
}

// StorageType returns the storage type configured on s, or a non-nil error if s holds an
Expand Down
Expand Up @@ -70,6 +70,7 @@ func NewCommandServer(
AuthenticationOptions: genericserveroptions.NewDelegatingAuthenticationOptions(),
AuthorizationOptions: genericserveroptions.NewDelegatingAuthorizationOptions(),
InsecureServingOptions: genericserveroptions.NewInsecureServingOptions(),
AuditOptions: genericserveroptions.NewAuditLogOptions(),
EtcdOptions: NewEtcdOptions(),
TPROptions: NewTPROptions(),
StopCh: stopCh,
Expand Down
Expand Up @@ -86,8 +86,10 @@ func buildGenericConfig(s *ServiceCatalogServerOptions) (*genericapiserver.Confi
glog.Infof("Authentication and authorization disabled for testing purposes")
}

// TODO: add support for audit log options
// see https://github.com/kubernetes-incubator/service-catalog/issues/678
if err := s.AuditOptions.ApplyTo(genericConfig); err != nil {
return nil, nil, err
}

// TODO: add support for OpenAPI config
// see https://github.com/kubernetes-incubator/service-catalog/issues/721
genericConfig.SwaggerConfig = genericapiserver.DefaultSwaggerConfig()
Expand Down
Expand Up @@ -21,7 +21,9 @@ import (
"fmt"
"net"
"net/http"
"net/http/pprof"
"os"
goruntime "runtime"
"strconv"
"time"

Expand Down Expand Up @@ -149,6 +151,15 @@ func Run(controllerManagerOptions *options.ControllerManagerServer) error {
healthz.InstallHandler(mux)
configz.InstallHandler(mux)

if controllerManagerOptions.EnableProfiling {
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
if controllerManagerOptions.EnableContentionProfiling {
goruntime.SetBlockProfileRate(1)
}
}
server := &http.Server{
Addr: net.JoinHostPort(controllerManagerOptions.Address, strconv.Itoa(int(controllerManagerOptions.Port))),
Handler: mux,
Expand Down Expand Up @@ -197,10 +208,12 @@ func Run(controllerManagerOptions *options.ControllerManagerServer) error {
return err
}

glog.V(5).Infof("Using namespace %v for leader election lock", controllerManagerOptions.LeaderElectionNamespace)

// Lock required for leader election
rl := resourcelock.EndpointsLock{
EndpointsMeta: metav1.ObjectMeta{
Namespace: "kube-system",
Namespace: controllerManagerOptions.LeaderElectionNamespace,
Name: "service-catalog-controller-manager",
},
Client: leaderElectionClient,
Expand Down
Expand Up @@ -36,15 +36,18 @@ type ControllerManagerServer struct {
componentconfig.ControllerManagerConfiguration
}

const defaultResyncInterval = 5 * time.Minute
const defaultBrokerRelistInterval = 24 * time.Hour
const defaultContentType = "application/json"
const defaultBindAddress = "0.0.0.0"
const defaultPort = 10000
const defaultK8sKubeconfigPath = "./kubeconfig"
const defaultServiceCatalogKubeconfigPath = "./service-catalog-kubeconfig"
const defaultOSBAPIContextProfile = true
const defaultConcurrentSyncs = 5
const (
defaultResyncInterval = 5 * time.Minute
defaultBrokerRelistInterval = 24 * time.Hour
defaultContentType = "application/json"
defaultBindAddress = "0.0.0.0"
defaultPort = 10000
defaultK8sKubeconfigPath = "./kubeconfig"
defaultServiceCatalogKubeconfigPath = "./service-catalog-kubeconfig"
defaultOSBAPIContextProfile = true
defaultConcurrentSyncs = 5
defaultLeaderElectionNamespace = "kube-system"
)

// NewControllerManagerServer creates a new ControllerManagerServer with a
// default config.
Expand All @@ -61,6 +64,9 @@ func NewControllerManagerServer() *ControllerManagerServer {
OSBAPIContextProfile: defaultOSBAPIContextProfile,
ConcurrentSyncs: defaultConcurrentSyncs,
LeaderElection: leaderelection.DefaultLeaderElectionConfiguration(),
LeaderElectionNamespace: defaultLeaderElectionNamespace,
EnableProfiling: true,
EnableContentionProfiling: false,
},
}
s.LeaderElection.LeaderElect = true
Expand All @@ -79,5 +85,8 @@ func (s *ControllerManagerServer) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&s.ResyncInterval, "resync-interval", s.ResyncInterval, "The interval on which the controller will resync its informers")
fs.DurationVar(&s.BrokerRelistInterval, "broker-relist-interval", s.BrokerRelistInterval, "The interval on which a broker's catalog is relisted after the broker becomes ready")
fs.BoolVar(&s.OSBAPIContextProfile, "enable-osb-api-context-profile", s.OSBAPIContextProfile, "Whether or not to send the proposed optional OpenServiceBroker API Context Profile field")
fs.BoolVar(&s.EnableProfiling, "profiling", s.EnableProfiling, "Enable profiling via web interface host:port/debug/pprof/")
fs.BoolVar(&s.EnableContentionProfiling, "contention-profiling", s.EnableContentionProfiling, "Enable lock contention profiling, if profiling is enabled")
leaderelection.BindFlags(&s.LeaderElection, fs)
fs.StringVar(&s.LeaderElectionNamespace, "leader-election-namespace", s.LeaderElectionNamespace, "Namespace to use for leader election lock")
}
Expand Up @@ -7,6 +7,7 @@ spec:
# put the basic auth for the broker in a secret, and reference the secret here.
# service-catalog will use the contents of the secret. The secret should have "username"
# and "password" keys
authSecret:
namespace: some-namespace
name: secret-name
authInfo:
basicAuthSecret:
namespace: some-namespace
name: secret-name
@@ -0,0 +1,14 @@
apiVersion: servicecatalog.k8s.io/v1alpha1
kind: Binding
metadata:
name: ups-binding
namespace: test-ns
spec:
instanceRef:
name: ups-instance
secretName: my-secret
alphaPodPresetTemplate:
name: my-pod-preset
selector:
matchLabels:
app: my-app
Expand Up @@ -136,13 +136,19 @@ use the following commands:

```shell
export SERVICE_NAME=<service>
export ALT_NAMES="<service>.<namespace>,<service>.<namespace>.svc"
export ALT_NAMES='"<service>.<namespace>","<service>.<namespace>.svc"'
echo '{"CN":"'${SERVICE_NAME}'","hosts":['${ALT_NAMES}'],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -ca=server-ca.crt -ca-key=server-ca.key -config=server-ca-config.json - | cfssljson -bare apiserver
```

`<service>` should be the name of the Service for service
catalog API server (e.g. `<release>-<chart>` when using Helm).

This will create a pair of files named `apiserver-key.pem` and
`apiserver.pem`. These are the private key and public certificate,
respectively. The private key and certificate are commonly referred to
with `.key ` and `.crt` extensions, respectively: `apiserver.key` and
`apiserver.crt`.

To base64 encode these files for passing to the Helm charts, run `base64
--wrap=0 <file>`. The resulting output may be passed to the Helm charts
for the `apiserver.tls.*` series of options.
Expand Down

0 comments on commit d40783e

Please sign in to comment.