Skip to content

Commit

Permalink
Merge pull request #113 from projectsyn/feat/specify-api-url
Browse files Browse the repository at this point in the history
Specify the Lieutenant API Url in an argument to the operator
  • Loading branch information
HappyTetrahedron authored Jul 26, 2024
2 parents 7d28807 + 8d61da4 commit 5b9dee6
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 4 deletions.
3 changes: 2 additions & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
operator:
registry: quay.io
repository: projectsyn/lieutenant-operator
version: '1.10.1'
version: '1.11.1'
api:
registry: docker.io
repository: projectsyn/lieutenant-api
Expand All @@ -18,6 +18,7 @@ parameters:
operator:
manifest_version: v${lieutenant:images:operator:version}
manifest_url: https://raw.githubusercontent.com/projectsyn/lieutenant-operator/${lieutenant:operator:manifest_version}/config
lieutenant_api_url: https://${lieutenant:api:ingress:host}
common_labels:
'app.kubernetes.io/name': 'lieutenant-operator'
'app.kubernetes.io/part-of': 'project-syn'
Expand Down
5 changes: 5 additions & 0 deletions component/operator.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ local default_env =
DEFAULT_GLOBAL_GIT_REPO_URL: params.operator.default_global_git_repo,
LIEUTENANT_DELETE_PROTECTION: params.operator.deletion_protection,
SKIP_VAULT_SETUP: !params.operator.vault.enabled,
LIEUTENANT_API_URL: params.operator.lieutenant_api_url,
} +
if params.operator.vault.enabled then
{
Expand Down Expand Up @@ -68,6 +69,10 @@ local objects = [
if c.name == 'lieutenant-operator' then
c {
image: image,
args: [
'-lieutenant-api-url',
'$(LIEUTENANT_API_URL)',
],
env: common.MergeEnvVars(
super.env,
com.envList(default_env + params.operator.env)
Expand Down
9 changes: 9 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ If a dict is given as the value, the component will render it as `valueFrom:`.

TIP: Environment variables configured in this parameter have precedence over environment variables generated from other component parameters.

== `operator.lieutenant_api_url`

[horizontal]
type:: string
default:: `https://${lieutenant:api:ingress:host}`

Make the Lieutenant Operator aware of where the API is publicly reachable.
By default, the API ingress hostname is used, with a `https://` prefix.

== `operator.vault.enabled`

[horizontal]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ spec:
description: DisplayName of cluster which could be different from
metadata.name. Allows cluster renaming should it be needed.
type: string
enableCompilePipeline:
description: EnableCompilePipeline determines whether the gitops compile
pipeline should be set up for this cluster
type: boolean
facts:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ spec:
description: DisplayName of cluster which could be different from
metadata.name. Allows cluster renaming should it be needed.
type: string
enableCompilePipeline:
description: EnableCompilePipeline determines whether the gitops
compile pipeline should be set up for this cluster
type: boolean
facts:
additionalProperties:
type: string
Expand Down Expand Up @@ -291,6 +295,22 @@ spec:
description: TokenLifetime set the token lifetime
type: string
type: object
compilePipeline:
description: CompilePipeline contains the configuration for the automatically
configured compile pipelines on this tenant
properties:
enabled:
description: Enabled enables or disables the compile pipeline
for this tenant
type: boolean
pipelineFiles:
additionalProperties:
type: string
description: Pipelines contains a map of filenames and file contents,
specifying files which are added to the GitRepoTemplate in order
to set up the automatically configured compile pipeline
type: object
type: object
creationPolicy:
description: |-
CreationPolicy defines how the external resources should be treated upon CR creation.
Expand Down Expand Up @@ -501,6 +521,18 @@ spec:
type: object
status:
description: TenantStatus defines the observed state of Tenant
properties:
compilePipeline:
description: CompilePipeline contains the status of the automatically
configured compile pipelines on this tenant
properties:
clusters:
description: Clusters contains the list of all clusters for which
the automatically configured compile pipeline is enabled
items:
type: string
type: array
type: object
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ spec:
description: DisplayName of cluster which could be different from
metadata.name. Allows cluster renaming should it be needed.
type: string
enableCompilePipeline:
description: EnableCompilePipeline determines whether the gitops
compile pipeline should be set up for this cluster
type: boolean
facts:
additionalProperties:
type: string
Expand Down Expand Up @@ -291,6 +295,22 @@ spec:
description: TokenLifetime set the token lifetime
type: string
type: object
compilePipeline:
description: CompilePipeline contains the configuration for the automatically
configured compile pipelines on this tenant
properties:
enabled:
description: Enabled enables or disables the compile pipeline
for this tenant
type: boolean
pipelineFiles:
additionalProperties:
type: string
description: Pipelines contains a map of filenames and file contents,
specifying files which are added to the GitRepoTemplate in order
to set up the automatically configured compile pipeline
type: object
type: object
creationPolicy:
description: |-
CreationPolicy defines how the external resources should be treated upon CR creation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ spec:
control-plane: controller-manager
spec:
containers:
- env:
- args:
- -lieutenant-api-url
- $(LIEUTENANT_API_URL)
env:
- name: DEFAULT_DELETION_POLICY
value: Archive
- name: DEFAULT_GLOBAL_GIT_REPO_URL
value: https://github.com/projectsyn/getting-started-commodore-defaults
- name: LIEUTENANT_API_URL
value: https://lieutenant.todo
- name: LIEUTENANT_DELETE_PROTECTION
value: 'false'
- name: OPERATOR_NAME
Expand All @@ -47,7 +52,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/projectsyn/lieutenant-operator:1.10.1
image: quay.io/projectsyn/lieutenant-operator:1.11.1
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func Test_OperatorDeployment(t *testing.T) {
require.NotEmpty(t, deploy.Spec.Template.Spec.Containers)
assert.Len(t, deploy.Spec.Template.Spec.Containers, 1)
c := deploy.Spec.Template.Spec.Containers[0]
assert.Len(t, c.Env, 10)
assert.Len(t, c.Env, 11)
}

func Test_OperatorRBAC(t *testing.T) {
Expand Down

0 comments on commit 5b9dee6

Please sign in to comment.