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

restructure deploy contents to support using kustomize #12

Open
wants to merge 6 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
28 changes: 28 additions & 0 deletions .lighthouse/jenkins-x/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pullrequest
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
workingDir: /workspace/source
env:
- name: "NEXUS_AUTH"
valueFrom:
secretKeyRef:
name: drivenow-maven-settings
key: NEXUS_AUTH
- name: "KANIKO_ARGS"
value: "--build-arg=NEXUS_AUTH"

steps:
- image: uses:lighthouse:drivenow/jx3-pipelines/docker-helm-promote-pr/pullrequest.yaml@master
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 240h0m0s
status: {}
27 changes: 27 additions & 0 deletions .lighthouse/jenkins-x/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: release
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
workingDir: /workspace/source
env:
- name: "NEXUS_AUTH"
valueFrom:
secretKeyRef:
name: drivenow-maven-settings
key: NEXUS_AUTH
- name: "KANIKO_ARGS"
value: "--build-arg=NEXUS_AUTH"
steps:
- image: uses:lighthouse:drivenow/jx3-pipelines/docker-helm-promote-pr/release.yaml@master
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 240h0m0s
status: {}
16 changes: 16 additions & 0 deletions .lighthouse/jenkins-x/triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
kind: TriggerConfig
spec:
presubmits:
- name: pr
context: "pr"
always_run: true
optional: false
source: pullrequest.yaml
postsubmits:
- name: release
context: "release"
source: release.yaml
branches:
- ^main$
- ^master$
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ ARG GIT_SHA=0000000

WORKDIR /src

COPY go.mod ./ go.sum ./
COPY go.mod go.sum ./
RUN GOPROXY=https://goproxy.cn,direct go mod download

COPY pkg ./ cmd ./ version ./
COPY ./ ./

RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${GOBIN}/${PROJECT_NAME} \
-ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" \
Expand Down
4 changes: 4 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- cameronbraid
reviewers:
- cameronbraid
6 changes: 6 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
aliases:
- cameronbraid
best-approvers:
- cameronbraid
best-reviewers:
- cameronbraid
7 changes: 7 additions & 0 deletions deploy/cluster/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../common/
- cluster_role.yaml
- cluster_role_binding.yaml
- operator.yaml
2 changes: 1 addition & 1 deletion deploy/cluster/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
containers:
- name: redis-operator
# Replace this with the built image name
image: REPLACE_IMAGE
image: redis-operator
command:
- redis-operator
imagePullPolicy: Always
Expand Down
5 changes: 5 additions & 0 deletions deploy/common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- redis_v1beta1_rediscluster_crd.yaml
- service_account.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: redisclusters.redis.kun
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ metadata:
name: test
spec:
# Add fields here
size: 3
size: 3
7 changes: 7 additions & 0 deletions deploy/namespace/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../common/
- operator.yaml
- role.yaml
- role_binding.yaml
2 changes: 1 addition & 1 deletion deploy/namespace/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
containers:
- name: redis-operator
# Replace this with the built image name
image: REPLACE_IMAGE
image: redis-operator
command:
- redis-operator
imagePullPolicy: Always
Expand Down
7 changes: 0 additions & 7 deletions deploy/namespace/redis_v1beta1_rediscluster_cr.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions pkg/client/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ func (c *client) SetCustomRedisConfig(ip string, configs map[string]string, auth
rClient := rediscli.NewClient(options)
defer rClient.Close()

if err := c.applyRedisConfig("replica-announce-ip", ip, rClient); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no replica-announce-ip configuration in redis 3.2.2, I hope the operator supports redis 3.2.2+.

return err
}

for param, value := range configs {
//param, value, err := c.getConfigParameters(config)
//if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/service/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func (r *RedisClusterChecker) CheckRedisConfig(redisCluster *redisv1beta1.RedisC
return err
}

if _, ok := configs["replica-announce-ip"]; !ok {
return fmt.Errorf("configs conflict, expect: replica-announce-ip to be set")
}

// TODO when custom config use unit like mb gb, will return configs conflict
for key, value := range redisCluster.Spec.Config {
if value != configs[key] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/service/heal.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func (r *RedisClusterHealer) SetSentinelCustomConfig(ip string, rc *redisv1beta1

// SetRedisCustomConfig will call redis to set the configuration given in config
func (r *RedisClusterHealer) SetRedisCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error {
if len(rc.Spec.Config) == 0 && len(auth.Password) == 0 {
return nil
}
// if len(rc.Spec.Config) == 0 && len(auth.Password) == 0 {
// return nil
// }

//if len(auth.Password) != 0 {
// rc.Spec.Config["requirepass"] = auth.Password
Expand Down