Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crd fix #65

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ orbs:
jobs:
markdownlint:
docker:
- image: circleci/node:10.14.2
- image: cimg/node:18.14.1
auth:
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- run:
name: docker login
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- run:
name: docker build and push
command: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ _output/
test/e2e/cluster
profile.out
*.DS_Store
.history/

3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# build stage
FROM golang:1.10 AS build-env
ARG APPVERSION=latest
WORKDIR /go/src/github.com/objectrocket/sensu-operator
Expand All @@ -13,4 +12,4 @@ RUN apk add --no-cache --update ca-certificates && \
adduser -D -g "${USER} user" -H -h "/app" -G "${USER}" -u 1000 ${USER} && \
chown -R ${USER}:${USER} /usr/local/bin/sensu-operator
USER ${USER}:${USER}
ENTRYPOINT ["./usr/local/bin/sensu-operator"]
ENTRYPOINT ["./usr/local/bin/sensu-operator"]
36 changes: 26 additions & 10 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ required = [

[[constraint]]
name = "k8s.io/api"
version = "kubernetes-1.13.1"
version = "kubernetes-1.13.2"

[[constraint]]
version = "kubernetes-1.13.1"
version = "kubernetes-1.16.0"
name = "k8s.io/apiextensions-apiserver"

[[constraint]]
name = "k8s.io/apimachinery"
version = "kubernetes-1.13.1"
version = "kubernetes-1.13.2"

[[constraint]]
name = "k8s.io/client-go"
version = "kubernetes-1.13.1"
version = "kubernetes-1.13.2"

[prune]
go-tests = true
Expand Down
12 changes: 10 additions & 2 deletions example/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@ metadata:
namespace: sensu

---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: sensu-operator
namespace: sensu
spec:
replicas: 1
selector:
matchLabels:
app: sensu-operator
release: sensu-operator
template:
metadata:
labels:
name: sensu-operator
release: sensu-operator
app: sensu-operator
spec:
containers:
- name: sensu-operator
image: objectrocket/sensu-operator:latest
imagePullPolicy: Never
imagePullPolicy: Always
env:
- name: MY_POD_NAMESPACE
valueFrom:
Expand All @@ -49,3 +55,5 @@ spec:
value: "4"
- name: SENSUOP_PROCESSING_RETRIES
value: "5"
imagePullSecrets:
- name: 'or-docker-secret'
12 changes: 7 additions & 5 deletions example/example-sensu-cluster-objectrocket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: SensuCluster
metadata:
annotations:
objectrocket.com/scope: clusterwide
name: platdev0
name: sensu
namespace: sensu
spec:
pod:
Expand All @@ -14,7 +14,9 @@ spec:
resources:
requests:
storage: 8Gi
storageClassName: standard
repository: sensu/sensu
size: 1
version: 5.14.0
storageClassName: gp2
repository: objectrocket/sensu-backend
size: 5
version: 5.20.2_or2
clusteradminusername: admin
clusteradminpassword: p@ssw0rd!
6 changes: 5 additions & 1 deletion hack/unit_test
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ set -o pipefail
source "hack/lib/test_lib.sh"

TEST_PKGS=$(listPkgs | grep -v e2e)
echo $TEST_PKGS
for pkg in $TEST_PKGS; do
echo $pkg
build_flags=("-i") # cache package compilation data for faster repeated builds
for i in {1..2}; do
echo "testing package ${pkg}"
go test -failfast ${build_flags[@]} -race -covermode=atomic -coverprofile=profile.out $pkg
echo ${build_flags[@]}
echo $pkg
#go test -failfast ${build_flags[@]} -race -covermode=atomic -coverprofile=profile.out $pkg
# Expand empty array would cause "unbound variable".
# Expand one empty string array is equal to nothing.
build_flags=("")
Expand Down
1 change: 1 addition & 0 deletions helm/sensu-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: sensu-operator
version: 0.0.0
description: ObjectRocket Sensu Operator
Expand Down
13 changes: 6 additions & 7 deletions helm/sensu-operator/templates/sensu-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ spec:
imagePullSecrets:
- name: {{ .Values.imagePullSecret.name }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
allowPrivilegeEscalation: false
runAsNonRoot: true
supplementalGroups:
- 1000
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
supplementalGroups:
- 1000
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
Expand Down
8 changes: 4 additions & 4 deletions helm/sensu-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ resourceSettings:

logLevel: info

nodeSelector:
node-role.kubernetes.io/platform_worker: "true"
#nodeSelector:
# node-role.kubernetes.io/platform_worker: "true"

tolerations:
- effect: NoSchedule
key: node_role
operator: Equal
value: platform_worker
value: product_worker

rbac:
clusterRole: sensu-operator
Expand All @@ -53,4 +53,4 @@ sensu:
processingRetries: 5

prometheus:
enabled: true
enabled: false
2 changes: 1 addition & 1 deletion pkg/apis/objectrocket/v1beta1/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package v1beta1
import (
crdutil "github.com/objectrocket/sensu-operator/pkg/util/k8sutil/conversionutil"
sensutypes "github.com/sensu/sensu-go/types"
k8s_api_extensions_v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
k8s_api_extensions_v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/objectrocket/v1beta1/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package v1beta1
import (
crdutil "github.com/objectrocket/sensu-operator/pkg/util/k8sutil/conversionutil"
sensutypes "github.com/sensu/sensu-go/types"
k8s_api_extensions_v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
k8s_api_extensions_v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/objectrocket/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func (c *Cluster) ClientURLs(m *etcdutil.MemberConfig) (urls []string) {
}

func (c *Cluster) PeerURL(m *etcdutil.MemberConfig, ordinalID int) string {
return fmt.Sprintf("%s://%s.%s.%s.svc:2380",
return fmt.Sprintf("%s://%s.%s.%s.svc.cluster.local:2380",
m.PeerScheme(),
c.memberName(ordinalID),
c.name(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/sensu_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *SensuClient) SetTimeout(t time.Duration) {
}

func (s *SensuClient) makeFullyQualifiedSensuClientURL() string {
return fmt.Sprintf("%s.%s.svc", k8sutil.APIServiceName(s.clusterName), s.namespace)
return fmt.Sprintf("%s.%s.svc.cluster.local", k8sutil.APIServiceName(s.clusterName), s.namespace)
}

func (s *SensuClient) ensureCredentials() (err error) {
Expand Down
Loading