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

Adding tls support for operator #25

Merged
merged 2 commits into from
Jul 17, 2024
Merged
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
45 changes: 0 additions & 45 deletions CONTRIBUTING.md

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# jfrog.com/operator-bundle:$VERSION and jfrog.com/operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= docker.jfrog.io/jfrog/jfrog-registry-operator:latest
IMAGE_TAG_BASE ?= docker.jfrog.io/jfrog/jfrog-registry-operator:1.3.0

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand Down Expand Up @@ -239,3 +239,4 @@ build-operator-linux-amd64:
build-operator-linux-arm64:
@$(call echoDebug,"")
@GOOS="linux" GOARCH="arm64" $(MAKE) build BINARYNAME="operator" CMD_SRC_DIR="${PROJECT_DIR}"

2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ resources:
domain: jfrog.com
group: jfrog
kind: SecretRotator
path: github.com/jfrog/jfrog-registry-operator.git
path: github.com/jfrog/jfrog-registry-operator.git/api/v1alpha1
version: v1alpha1
version: "3"
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ The following diagram shows the basic architecture of how AssumeRole integrates

If you are interested in making the move from vulnerable manual secret handling to secure automated secret management, then your journey towards a more secure and seamless containerized future begins here. See how quickly this powerful capability can be deployed by checking out our [step-by-step installation and configuration guide](https://jfrog.com/help/r/jfrog-installation-setup-documentation/passwordless-access-for-amazon-eks).


## Install operator using helm chart - Ignore if you already installed using Setting up JFrog’s AssumeRole Capabilities in AWS

```bash
Expand Down Expand Up @@ -71,6 +70,12 @@ spec:
annotationKey: annotationValue
labels:
labelName: labelValue
security:
enabled: false
secretNamespace:
## NOTE: You can provide either a ca.pem or ca.crt. But make sure that key needs to same as ca.crt or ca.pem in secret
certificateSecretName:
insecureSkipVerify: false
```

Apply the secretrotator mainfest:
Expand Down
27 changes: 27 additions & 0 deletions api/v1alpha1/secretrotator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ var (
SecretKind = reflect.TypeOf(SecretRotator{}).Name()
)

// Custom Certificate path
var (
CustomCertificatePath = "/usr/tmp/"
CertPem = "/cert.pem"
KeyPem = "/key.pem"
CaPem = "/ca.pem"
TlsCrt = "/tls.crt"
TlsKey = "/tls.key"
TlsCa = "/ca.crt"
)

// SecretRotatorSpec defines the desired state of SecretRotator
type SecretRotatorSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Expand All @@ -47,6 +58,22 @@ type SecretRotatorSpec struct {

// RefreshInterval The time in which the controller should reconcile it's objects and recheck namespaces for labels.
RefreshInterval *metav1.Duration `json:"refreshTime,omitempty"`

// Security holding tls/ssl certificates details
Security SecurityDetails `json:"security,omitempty"`
}

// SecurityDetails defines details for certificates, fields are insecureSkipVerify, secret nameand enable flag.
type SecurityDetails struct {
// +kubebuilder:default:=false
// +optional
Enabled bool `default:"false" json:"enabled,omitempty"`
// +optional
CertificateSecretName string `json:"certificateSecretName,omitempty"`
// +optional
SecretNamespace string `json:"secretNamespace,omitempty"`
// +optional
InsecureSkipVerify bool `default:"false" json:"insecureSkipVerify,omitempty"`
}

// SecretMetadata defines metadata fields for the ExternalSecret generated by the SecretOperator.
Expand Down
16 changes: 16 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Binary file removed bin/controller-gen
Binary file not shown.
Binary file removed bin/setup-envtest
Binary file not shown.
11 changes: 10 additions & 1 deletion charts/jfrog-registry-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# JFrog Secret Rotator Operator Chart Changelog
All changes to this chart will be documented in this file.

## [1.3.0] - Jul 17, 2024
* Release of jfrog-registry-operator `1.3.0`

## [1.2.0] - Jul 15, 2024
* Release of jfrog-registry-operator `1.2.0`

## [1.1.0] - Feb 1, 2024
* Updated README.md to create a namespace using `--create-namespace` as part of helm install

## [1.0.0] - Dec 12, 2023
* First release of jfrog-registry-operator `1.0.0`
* First release of jfrog-registry-operator `1.0.0`

## [1.0.1] - Dec 20, 2023
* Adding serviceMonitor to jfrog-registry-operator
2 changes: 1 addition & 1 deletion charts/jfrog-registry-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kubeVersion: ">= 1.19.0-0"
type: application
name: jfrog-registry-operator
home: https://jfrog.com/platform/
version: 1.1.0
version: 1.3.0
appVersion: 1.x-SNAPSHOT
dependencies:
- name: jfrog-common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ spec:
secretName:
description: SecretName holding name of the secret
type: string
security:
description: Security holding tls/ssl certificates details
properties:
certificateSecretName:
type: string
enabled:
default: false
type: boolean
insecureSkipVerify:
type: boolean
secretNamespace:
type: string
type: object
required:
- namespaceSelector
type: object
Expand Down
8 changes: 7 additions & 1 deletion charts/jfrog-registry-operator/examples/secretrotator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ spec:
annotations:
annotationKey: annotationValue
labels:
labelName: labelValue
labelName: labelValue
security:
enabled: false
secretNamespace:
## NOTE: You can provide either a ca.pem or ca.crt. But make sure that key needs to same as ca.crt or ca.pem in secret
certificateSecretName:
insecureSkipVerify: false
10 changes: 10 additions & 0 deletions charts/jfrog-registry-operator/examples/tls_cert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
stringData:
# ca.crt: |

# cert.pem: |

kind: Secret
metadata:
name: certs
type: Opaque
5 changes: 4 additions & 1 deletion charts/jfrog-registry-operator/full-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ global:
image:
registry: releases-docker.jfrog.io
repository: jfrog/jfrog-registry-operator
tag: 1.0.0
tag: 1.3.0

pullPolicy: IfNotPresent
# pullSecrets:
Expand Down Expand Up @@ -384,3 +384,6 @@ initContainers:
tag: 9.2.717
pullPolicy: IfNotPresent
pullSecrets: []

serviceMonitor:
enabled: false
2 changes: 0 additions & 2 deletions charts/jfrog-registry-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: jfrog-registry-operator-data
emptyDir: {}
{{- if not (contains "data" (quote .Values.persistence.volumes)) }}
{{- if not .Values.persistence.enabled }}
- name: data
Expand Down
19 changes: 19 additions & 0 deletions charts/jfrog-registry-operator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: jfrog-operator
name: jfrog-registry-operator
namespace: {{ .Release.Namespace | quote }}
spec:
endpoints:
- interval: 30s
path: /metrics
port: operator
namespaceSelector:
any: true
selector:
matchLabels:
app: jfrog-operator
{{- end }}
7 changes: 5 additions & 2 deletions charts/jfrog-registry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ global:
image:
registry: releases-docker.jfrog.io
repository: jfrog/jfrog-registry-operator
tag: 1.0.0
tag: 1.3.0

pullPolicy: IfNotPresent
# pullSecrets:
Expand Down Expand Up @@ -215,4 +215,7 @@ initContainers:
repository: ubi9/ubi-minimal
tag: 9.2.717
pullPolicy: IfNotPresent
pullSecrets: []
pullSecrets: []

serviceMonitor:
enabled: false
13 changes: 13 additions & 0 deletions config/crd/bases/apps.jfrog.com_secretrotators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ spec:
secretName:
description: SecretName holding name of the secret
type: string
security:
description: Security holding tls/ssl certificates details
properties:
certificateSecretName:
type: string
enabled:
default: false
type: boolean
insecureSkipVerify:
type: boolean
secretNamespace:
type: string
type: object
required:
- namespaceSelector
type: object
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- ./operator
args:
- --leader-elect
image: releases-docker.jfrog.io/jfrog/jfrog-registry-operator:1.0.0
image: releases-docker.jfrog.io/jfrog/jfrog-registry-operator:1.3.0
name: manager
ports:
- containerPort: 8080
Expand Down
2 changes: 2 additions & 0 deletions config/monitoring/operator-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: Service
metadata:
name: jfrog-registry-operator-service
labels:
app: jfrog-operator
spec:
selector:
app: jfrog-operator
Expand Down
62 changes: 62 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- apps
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- apps
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps.jfrog.com
resources:
- secretrotators
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps.jfrog.com
resources:
- secretrotators/finalizers
verbs:
- update
- apiGroups:
- apps.jfrog.com
resources:
- secretrotators/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
Loading
Loading