Layout, build and templates follow deckhouse/modules-template; dmt lint passes with no findings (Go files are excluded from the Flant-only license-header rule, see .dmtlint.yaml). - module.yaml, openapi schemas with Russian docs, lib-helm templates: https modes, ingress class, publicDomainTemplate, node placement, priority class, PSS-restricted security context, VPA, PDB, Ingress plus Gateway API ListenerSet/HTTPRoute, DexAuthenticator. - module-sdk hooks: hubble CA from d8-cni-cilium (public certificate only), external_auth, copy_custom_certificate. - The app moves to images/cluster-map/src and is split into packages; traffic mode Continuous/OnDemand/Disabled and retention are module settings; graceful shutdown; Prometheus metrics and two alerts; frontend embedded, English and Russian, strict CSP. - Built with werf on Deckhouse's published base images; Makefile publishes the registry layout modules-actions uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.7 KiB
Go
56 lines
1.7 KiB
Go
/*
|
|
Copyright 2026 The cluster-map Authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/deckhouse/module-sdk/testing/framework"
|
|
)
|
|
|
|
const initValues = `{"clusterMap": {"internal": {}}}`
|
|
|
|
func TestHubbleCAIsCopiedWithoutKey(t *testing.T) {
|
|
hec := framework.HookExecutionConfigInit(t, hubbleCAConfig, handleHubbleCA, initValues, `{}`)
|
|
hec.KubeStateSet(`
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: hubble-ca-secret
|
|
namespace: d8-cni-cilium
|
|
data:
|
|
ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCg==
|
|
ca.key: bm90LWZvci11cw==
|
|
`)
|
|
hec.RunHook()
|
|
require.NoError(t, hec.HookError())
|
|
require.Equal(t, "-----BEGIN CERTIFICATE-----\n", hec.ValuesGet("clusterMap.internal.hubbleCA").String())
|
|
require.NotContains(t, hec.ValuesGet("clusterMap").Raw, "not-for-us")
|
|
}
|
|
|
|
func TestNoHubbleMeansEmptyCA(t *testing.T) {
|
|
hec := framework.HookExecutionConfigInit(t, hubbleCAConfig, handleHubbleCA, initValues, `{}`)
|
|
hec.KubeStateSet(``)
|
|
hec.RunHook()
|
|
require.NoError(t, hec.HookError())
|
|
require.True(t, hec.ValuesGet("clusterMap.internal.hubbleCA").Exists())
|
|
require.Equal(t, "", hec.ValuesGet("clusterMap.internal.hubbleCA").String())
|
|
}
|