diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 2b261a2..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,168 +0,0 @@ -stages: - - build - - test - - publish-chart - - package - - deploy-docs - - -variables: - GIT_STRATEGY: clone - CONTAINER_URL: "${CI_REGISTRY_IMAGE}/base" - CONTAINER_DOCS_URL: "${CI_REGISTRY_IMAGE}/docs" - BROKER_CONTAINER: "code.ornl.gov:4567/intersect/sdk/broker/main:latest" - -# This import is for the func_rse_docker_* functions -before_script: - - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - source rse-bash-modules.sh - - func_rse_docker_cleanup - -after_script: - - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - - source rse-bash-modules.sh - - func_rse_docker_cleanup - - sudo chown -R gitlab-runner . - -container-build: - stage: build - script: - - > - docker build - -f Dockerfile - -t intersect-sdk-python . - - docker tag intersect-sdk-python $CONTAINER_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - - docker tag intersect-sdk-python $CONTAINER_URL/$CI_COMMIT_REF_NAME:latest - - docker push $CONTAINER_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - - docker push $CONTAINER_URL/$CI_COMMIT_REF_NAME:latest - tags: - - intersect-sdk-builder - -lint: - stage: test - script: - - > - docker run --rm $CONTAINER_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA sh -ec " - pdm run ruff check; - pdm run ruff format --check; - pdm run lint-mypy; - " - tags: - - intersect-sdk-builder - -test-suite-with-coverage: - stage: test - script: - - docker-compose up -d - - > - docker run - --name intersect-tester - --network host - $CONTAINER_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - pdm run test-all - - docker cp intersect-tester:/sdk/reports reports - - sudo sed -i "s:/sdk:${CI_BUILDS_DIR}/${CI_PROJECT_PATH}:" reports/coverage_report.xml - coverage: '/coverage: \d+.\d+%/' # for GitLab<15.0 use project settings, this line is noop - artifacts: - when: always - reports: - junit: reports/junit.xml - coverage_report: - coverage_format: cobertura - path: reports/coverage_report.xml - paths: - - reports/ - tags: - - intersect-sdk-builder - -build-docs: - stage: test - script: - # read Dockerfile from stdin with no build context - - > - docker build - --build-arg IMAGE=${CONTAINER_URL}/$CI_COMMIT_REF_NAME - --build-arg TAG=${CI_COMMIT_SHORT_SHA} - -t intersect-sdk-python-docs - < docs/Dockerfile - - > - docker tag - intersect-sdk-python-docs - $CONTAINER_DOCS_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - - > - docker tag - intersect-sdk-python-docs - $CONTAINER_DOCS_URL/$CI_COMMIT_REF_NAME:latest - - docker push $CONTAINER_DOCS_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - - docker push $CONTAINER_DOCS_URL/$CI_COMMIT_REF_NAME:latest - tags: - - intersect-sdk-builder - -publish-chart: - stage: publish-chart - variables: - KUBECTL_IMAGE: code.ornl.gov:4567/rse/images/kubectl:1.23.3-debian-10-r13_helm-3.8.1 - script: - - docker pull ${KUBECTL_IMAGE} - - > - docker run --rm --name kubectl - -v $PWD:/mount - --workdir /mount - --user $UID:$UID - -e CI_JOB_TOKEN=${CI_JOB_TOKEN} - -e CI_API_V4_URL=${CI_API_V4_URL} - -e CI_PROJECT_ID=${CI_PROJECT_ID} - -e CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} - ${KUBECTL_IMAGE} helm-publish-chart-with-gitlab-ci chart - rules: - - if: $CI_COMMIT_BRANCH == "main" - changes: - - chart/**/* - tags: - - intersect-sdk-builder - -publish-package: - stage: package - script: - - docker login --username=$CI_REGISTRY_USER --password=$CI_REGISTRY_PASSWORD $CI_REGISTRY - - > - docker run --rm - $CONTAINER_URL/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA - pdm publish - --username gitlab-ci-token - --password "$CI_JOB_TOKEN" - --repository "https://code.ornl.gov/api/v4/projects/${CI_PROJECT_ID}/packages/pypi" - tags: - - intersect-sdk-builder - rules: - - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+.*$/ - -deploy-docs-latest: - stage: deploy-docs - trigger: - project: intersect/devops/deployments/ornl-cloud-k8s - branch: main - strategy: depend - inherit: - variables: false - variables: - TRIGGER_UPSTREAM_BRANCH: next - TRIGGER_UPSTREAM_CHART_NAME: intersect-sdk-python-docs - TRIGGER_UPSTREAM_IMAGE_TAG: ${CI_COMMIT_SHORT_SHA} - rules: - - if: $CI_COMMIT_BRANCH == "main" - -deploy-docs-latest-tag: - stage: deploy-docs - trigger: - project: intersect/devops/deployments/ornl-cloud-k8s - branch: main - strategy: depend - inherit: - variables: false - variables: - TRIGGER_UPSTREAM_BRANCH: main - TRIGGER_UPSTREAM_CHART_NAME: intersect-sdk-python-docs - TRIGGER_UPSTREAM_IMAGE_TAG: ${CI_COMMIT_SHORT_SHA} - rules: - - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+.*$/ diff --git a/chart/.gitignore b/chart/.gitignore deleted file mode 100644 index fafeafa..0000000 --- a/chart/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Chart.lock \ No newline at end of file diff --git a/chart/.helmignore b/chart/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/chart/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/chart/Chart.yaml b/chart/Chart.yaml deleted file mode 100644 index e614fda..0000000 --- a/chart/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v2 -name: intersect-sdk-python-docs -description: "INTERSECT-SDK Python library documentation site" - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -dependencies: - - name: common - repository: oci://registry-1.docker.io/bitnamicharts - version: "^2.9.1" diff --git a/chart/README.md b/chart/README.md deleted file mode 100644 index 409e891..0000000 --- a/chart/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Helm chart - -Most templates are based off of the [Bitnami Charts Template](https://github.com/bitnami/charts/tree/main/template/]) - -We also use the Bitnami Common library to try and standardize some boilerplate across all charts. - -## Linting - -You'll need helm to be installed on your system, but you don't need to have a Kubernetes server configuration set up. - -1) Change directory into `chart` if you haven't already. -2) `helm dependency update` (if Chart.lock already exists, use `helm dependency build` instead; if `charts` directory exists in this directory, you can either skip this step or first remove .tgz files from `charts`) -3) `helm lint .` diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt deleted file mode 100644 index bc66a84..0000000 --- a/chart/templates/NOTES.txt +++ /dev/null @@ -1,51 +0,0 @@ -CHART NAME: {{ .Chart.Name }} -CHART VERSION: {{ .Chart.Version }} -APP VERSION: {{ .Chart.AppVersion }} - -** Please be patient while the chart is being deployed ** - -{{- if .Values.diagnosticMode.enabled }} -The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with: - - command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }} - args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }} - -Get the list of pods by executing: - - kubectl get pods --namespace {{ include "common.names.namespace" . | quote }} -l app.kubernetes.io/instance={{ .Release.Name }} - -Access the pod you want to debug by executing - - kubectl exec --namespace {{ include "common.names.namespace" . | quote }} -ti -- bash - -In order to replicate the container startup scripts execute this command: - - /docker-entrypoint.sh nginx -g "daemon off;" - -{{- else }} - -{{- if contains "LoadBalancer" .Values.service.type }} - - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "common.names.fullname" . }}' - - export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }}) - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo "http://${SERVICE_IP}:${SERVICE_PORT}" - -{{- else if contains "ClusterIP" .Values.service.type }} - - export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }}) - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "common.names.fullname" . }} ${SERVICE_PORT}:${SERVICE_PORT} & - echo "http://127.0.0.1:${SERVICE_PORT}" - -{{- else if contains "NodePort" .Values.service.type }} - - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo "http://${NODE_IP}:${NODE_PORT}" - -{{- end }} -{{- end }} - -{{- include "common.warnings.rollingTag" .Values.image }} diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl deleted file mode 100644 index c86a5e8..0000000 --- a/chart/templates/_helpers.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{{/* -Return the proper image name -*/}} -{{- define "intersect-sdk-python-docs.image" -}} -{{- include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) -}} -{{- end -}} - -{{/* -Return the proper Docker Image Registry Secret Names -*/}} -{{- define "intersect-sdk-python-docs.imagePullSecrets" -}} -{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) -}} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "intersect-sdk-python-docs.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} - {{ default (include "common.names.fullname" .) .Values.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} - -{{/* -Return true if cert-manager required annotations for TLS signed certificates are set in the Ingress annotations -Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations -*/}} -{{- define "intersect-sdk-python-docs.ingress.certManagerRequest" -}} -{{ if or (hasKey . "cert-manager.io/cluster-issuer") (hasKey . "cert-manager.io/issuer") }} - {{- true -}} -{{- end -}} -{{- end -}} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml deleted file mode 100644 index a4d9f1a..0000000 --- a/chart/templates/deployment.yaml +++ /dev/null @@ -1,141 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - {{- if .Values.updateStrategy }} - strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} - {{- end }} - selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} - template: - metadata: - {{- if .Values.podAnnotations }} - annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} - {{- end }} - labels: {{- include "common.labels.standard" . | nindent 8 }} - {{- if .Values.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }} - {{- end }} - spec: - serviceAccountName: {{ template "intersect-sdk-python-docs.serviceAccountName" . }} - {{- include "intersect-sdk-python-docs.imagePullSecrets" . | nindent 6 }} - {{- if .Values.hostAliases }} - hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.affinity }} - affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} - {{- else }} - affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} - nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} - {{- end }} - {{- if .Values.nodeSelector }} - nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.tolerations }} - tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} - {{- end }} - {{- if .Values.priorityClassName }} - priorityClassName: {{ .Values.priorityClassName | quote }} - {{- end }} - {{- if .Values.schedulerName }} - schedulerName: {{ .Values.schedulerName | quote }} - {{- end }} - {{- if .Values.topologySpreadConstraints }} - topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }} - {{- end }} - {{- if .Values.podSecurityContext.enabled }} - securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} - {{- end }} - {{- if .Values.terminationGracePeriodSeconds }} - terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} - {{- end }} - {{- if .Values.initContainers }} - initContainers: - {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} - {{- end }} - containers: - - name: http - image: {{ template "intersect-sdk-python-docs.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.containerSecurityContext.enabled }} - securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} - {{- end }} - {{- if .Values.diagnosticMode.enabled }} - command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }} - {{- else if .Values.command }} - command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.diagnosticMode.enabled }} - args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }} - {{- else if .Values.args }} - args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }} - {{- end }} - ports: - - name: http - containerPort: {{ .Values.service.port }} - protocol: TCP - env: - {{- if .Values.extraEnvVars }} - {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} - {{- end }} - envFrom: - {{- if .Values.extraEnvVarsCM }} - - configMapRef: - name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }} - {{- end }} - {{- if .Values.extraEnvVarsSecret }} - - secretRef: - name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} - {{- end }} - {{- if .Values.resources }} - resources: {{- toYaml .Values.resources | nindent 12 }} - {{- end }} - {{- if not .Values.diagnosticMode.enabled }} - {{- if .Values.customLivenessProbe }} - livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} - {{- else if .Values.livenessProbe.enabled }} - livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }} - httpGet: - path: / - port: http - {{- end }} - {{- if .Values.customReadinessProbe }} - readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} - {{- else if .Values.readinessProbe.enabled }} - readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }} - httpGet: - path: / - port: http - {{- end }} - {{- if .Values.customStartupProbe }} - startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }} - {{- else if .Values.startupProbe.enabled }} - startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }} - httpGet: - path: / - port: http - {{- end }} - {{- end }} - {{- if .Values.lifecycleHooks }} - lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.sidecars }} - {{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }} - {{- end }} diff --git a/chart/templates/extra-list.yaml b/chart/templates/extra-list.yaml deleted file mode 100644 index 9ac65f9..0000000 --- a/chart/templates/extra-list.yaml +++ /dev/null @@ -1,4 +0,0 @@ -{{- range .Values.extraDeploy }} ---- -{{ include "common.tplvalues.render" (dict "value" . "context" $) }} -{{- end }} diff --git a/chart/templates/hpa.yaml b/chart/templates/hpa.yaml deleted file mode 100644 index 763f91b..0000000 --- a/chart/templates/hpa.yaml +++ /dev/null @@ -1,42 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: autoscaling/v2 -{{- else -}} -{{- fail "Invalid k8s version, version >=1.23 is required" }} -{{- end }} -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "common.names.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml deleted file mode 100644 index 011ba07..0000000 --- a/chart/templates/ingress.yaml +++ /dev/null @@ -1,66 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else -}} -{{- fail "Invalid k8s version, version >=1.19 is required" }} -{{- end }} -kind: Ingress -metadata: - name: {{ template "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.ingress.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.ingress.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.ingress.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- end }} -spec: - {{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }} - ingressClassName: {{ .Values.ingress.ingressClassName | quote }} - {{- end }} - rules: - {{- if .Values.ingress.hostname }} - - host: {{ .Values.ingress.hostname }} - http: - paths: - {{- if .Values.ingress.extraPaths }} - {{- toYaml .Values.ingress.extraPaths | nindent 10 }} - {{- end }} - - path: {{ .Values.ingress.path }} - {{- if eq "true" (include "common.ingress.supportsPathType" .) }} - pathType: {{ .Values.ingress.pathType }} - {{- end }} - backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }} - {{- end }} - {{- range .Values.ingress.extraHosts }} - - host: {{ .name | quote }} - http: - paths: - - path: {{ default "/" .path }} - {{- if eq "true" (include "common.ingress.supportsPathType" $) }} - pathType: {{ default "ImplementationSpecific" .pathType }} - {{- end }} - backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }} - {{- end }} - {{- if .Values.ingress.extraRules }} - {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }} - {{- end }} - {{- if or (and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned)) .Values.ingress.extraTls }} - tls: - {{- if and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned) }} - - hosts: - - {{ .Values.ingress.hostname | quote }} - secretName: {{ printf "%s-tls" .Values.ingress.hostname }} - {{- end }} - {{- if .Values.ingress.extraTls }} - {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraTls "context" $) | nindent 4 }} - {{- end }} - {{- end }} -{{- end }} diff --git a/chart/templates/pdb.yaml b/chart/templates/pdb.yaml deleted file mode 100644 index 30c802c..0000000 --- a/chart/templates/pdb.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- $replicaCount := int .Values.replicaCount }} -{{- if and .Values.pdb.create (or (gt $replicaCount 1) .Values.autoscaling.enabled) }} -apiVersion: policy/v1 -kind: PodDisruptionBudget -metadata: - name: {{ include "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -spec: - {{- if .Values.pdb.minAvailable }} - minAvailable: {{ .Values.pdb.minAvailable }} - {{- end }} - {{- if .Values.pdb.maxUnavailable }} - maxUnavailable: {{ .Values.pdb.maxUnavailable }} - {{- end }} - selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} -{{- end }} diff --git a/chart/templates/service-account.yaml b/chart/templates/service-account.yaml deleted file mode 100644 index 0bb88db..0000000 --- a/chart/templates/service-account.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- if .Values.serviceAccount.create }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "intersect-sdk-python-docs.serviceAccountName" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.serviceAccount.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.serviceAccount.annotations "context" $) | nindent 4 }} - {{- end }} - {{- end }} -automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} -{{- end }} diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml deleted file mode 100644 index e7080cc..0000000 --- a/chart/templates/service.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "common.names.fullname" . }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if or .Values.service.annotations .Values.commonAnnotations }} - annotations: - {{- if .Values.service.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- end }} -spec: - type: {{ .Values.service.type }} - {{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }} - clusterIP: {{ .Values.service.clusterIP }} - {{- end }} - {{- if .Values.service.sessionAffinity }} - sessionAffinity: {{ .Values.service.sessionAffinity }} - {{- end }} - {{- if .Values.service.sessionAffinityConfig }} - sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }} - {{- end }} - {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} - {{- end }} - {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }} - loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} - {{- end }} - {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }} - nodePort: {{ .Values.service.nodePort }} - {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/chart/templates/tls-secrets.yaml b/chart/templates/tls-secrets.yaml deleted file mode 100644 index e45c884..0000000 --- a/chart/templates/tls-secrets.yaml +++ /dev/null @@ -1,45 +0,0 @@ -{{- if .Values.ingress.enabled }} -{{- if .Values.ingress.secrets }} -{{- range .Values.ingress.secrets }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .name }} - namespace: {{ include "common.names.namespace" $ | quote }} - labels: {{- include "common.labels.standard" $ | nindent 4 }} - {{- if $.Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if $.Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -type: kubernetes.io/tls -data: - tls.crt: {{ .certificate | b64enc }} - tls.key: {{ .key | b64enc }} ---- -{{- end }} -{{- end }} -{{- if and .Values.ingress.tls .Values.ingress.selfSigned }} -{{- $secretName := printf "%s-tls" .Values.ingress.hostname }} -{{- $ca := genCA "intersect-sdk-python-docs-ca" 365 }} -{{- $cert := genSignedCert .Values.ingress.hostname nil (list .Values.ingress.hostname) 365 $ca }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ $secretName }} - namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -type: kubernetes.io/tls -data: - tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }} - tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }} - ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }} -{{- end }} -{{- end }} diff --git a/chart/values.yaml b/chart/values.yaml deleted file mode 100644 index 24eb263..0000000 --- a/chart/values.yaml +++ /dev/null @@ -1,155 +0,0 @@ -# Default values for intersect-sdk-python-docs. -# most of this structure is consistent with Bitnami's, but there are no RBAC or persistence values. - -# global values used by this chart -global: - imageRegistry: "" - imagePullSecrets: [] - storageClass: "" - kubeVersion: "" - -### Generic Kubernetes parameters ### - -kubeVersion: "" -nameOverride: "" -fullnameOverride: "" -namespaceOverride: "" -commonLabels: {} -commonAnnotations: {} -extraDeploy: [] # dynamic Kubernetes templates -diagnosticMode: - enabled: false - command: - - sleep - args: - - infinity - -### Container params ### - -image: - registry: code.ornl.gov:4567 - repository: intersect/sdk/python-sdk/sdk/docs/main - tag: "latest" - digest: "" - pullPolicy: "" - pullSecrets: [] - -replicaCount: 1 - -livenessProbe: # the application developers should help determine sane default params - enabled: true - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 10 - failureThreshold: 6 - successThreshold: 1 - -readinessProbe: # the application developers should help determine sane default params - enabled: true - initialDelaySeconds: 5 - timeoutSeconds: 3 - periodSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - -startupProbe: # the application developers should help determine sane default params - enabled: false - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 10 - failureThreshold: 6 - successThreshold: 1 - -customLivenessProbe: {} -customReadinessProbe: {} -customStartupProbe: {} - -resources: - limits: {} - requests: {} - -# TODO this probably has to be configured based on the system -podSecurityContext: - enabled: false - fsGroup: 1001 -containerSecurityContext: - enabled: false - runAsUser: 1001 - runAsNonRoot: true - readOnlyRootFilesystem: false - -command: [] -args: [] -hostAliases: [] -podLabels: {} -podAnnotations: {} -podAffinityPreset: "" -podAntiAffinityPreset: soft - -pdb: - create: false - minAvailable: 1 - maxUnavailable: "" -autoscaling: - enabled: false - minReplicas: "" - maxReplicas: "" - targetCPUUtilizationPercentage: "" - targetMemoryUtilizationPercentage: "" -nodeAffinityPreset: - type: "" - key: "" - values: [] -affinity: {} -nodeSelector: {} -tolerations: [] -updateStrategy: - type: RollingUpdate -priorityClassName: "" -topologySpreadConstraints: [] -schedulerName: "" -terminationGracePeriodSeconds: "" -lifecycleHooks: {} -extraEnvVars: [] -extraEnvVarsCM: "" -extraEnvVarsSecret: "" -initContainers: [] -sidecars: [] - -### Traffic exposure ### - -service: - type: ClusterIP - port: 80 - # make sure this is a number - nodePort: "" - clusterIP: "" - loadBalancerIP: "" - loadBalancerSourceRanges: [] - externalTrafficPolicy: Cluster - annotations: {} - sessionAffinity: None - sessionAffinityConfig: {} - -ingress: - enabled: false - pathType: ImplementationSpecific - hostname: intersect-sdk-python-docs.local - ingressClassName: "" - path: / - annotations: {} - tls: false - selfSigned: false - extraHosts: [] - extraPaths: [] - extraTls: [] - secrets: [] - extraRules: [] - -### Kubernetes role stuff - -serviceAccount: - create: false - annotations: {} - name: "" - automountServiceAccountToken: true diff --git a/docs/Dockerfile b/docs/Dockerfile index a952342..8beb441 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,9 +1,13 @@ -ARG IMAGE=code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/base/main -ARG TAG=latest -ARG NGINX_IMAGE=code.ornl.gov:4567/rse/images/ +# This Dockerfile allows you to quickly build and run the docs website in Docker. +# it is built from an existing intersect-sdk image, there is no other build context +# run this command to build it from the repository root: +# docker build --build-arg IMAGE= -t intersect-sdk-python-docs - < docs/Dockerfile + +ARG IMAGE +ARG NGINX_IMAGE= # Build the HTML from docs -FROM ${IMAGE}:${TAG} as docs +FROM ${IMAGE} as docs WORKDIR /sdk/docs ENV SPHINXOPTS="-W --keep-going" RUN pdm run make html diff --git a/docs/contributing.rst b/docs/contributing.rst index ed78685..5667b19 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -10,7 +10,7 @@ Follow the steps discussed in this section to install the intersect-sdk package .. code-block:: bash - git clone https://code.ornl.gov/intersect/sdk/python-sdk/sdk.git + git clone https://github.com/INTERSECT-SDK/python-sdk/ Create a Python virtual environment in the root level of the repository and activate the environment. diff --git a/docs/examples/counting-events.rst b/docs/examples/counting-events.rst index 67a131f..0362f2d 100644 --- a/docs/examples/counting-events.rst +++ b/docs/examples/counting-events.rst @@ -49,12 +49,11 @@ You can also run the client again while NOT killing the service; the output will Running it yourself: Using Docker --------------------------------- -First, you will need to pull the latest INTERSECT-SDK image: +First, you will need to build the latest INTERSECT-SDK image; run the following command from the repository root: .. code-block:: bash - docker login code.ornl.gov:4567 - docker pull code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest + docker build -t intersect-sdk . Then you can run the examples like this: @@ -65,10 +64,10 @@ Then you can run the examples like this: # to the end of your command on UNIX systems # First, run the service - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_service + docker run --rm -it --name intersect-service --network host intersect-sdk python -m examples.1_hello_world.hello_service # Next, run the client in a separate terminal - docker run --rm -it --name intersect-client --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_client + docker run --rm -it --name intersect-client --network host intersect-sdk python -m examples.1_hello_world.hello_client After several seconds, the output from ``counting_client`` will look something like this (the values will be higher if you waited longer between starting the client and the service): diff --git a/docs/examples/counting.rst b/docs/examples/counting.rst index 8e3b564..d969ac4 100644 --- a/docs/examples/counting.rst +++ b/docs/examples/counting.rst @@ -73,12 +73,11 @@ You can also run the client again while NOT killing the service; the output will Running it yourself: Using Docker --------------------------------- -First, you will need to pull the latest INTERSECT-SDK image: +First, you will need to build the latest INTERSECT-SDK image; run the following command from the repository root: .. code-block:: bash - docker login code.ornl.gov:4567 - docker pull code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest + docker build -t intersect-sdk . Then you can run the examples like this: @@ -89,10 +88,10 @@ Then you can run the examples like this: # to the end of your command on UNIX systems # First, run the service - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_service + docker run --rm -it --name intersect-service --network host intersect-sdk python -m examples.1_hello_world.hello_service # Next, run the client in a separate terminal - docker run --rm -it --name intersect-client --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_client + docker run --rm -it --name intersect-client --network host intersect-sdk python -m examples.1_hello_world.hello_client After several seconds, the output from ``counting_client`` will look something like this: diff --git a/docs/examples/hello-world-events.rst b/docs/examples/hello-world-events.rst index adacda8..03f4ffe 100644 --- a/docs/examples/hello-world-events.rst +++ b/docs/examples/hello-world-events.rst @@ -45,12 +45,11 @@ The client will exit automatically; you will have to use Ctrl+C on the terminal Running it yourself: Using Docker --------------------------------- -First, you will need to pull the latest INTERSECT-SDK image: +First, you will need to build the latest INTERSECT-SDK image; run the following command from the repository root: .. code-block:: bash - docker login code.ornl.gov:4567 - docker pull code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest + docker build -t intersect-sdk . Then you can run the examples like this: @@ -61,10 +60,10 @@ Then you can run the examples like this: # to the end of your command on UNIX systems # First, run the service - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world_events.hello_service + docker run --rm -it --name intersect-service --network host intersect-sdk python -m examples.1_hello_world_events.hello_service # Next, run the client in a separate terminal - docker run --rm -it --name intersect-client --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world_events.hello_client + docker run --rm -it --name intersect-client --network host intersect-sdk python -m examples.1_hello_world_events.hello_client After several seconds, the output from ``hello_client`` will be: diff --git a/docs/examples/hello-world.rst b/docs/examples/hello-world.rst index b86a549..49dfd19 100644 --- a/docs/examples/hello-world.rst +++ b/docs/examples/hello-world.rst @@ -43,12 +43,11 @@ The client will exit automatically; you will have to use Ctrl+C on the terminal Running it yourself: Using Docker --------------------------------- -First, you will need to pull the latest INTERSECT-SDK image: +First, you will need to build the latest INTERSECT-SDK image; run the following command from the repository root: .. code-block:: bash - docker login code.ornl.gov:4567 - docker pull code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest + docker build -t intersect-sdk . Then you can run the examples like this: @@ -59,10 +58,10 @@ Then you can run the examples like this: # to the end of your command on UNIX systems # First, run the service - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_service + docker run --rm -it --name intersect-service --network host intersect-sdk python -m examples.1_hello_world.hello_service # Next, run the client in a separate terminal - docker run --rm -it --name intersect-client --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python -m examples.1_hello_world.hello_client + docker run --rm -it --name intersect-client --network host intersect-sdk python -m examples.1_hello_world.hello_client After several seconds, the output from ``hello_client`` will be: diff --git a/docs/examples/ping-pong-events.rst b/docs/examples/ping-pong-events.rst index 9a760a4..2b81079 100644 --- a/docs/examples/ping-pong-events.rst +++ b/docs/examples/ping-pong-events.rst @@ -67,12 +67,11 @@ You can also run the client again while NOT killing the service; the output will Running it yourself: Using Docker --------------------------------- -First, you will need to pull the latest INTERSECT-SDK image: +First, you will need to build the latest INTERSECT-SDK image; run the following command from the repository root: .. code-block:: bash - docker login code.ornl.gov:4567 - docker pull code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest + docker build -t intersect-sdk . Then you can run the examples like this: @@ -83,13 +82,13 @@ Then you can run the examples like this: # to the end of your command on UNIX systems # First, start up the ping service in one terminal - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python examples.3_ping_pong_events.ping_service + docker run --rm -it --name intersect-service --network host intersect-sdk python examples.3_ping_pong_events.ping_service # Next, start up the pong service in a second terminal - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python examples.3_ping_pong_events.pong_service + docker run --rm -it --name intersect-service --network host intersect-sdk python examples.3_ping_pong_events.pong_service # Finally, run the client in a third terminal - docker run --rm -it --name intersect-service --network host code.ornl.gov:4567/intersect/sdk/python-sdk/sdk/main:latest python examples.3_ping_pong_events.ping_pong_client + docker run --rm -it --name intersect-service --network host intersect-sdk python examples.3_ping_pong_events.ping_pong_client After several seconds, the output from ``ping_pong_client`` will look something like this: diff --git a/docs/installation.rst b/docs/installation.rst index c88cb06..1b0bfd7 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,7 +1,7 @@ Installation and usage ====================== -You will need to use a Python version >= 3.8.10 . You can install Python via `Anaconda `_ or `Conda `_. Anaconda installs Python along with many other graphical tools and scientific packages. Conda is an open-source packaging, dependency, and environment management tool which also installs Python. Notice that Miniconda is a smaller version of Anaconda that includes only Conda and a few dependencies. +INTERSECT-SDK requires a Python version >= 3.8.10 . After installing Python, make a folder for your project, then create a virtual environment in that folder and activate the environment as follows: @@ -37,15 +37,6 @@ Use the command shown below to deactivate the virtual environment: If you would like to run the examples, such as the :doc:`examples/hello-world` example, you may need to install Docker and run a broker service. See the sections below for more information. -Installation using a prebuilt Docker image ------------------------------------------- - -If you want to utilize the prebuilt INTERSECT-SDK Docker container, you need to login to the GitLab Container registry using the command shown below. Then sign in with your UCAMS or XCAMS credentials. - -.. code-block:: bash - - docker login code.ornl.gov:4567 - Docker ------ @@ -54,7 +45,7 @@ Docker Backing Services (Brokers, Data planes) --------------------------------------- -A Docker Compose configuration for SDK development is included below. +A Docker Compose configuration for SDK development is included below. This sets up the primary backing services (message brokers, data storage layers) needed to use INTERSECT. Note that this configuration is meant for testing, and should not be included in production.